-
Notifications
You must be signed in to change notification settings - Fork 0
/
user_add.php
56 lines (55 loc) · 1.59 KB
/
user_add.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
html,body{
width:100%;
height:100%;
}
body{
background-image:url("./image2/library.jpg");
background-size:100% 100%;
}
h1,h3,a{
color:white;
}
div{
text-align:center;
font-size:30px;
color:white;
padding:10px 0 10px 0;
}
a{
display:block;
}
</style>
</head>
<body>
<?php
$bid = $_REQUEST['bid'];
$userName = $_REQUEST['userName'];
$userPassword = $_REQUEST['userPassword'];
$isAdmin = $_REQUEST['isAdmin'];
//连接数据库
$conn = mysqli_connect('127.0.0.1','root','','dangdang',3306);
//var_dump($conn);
//提交sql命令
$sql = "SET NAMES UTF8";
mysqli_query($conn,$sql);
$sql = "INSERT INTO user_info VALUES('$bid','$userName','$userPassword','$isAdmin')";
$result = mysqli_query($conn,$sql);
//查看执行结果
if($result){
echo '<h1>执行成功</h1>';
echo '<h3>新插入的数据在数据库的编号为:'.mysqli_insert_id($conn).'</h3>';
echo "<a href='user_manage.php'>查看用户列表</a>";
}else{
echo '<h1>执行失败请查看SQL语句'.$sql.'</h1>';
}
?>
</body>
</html>