-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
69 lines (67 loc) · 1.87 KB
/
Copy pathindex.php
File metadata and controls
69 lines (67 loc) · 1.87 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
58
59
60
61
62
63
64
65
66
67
68
69
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>登录页面</title>
<link rel="stylesheet" type="text/css" href="./css/login.css"/>
</head>
<body>
<div id="login_frame">
<p id="image_logo"><img src="./tp/logo.jpg"></p> <!--logo-->
<form action="" method="post" class="form_login">
<h3>用户登录</h3>
<p><label class="label_input">用户名</label><input type="text" id="username" name="xm" class="text_field"/></p>
<p><label class="label_input">密码</label><input type="password" id="password" name="mm" class="text_field"/></p>
<div>
<input class="button" type="submit" name="tj" value="登录"/>
<input class="button" type="submit" name="zhuce" value="注册"/>
<input class="button" type="button" value="初始化" onclick="window.location.href='init.php'">
</div>
</form>
</div>
</body>
</html>
<?php
if(isset($_POST["tj"]))
{
$xm=$_POST["xm"];
$mm=$_POST["mm"];
$flag=0;
$con=@mysql_connect('localhost','root','root');
if(!$con)
{
echo"<script>alert('服务器连接失败!'); </script>";
}
mysql_query("set names utf8");
mysql_query("set character set utf8");
mysql_query("set character_set_set_results= utf8");
$s=@mysql_select_db("BookLoanSystem");
if(!$s)
{
echo"<script>alert('数据表连接失败!'); </script>";
}
$selectSQ= "select * from Administrator";
$result = @mysql_query($selectSQ);
if ($xm==null||$mm==NULL)
{
echo"<script>alert('用户名或者密码为空!'); </script>";
}
else
{
while($row=mysql_fetch_array($result))
{
if($mm==$row['password']&&$xm==$row['adm_name'])
{
$flag=1;
header("location:../guanli.php");
}
}
if($flag==0){
echo"<script>alert('用户名或者密码错误!'); </script>";
}
}
}
if(isset($_POST["zhuce"])){
header("location:../zhuce.php");
}
?>