forked from hzequn/PHP_hotel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
userlog_post.php
66 lines (66 loc) · 1.8 KB
/
userlog_post.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
57
58
59
60
61
62
63
64
65
66
<?php
//验证登陆信息
session_start();
include_once 'conn.php';
?>
<link rel="stylesheet" href="css/style.css" />
<script src="js/jquery-2.1.3.min.js" type="text/javascript" charset="utf-8"></script>
<script src="js/sweetalert.min.js" type="text/javascript" charset="utf-8"></script>
<?php
$username=$_POST['username'];
$pwd=$_POST['pwd1'];
//MD5加盐解密
$salt="skjddq237:&*^$df234GJSN";
$pwd=$pwd+$salt;
$pwd=md5($pwd);
if ($username!="" && $pwd!="")
{
$sql="select * from yonghuzhuce where zhanghao='$username' and mima='$pwd'";//and issh='是' and `undo`='否'
$sql1="select * from yonghuzhuce where zhanghao='$username' and mima='$pwd' and issh='是'";//and `undo`='否'
$sql2="select * from yonghuzhuce where zhanghao='$username' and mima='$pwd' and issh='是' and `undo`='否'";
$query=mysql_query($sql);
$query1=mysql_query($sql1);
$query2=mysql_query($sql2);
if(mysql_num_rows($query) > 0){
if(mysql_num_rows($query1) > 0){
if(mysql_num_rows($query2) > 0){
$_SESSION['username']=$username;//保存用户名
$_SESSION['cx']="注册用户";
$_SESSION['xm']=mysql_result($query,$i,xingming);
$_SESSION['zp']=mysql_result($query,$i,zhaopian);
echo
"<script>
$(function(){
swal('成功','登录系统','success').then(() => {
location.href='index.php';
})});
</script>";
}else{
echo
"<script>
$(function(){
swal('失败','您的账户已停用,请联系管理员!','error').then(() => {
history.back();
})});
</script>";
}
}else{
echo
"<script>
$(function(){
swal('失败','您的账户未经审核!','error').then(() => {
history.back();
})});
</script>";
}
}else{
echo
"<script>
$(function(){
swal('失败','用户名错误或密码错误!','error').then(() => {
history.back();
})});
</script>";
}
}
?>