-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathreg.php
More file actions
57 lines (53 loc) · 1.58 KB
/
reg.php
File metadata and controls
57 lines (53 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<!doctype html>
<html>
<?php
//phpinfo();
$e = 1;
$user = $_POST["user"];
$pwd = $_POST["pwd"];
if ($user == null) {
echo "用户名不能为空";
$e = 0;
}
if ($pwd == null) {
echo "密码不能为空";
$e = 0;
}
include_once "dbpwd.php";
$conn = mysqli_connect("114.115.146.81:3306", "root", $dbpwd);
mysqli_query($conn, "use userinfo");
$sql = "select * from info where user='$user'";
$res = mysqli_query($conn, $sql);
if (mysqli_num_rows($res)) {
$msg = "用户名已存在";
$e = 0;
}
$sql="insert into info(user,pwd) values('$user','$pwd')";
if($e==1)mysqli_query($conn,$sql);
if($e==1) $msg="注册成功";
mysqli_close($conn);
?>
<head>
<meta charset="utf-8">
<!--<meta http-equiv="refresh" content='1;url=./index.php' />-->
<script src="./js/jquery.js"></script>
<script src="./js/jquery.form.js"></script>
<link rel="stylesheet" href="./css/materialize.css">
<link rel="stylesheet" href="./css/main.css">
</head>
<body class="blue-grey">
<div class="container center center-align center-block centered">
<h1 class="white-text" style="margin-top: 150px; text-shadow: 1px 1px light-grey"><?php echo $msg; ?></h1>
</div>
<form method="POST" style="display:none" action="index.php" id="f1" enctype="multipart/form-data">
<input name="username" style="display:none" type="text" value="<?php echo $user; ?>" />
</form>
<script>
<?php
$str="$('#f1').submit()";
if($e==1) echo "setTimeout($str,1500);";
?>
setTimeout("window.location.href='reg.html'",1500);
</script>
</body>
</html>