-
Notifications
You must be signed in to change notification settings - Fork 0
/
adduser.php
40 lines (39 loc) · 1.01 KB
/
adduser.php
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
<?php require_once('Connections/weblib.php'); ?>
<?php
header("Content-Type:text/html; charset=utf-8");
$user = $_POST["username"];
$pwd = $_POST["pwd"];
$mail = $_POST["email"];
$sex = $_POST["sex"];
if($user == "")
{
echo "<script>alert('用户名不能为空!'); history.go(-1);</script>";
}
else
{
if($pwd == "")
{
echo "<script>alert('密码不能为空!'); history.go(-1);</script>";
}
else
{
if($mail == "")
{
echo "<script>alert('邮箱不能为空!'); history.go(-1);</script>";
}
else
{
$sql = "insert into users(username,email,password,sex) values('$user','$mail','$pwd','$sex')";//向用户表插入一条记录
$result = mysql_query($sql);
if($result)
{
echo "<script>alert('添加成功!'); history.go(-1);</script>";
}
else
{
echo "<script>alert('添加失败!');history.go(-1);</script>";
}
}
}
}
?>