-
Notifications
You must be signed in to change notification settings - Fork 3
/
admin.php
227 lines (208 loc) · 6.47 KB
/
admin.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
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
<?php
session_start();
$user = isset($_SESSION['wop_admin_user']) ? $_SESSION['wop_admin_user'] : '';
empty($user) && header('Location: ./login.php');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>后台管理</title>
<link rel="shortcut icon" href="./asset/image/favicon.ico">
<link rel="stylesheet" href="./asset/css/reset.css">
<style>
@media screen and (max-width: 640px) {
.btn-size {
height: 10vw;
margin: 3vw auto 0;
padding: 0 3vw;
font-size: 4vw;
}
.user-size, .modify-password-size, .logout-size {
height: 4vw;
line-height: 4vw;
font-size: 3vw;
margin-left: 2vw;
display: inline-block;
vertical-align: top;
overflow: hidden;
}
.logo {
margin: 0 auto 10vw;
width: 30vw;
height: 30vw;
background: url("./asset/image/oauth_proxy.png") no-repeat center / contain;
}
}
@media screen and (min-width: 640px) {
.btn-size {
height: calc(640px * 0.1);
margin: calc(640px * 0.03) auto 0;
padding: 0 calc(640px * 0.03);
font-size: calc(640px * 0.04);
}
.user-size, .modify-password-size, .logout-size {
height: calc(640px * 0.04);
line-height: calc(640px * 0.04);
font-size: calc(640px * 0.03);
margin-left: 2vw;
display: inline-block;
vertical-align: top;
overflow: hidden;
}
.logo {
margin: 0 auto calc(640px * 0.1);
width: calc(640px * 0.3);
height: calc(640px * 0.3);
background: url("./asset/image/oauth_proxy.png") no-repeat center / contain;
}
}
.wrapper {
width: 100vw;
height: 100vh;
}
.container {
margin: 0 auto;
width: 100%;
max-width: 640px;
height: 100vh;
overflow: hidden;
position: relative;
}
.user-box {
width: 100%;
padding: 0 2vw;
box-sizing: border-box;
text-align: right;
position: absolute;
top: 2vw;
left: 0;
z-index: 100;
font-size: 0;
}
.user {
color: #36a82e;
}
.modify-password-btn, .logout-btn {
color: #ddd;
text-decoration: underline;
cursor: pointer;
user-select: none;
}
.box {
width: 100%;
position: absolute;
overflow: auto;
top: 50%;
left: 50%;
z-index: 10;
transform: translate(-50%, -50%);
-webkit-transform: translate(-50%, -50%);
}
.box-content {
margin: 0 2vw;
max-height: 100vh;
}
.btn {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
box-sizing: border-box;
text-align: center;
border: 0;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
color: #fff;
background: #36a82e;
cursor: pointer;
border-radius: 3px;
-moz-user-select: none;
-o-user-select:none;
-webkit-user-select:none;
-ms-user-select:none;
user-select: none;
}
.btn p {
width: 100%;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.disable {
background: #ddd !important;
cursor: not-allowed !important;
}
</style>
</head>
<body>
<div class="wrapper">
<div class="container">
<div class="user-box">
<p class="user user-size"><?php echo $user; ?></p>
<a href="./modifyPassword.php">
<p class="modify-password-btn modify-password-size">修改密码</p>
</a>
<p class="logout-btn logout-size">退出登录</p>
</div>
<div class="box">
<div class="box-content">
<div class="logo"></div>
<a href="./verify.php">
<div class="btn btn-size">
<p>添加微信公众号授权登录域名验证文件内容</p>
</div>
</a>
<a href="./safeDomainName.php">
<div class="btn btn-size">
<p>添加接口调用安全域名</p>
</div>
</a>
</div>
</div>
</div>
</div>
<script>
var loginoutBtnObj = document.getElementsByClassName('logout-btn')[0],
logoutState = 1,
xhr = '';
if (window.ActiveXObject) {
xhr = new ActiveXObject("Microsoft.XMLHTTP");
} else if (window.XMLHttpRequest) {
xhr = new XMLHttpRequest();
}
var logout = function(e) {
e.preventDefault();
if (logoutState != 1) {
return;
}
logoutState = 0;
xhr.open('post', './common/logoutHandle.php', true);
xhr.setRequestHeader('Content-type','application/x-www-form-urlencoded');
xhr.send('');
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
responseObj = JSON.parse(xhr.response);
alert(responseObj.message);
if (responseObj.code == 1) {
setTimeout(function() {
window.location.href = './login.php';
}, 500);
} else {
logoutState = 1;
}
} else {
console.log(xhr.readyState);
}
}
}
loginoutBtnObj.addEventListener('click', function(e) {
confirm('您确定要退出吗?') && logout(e);
});
</script>
</body>
</html>