|
9 | 9 | // 验证登录
|
10 | 10 | header("Content-Type: text/html;charset=utf-8");
|
11 | 11 | if (isset($_REQUEST['code'])) {
|
12 |
| - session_start(); |
| 12 | + session_start(); |
13 | 13 |
|
14 |
| - if (strtolower($_REQUEST['code']) == $_SESSION['code']) { |
15 |
| - // 提交登录 |
16 |
| - if (isset($_POST['password']) and isset($_POST['user'])) { |
| 14 | + if (strtolower($_REQUEST['code']) == $_SESSION['code']) { |
| 15 | + // 提交登录 |
| 16 | + if (isset($_POST['password']) and isset($_POST['user'])) { |
17 | 17 |
|
18 |
| - global $guestConfig; |
19 |
| - $postUser = strip_tags($_POST['user']); |
20 |
| - $postPWD = strip_tags($_POST['password']); |
| 18 | + global $guestConfig; |
| 19 | + $postUser = strip_tags($_POST['user']); |
| 20 | + $postPWD = strip_tags($_POST['password']); |
21 | 21 |
|
22 |
| - if ($postUser == $config['user'] || in_array($postPWD, $guestConfig)) { |
23 |
| - if ($postPWD == $config['password'] || $postPWD == $guestConfig[$postUser]) { |
24 |
| - // 将账号密码序列化后存储 |
25 |
| - $setCOK = serialize(array($postUser, $postPWD)); |
| 22 | + if ($postUser == $config['user'] || in_array($postPWD, $guestConfig)) { |
| 23 | + if ($postPWD == $config['password'] || $postPWD == $guestConfig[$postUser]) { |
| 24 | + // 将账号密码序列化后存储 |
| 25 | + $setCOK = serialize(array($postUser, $postPWD)); |
26 | 26 |
|
27 |
| - setcookie('auth', $setCOK, time() + 3600 * 24 * 14, '/'); |
28 |
| - echo ' |
| 27 | + setcookie('auth', $setCOK, time() + 3600 * 24 * 14, '/'); |
| 28 | + echo ' |
29 | 29 | <script>
|
30 | 30 | new $.zui.Messager("登录成功", {type: "primary" // 定义颜色主题
|
31 | 31 | }).show();
|
32 | 32 | </script>';
|
33 |
| - header("refresh:2;url=" . $config['domain'] . ""); |
34 |
| - } else { |
35 |
| - echo ' |
| 33 | + header("refresh:2;url=" . $config['domain'] . ""); |
| 34 | + } else { |
| 35 | + echo ' |
36 | 36 | <script>
|
37 | 37 | new $.zui.Messager("密码错误", {type: "danger" // 定义颜色主题
|
38 | 38 | }).show();
|
39 | 39 | </script>';
|
40 |
| - header("refresh:2;"); |
41 |
| - } |
42 |
| - } else { |
43 |
| - echo ' |
| 40 | + header("refresh:2;"); |
| 41 | + } |
| 42 | + } else { |
| 43 | + echo ' |
44 | 44 | <script>
|
45 | 45 | new $.zui.Messager("账号不存在", {type: "danger" // 定义颜色主题
|
46 | 46 | }).show();
|
47 | 47 | </script>';
|
48 |
| - header("refresh:2;"); |
49 |
| - } |
50 |
| - } |
51 |
| - } else { |
52 |
| - echo ' |
| 48 | + header("refresh:2;"); |
| 49 | + } |
| 50 | + } |
| 51 | + } else { |
| 52 | + echo ' |
53 | 53 | <script>
|
54 | 54 | new $.zui.Messager("验证码错误!", {type: "danger" // 定义颜色主题
|
55 | 55 | }).show();
|
56 | 56 | </script>';
|
57 |
| - } |
| 57 | + } |
58 | 58 | }
|
59 | 59 |
|
60 | 60 | // 退出
|
61 | 61 | if (isset($_GET['login'])) {
|
62 |
| - if ($_GET['login'] = 'logout') { |
| 62 | + if ($_GET['login'] = 'logout') { |
63 | 63 |
|
64 |
| - if (isset($_COOKIE['auth'])) { |
65 |
| - setcookie('auth', null, time() - 1, '/'); |
66 |
| - header("Refresh:2;url=../index.php"); |
67 |
| - echo ' |
| 64 | + if (isset($_COOKIE['auth'])) { |
| 65 | + setcookie('auth', null, time() - 1, '/'); |
| 66 | + header("Refresh:2;url=../index.php"); |
| 67 | + echo ' |
68 | 68 | <script>
|
69 | 69 | new $.zui.Messager("退出成功", {
|
70 | 70 | type: "success", // 定义颜色主题
|
|
74 | 74 | window.setTimeout("window.location=\'../index.php\'",2000);
|
75 | 75 | </script>
|
76 | 76 | ';
|
77 |
| - } else { |
78 |
| - echo ' |
| 77 | + } else { |
| 78 | + echo ' |
79 | 79 | <script>
|
80 | 80 | new $.zui.Messager("尚未登录", {
|
81 | 81 | type: "danger", // 定义颜色主题
|
|
85 | 85 | window.setTimeout("window.location=\'./index.php\'",2000);
|
86 | 86 | </script>
|
87 | 87 | ';
|
88 |
| - } |
89 |
| - } |
| 88 | + } |
| 89 | + } |
90 | 90 | }
|
91 | 91 | ?>
|
| 92 | +<link href="<?php static_cdn(); ?>/public/static/login.css" rel="stylesheet"> |
92 | 93 | <!-- 忘记密码 -->
|
93 | 94 | <div class="modal fade" id="fogot">
|
94 |
| - <div class="modal-dialog "> |
95 |
| - <div class="modal-content"> |
96 |
| - <div class="modal-header"> |
97 |
| - <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">x</span><span class="sr-only">关闭</span></button> |
98 |
| - <h4 class="modal-title"> |
99 |
| - <i class="icon icon-bell-alt"> </i>忘记账号/密码? |
100 |
| - </h4> |
101 |
| - </div> |
102 |
| - <div class="modal-body"> |
103 |
| - <p class="text-primary">忘记账号可以打开-><code>/config/config.php</code>文件->找到user对应的键值->填入</p> |
104 |
| - <p class="text-success">忘记密码请将密码->转换成MD5小写-><a href="https://md5jiami.bmcx.com/" target="_blank" class="text-purple">转换网址</a>->打开<code>/config/config.php</code>文件->找到password对应的键值->填入</p> |
105 |
| - <h4 class="text-danger">更改后会立即生效并重新登录,请务必牢记账号和密码! </h4> |
106 |
| - </div> |
107 |
| - <div class="modal-footer"> |
108 |
| - <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button> |
109 |
| - </div> |
110 |
| - </div> |
111 |
| - </div> |
| 95 | + <div class="modal-dialog "> |
| 96 | + <div class="modal-content"> |
| 97 | + <div class="modal-header"> |
| 98 | + <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">x</span><span class="sr-only">关闭</span></button> |
| 99 | + <h4 class="modal-title"> |
| 100 | + 忘记账号/密码? |
| 101 | + </h4> |
| 102 | + </div> |
| 103 | + <div class="modal-body"> |
| 104 | + <p class="text-primary">忘记账号可以打开<code>/config/config.php</code>文件找到user对应的键值->填入</p> |
| 105 | + <p class="text-success">忘记密码请将密码转换成MD5小写(<a href="https://md5jiami.bmcx.com/" target="_blank" class="text-purple">转换网址</a>)->打开<code>/config/config.php</code>文件->找到password对应的键值->填入</p> |
| 106 | + <h4 class="text-danger">更改后会立即生效并重新登录,请务必牢记账号和密码! </h4> |
| 107 | + </div> |
| 108 | + <div class="modal-footer"> |
| 109 | + <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button> |
| 110 | + </div> |
| 111 | + </div> |
| 112 | + </div> |
112 | 113 | </div>
|
113 |
| -<form class="form-horizontal" action="<?php echo $_SERVER['SCRIPT_NAME']; ?>" method="post" onsubmit="return md5_post()"> |
114 |
| - <div class="form-group"> |
115 |
| - <label for="account" class="col-sm-2">账号</label> |
116 |
| - <div class="has-success col-md-3 col-sm-5"> |
117 |
| - <input type="text" name="user" id="account" class="form-control" value="" placeholder="请输入登录账号" required="required"> |
118 |
| - </div> |
119 |
| - </div> |
120 |
| - <div class="form-group"> |
121 |
| - <label for="password" class="col-sm-2">密码</label> |
122 |
| - <div class="has-success col-md-3 col-sm-5"> |
123 |
| - <input type="password" name="password" id="password" class="form-control" value="" placeholder="请输入登录密码" required="required"> |
124 |
| - </div> |
125 |
| - <input type="hidden" name="password" id="md5_password"> |
126 |
| - </div> |
127 |
| - <div class="form-group"> |
128 |
| - <label class="col-sm-2">验证码</label> |
129 |
| - <div class="has-success col-md-3 col-sm-5"> |
130 |
| - <label><img src="<?php echo $config["domain"] . "/application/captcha.php"; ?>" onClick="this.src='<?php echo $config["domain"] . "/application/captcha.php"; ?>?nocache='+Math.random()" title="点击换一张" /></label> |
131 |
| - <input class="form-control" type="text" name="code" value="" placeholder="请输入上方4位数验证码 - 不区分大小写" required="required" /> |
132 |
| - </div> |
133 |
| - </div> |
134 |
| - <div class="form-group"> |
135 |
| - <div class="col-sm-offset-2 col-sm-10"> |
136 |
| - <div class="checkbox"> |
137 |
| - <label title="选不选都记得你,想退出就点击退出才可以哦!"> |
138 |
| - <input type="checkbox" checked="checked"> 记住我 |
139 |
| - </label> |
140 |
| - <label title="选不选都记得你,想退出就点击退出才可以哦!"> |
141 |
| - <a href="#fogot" data-moveable="inside" data-remember-pos="false" data-toggle="modal" data-target="#fogot" data-position="center">忘记账号/密码?</a> |
142 |
| - </label> |
143 |
| - </div> |
144 |
| - </div> |
145 |
| - </div> |
146 |
| - <div class="form-group"> |
147 |
| - <div class="col-sm-offset-2 col-sm-10"> |
148 |
| - <button type="submit" class="btn btn-primary">登录</button> |
149 |
| - </div> |
150 |
| - </div> |
| 114 | +<section> |
| 115 | + <div class="container"> |
| 116 | + <div class="user singinBx"> |
| 117 | + <div class="imgBx"> |
| 118 | + <img src="<?php echo $config['login_bg']; ?>" alt="简单图床登陆界面背景图" /> |
| 119 | + </div> |
| 120 | + <div class="formBx"> |
| 121 | + <form class="form-horizontal" action="/admin/index.php" method="post" onsubmit="return md5_post()"> |
| 122 | + <h2>登录</h2> |
| 123 | + <label for="account" class="col-sm-2"></label> |
| 124 | + <input type="text" name="user" id="account" class="form-control" value="" placeholder="输入登录账号" autocomplete="off" required="required"> |
| 125 | + <input type="password" name="password" id="password" class="form-control" value="" placeholder="输入登录密码" autocomplete="off" required="required"> |
| 126 | + <input type="hidden" name="password" id="md5_password"> |
| 127 | + <input class="form-control" type="text" name="code" value="" placeholder="输入下方4位数验证码" autocomplete="off" required="required" /> |
| 128 | + <div class="form-group"> |
| 129 | + <div class="col"> |
| 130 | + <label><img src="<?php echo $config["domain"] . "/application/captcha.php"; ?>" onClick="this.src='<?php echo $config["domain"] . "/application/captcha.php"; ?>?nocache='+Math.random()" title="点击换一张" /></label> |
| 131 | + </div> |
| 132 | + </div> |
| 133 | + <button type="submit" class="btn btn-block btn-primary">登 录</button> |
| 134 | + <p class="signup">忘记账号或密码请查看<a href="#fogot" data-moveable="inside" data-remember-pos="false" data-toggle="modal" data-target="#fogot" data-position="center">帮助信息</a></p> |
| 135 | + </form> |
| 136 | + </div> |
| 137 | + </div> |
| 138 | + <div class="user singupBx"> |
| 139 | + <div class="formBx"> |
| 140 | + <form action=""> |
| 141 | + <h2>注册</h2> |
| 142 | + <input type="text" name="telyzm" id="telyzm" placeholder="手机号"> |
| 143 | + <input type="email" name="" placeholder="邮箱地址"> |
| 144 | + <input type="password" name="" placeholder="设置密码"> |
| 145 | + <input type="password" name="" placeholder="再次输入密码"> |
| 146 | + <input type="submit" name="" value="注册"> |
| 147 | + <p class="signup">已有账号?<a href="#" onclick="topggleForm();">登录</a></p> |
| 148 | + </form> |
| 149 | + </div> |
| 150 | + <div class="imgBx"><img src="<?php echo $config['login_bg']; ?>" alt="简单图床登陆界面背景图" /> |
| 151 | + </div> |
| 152 | + </div> |
| 153 | + </div> |
| 154 | +</section> |
151 | 155 | </form>
|
152 | 156 | <script src="<?php static_cdn(); ?>/public/static/md5/md5.min.js"></script>
|
153 | 157 | <script>
|
154 |
| - function md5_post() { |
155 |
| - var password = document.getElementById('password'); |
156 |
| - var md5pwd = document.getElementById('md5_password'); |
157 |
| - md5pwd.value = md5(password.value); |
158 |
| - //可以校验判断表单内容,true就是通过提交,false,阻止提交 |
159 |
| - return true; |
160 |
| - } |
| 158 | + function md5_post() { |
| 159 | + var password = document.getElementById('password'); |
| 160 | + var md5pwd = document.getElementById('md5_password'); |
| 161 | + md5pwd.value = md5(password.value); |
| 162 | + //可以校验判断表单内容,true就是通过提交,false,阻止提交 |
| 163 | + return true; |
| 164 | + } |
| 165 | + |
| 166 | + function topggleForm() { |
| 167 | + var container = document.querySelector('.container'); |
| 168 | + container.classList.toggle('active'); |
| 169 | + } |
161 | 170 | </script>
|
162 | 171 | <?php require_once APP_ROOT . '/application/footer.php';
|
0 commit comments