forked from happydxh/lovelijian
-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin.html
99 lines (91 loc) · 2.86 KB
/
admin.html
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>登入后台</title>
<link rel="stylesheet" type="text/css" href="css/main.css"/>
</head>
<body>
<header id="header">
<h2 class="logo">爱李健</h2>
</header>
<div id="login">
<h2>登入后台</h2>
<p class="loginInfo">用户名或密码错误</p>
<form id="formlogin" name="reg" >
<div class="int">
<label for="login_user">用 户 名:</label>
<input type="text" id="login_user" name="user" class="text" />
</div>
<div class="int">
<label for="login_pass">密 码:</label>
<input type="password" id="login_pass" name="pass" class="text" />
</div>
<div class="expiresBox">
<input type="checkbox" name="expires" id="expires" checked="checked" />
<label for="expires">记住密码</label>
</div>
<input type="button" id="regbtn" class="loginBtn" value="立即登入" />
</form>
</div>
<div id="loading">
<p>加载中</p>
</div>
<div id="success">
<p>成功</p>
</div>
<script src="js/jquery-1.12.3.min.js" type="text/javascript" charset="utf-8"></script>
<script src="js/jquery.cookie.js" type="text/javascript" charset="utf-8"></script>
<script src="js/tool.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
$(function(){
//登入后台
$('.loginBtn').on('click',function(){
var _this = this;
var loading = $('#loading');
loading.show();
$('#loading').find('p').html('登入中..');
center(loading,200,40)
_this.disabled = true;
$(_this).css('background','darkgray');
$.ajax({
type:"post",
url:"php/is_login.php",
data:$('#formlogin').serialize(),
success:function(text){
loading.hide();
if(text == 1){//失败
$('.loginInfo').show();
_this.disabled = false;
$(_this).css('background','#a29060');
}else{
var success = $('#success');
success.show();
success.find('p').html('登入成功');
center(success,200,40);
if ($('#expires').is(':checked')) {
$.cookie('admin', $('#login_user').val(), {
expires : 7,
path:'/'
});
} else {
$.cookie('user', $('#login_user').val());
}
setTimeout(function(){
success.hide();
_this.disabled = false;
$(_this).css('background','#a29060');
$('#formlogin')[0].reset();
//$('.login').children('a').html($.cookie('user')).css('color','#f4c45a');
//window.history.back();
window.location.href='houtai.html';
},1500);
}
},
async:true
});
})
})
</script>
</body>
</html>