-
Notifications
You must be signed in to change notification settings - Fork 0
/
login_ac.php
68 lines (50 loc) · 1.79 KB
/
login_ac.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
67
68
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Login</title>
</head>
<body>
<?php
include ("includes/conn.php");
$sqlclose="select * from config_close where id=1";
$queryclose=$db->query($sqlclose);
$rowclose=$db->fetch_array($queryclose);
if($rowclose['close1']==0){echo $rowclose['txt1'];exit();}
@session_start();
if($_POST['username']&&$_POST['password'])
{
$user=$_POST['username'];
$pwd=$_POST['password'];
$sql='SELECT * FROM users where loginname="'.$user.'" and pwd1="'.md5($pwd).'" limit 1';
$query=$db->query($sql);
if($row=$db->fetch_array($query))
{
if($row['lockuser']==1)
{
echo "<script>alert('账户处于冻结状态!');window.location.href='./';</script>";
exit();
}
$onlinetime=date("Y-m-d H:i:s");
$bdsql="Update users set logincishu=logincishu+1,onlinetime='".$onlinetime."' where id ='".$row['id']."' ";
$db->query($bdsql);
$sql="insert into loginrecode (userid,ip,adddate,addtime) values ('".$row['loginname']."','".$_SERVER["REMOTE_ADDR"]."','".date('Y-m-d')."','".date("Y-m-d H:i:s")."')";
$db->query($sql);
@session_start();
$_SESSION['uusername']=$row['loginname'];
$_SESSION['uuserid']=$row['id'];
$_SESSION['pass2']="";
$_SESSION['pass3']="";
$_SESSION['onlinetime']=$onlinetime;
$_SESSION['cs']=date("Y-m-d H:i:s");
echo "<script>window.parent.location.href='user.php';</script>";
exit();
}
else
{
echo "<script>alert('登陆失败,请检查用户名和密码是否正确!');window.location.href='login.php';</script>";
exit();
}
}
?></body>
</html>