2021-07-17 05:27:19 +00:00
|
|
|
|
<?php
|
|
|
|
|
/*
|
|
|
|
|
* 登录页面
|
|
|
|
|
*/
|
2022-01-27 09:25:46 +00:00
|
|
|
|
require_once __DIR__ . '/../application/function.php';
|
2021-11-09 03:43:23 +00:00
|
|
|
|
require_once APP_ROOT . '/application/header.php';
|
2022-01-27 09:25:46 +00:00
|
|
|
|
require_once APP_ROOT . '/config/config.guest.php';
|
2021-11-17 03:48:11 +00:00
|
|
|
|
|
2022-01-27 09:25:46 +00:00
|
|
|
|
// 验证登录
|
2021-11-17 03:48:11 +00:00
|
|
|
|
header("Content-Type: text/html;charset=utf-8");
|
|
|
|
|
if (isset($_REQUEST['code'])) {
|
|
|
|
|
session_start();
|
|
|
|
|
|
2022-01-27 09:25:46 +00:00
|
|
|
|
if (strtolower($_REQUEST['code']) == $_SESSION['code']) {
|
2021-11-17 03:48:11 +00:00
|
|
|
|
// 提交登录
|
2022-01-05 10:41:45 +00:00
|
|
|
|
if (isset($_POST['password']) and isset($_POST['user'])) {
|
2022-01-27 09:25:46 +00:00
|
|
|
|
|
|
|
|
|
$postUser = strip_tags($_POST['user']);
|
|
|
|
|
$postPWD = strip_tags($_POST['password']);
|
|
|
|
|
|
|
|
|
|
global $guestConfig;
|
|
|
|
|
if ($postUser == $config['user'] || in_array($postPWD, $guestConfig)) {
|
|
|
|
|
if ($postPWD == $config['password'] || $postPWD == $guestConfig[$postUser]) {
|
|
|
|
|
// 将账号密码序列化后存储
|
|
|
|
|
$setCOK = serialize(array($postUser, $postPWD));
|
|
|
|
|
|
|
|
|
|
setcookie('auth', $setCOK, time() + 3600 * 24 * 14, '/');
|
2022-01-05 10:41:45 +00:00
|
|
|
|
echo '
|
|
|
|
|
<script>
|
|
|
|
|
new $.zui.Messager("登录成功", {type: "primary" // 定义颜色主题
|
|
|
|
|
}).show();
|
|
|
|
|
</script>';
|
|
|
|
|
header("refresh:2;url=" . $config['domain'] . "");
|
|
|
|
|
} else {
|
|
|
|
|
echo '
|
|
|
|
|
<script>
|
|
|
|
|
new $.zui.Messager("密码错误", {type: "danger" // 定义颜色主题
|
|
|
|
|
}).show();
|
|
|
|
|
</script>';
|
|
|
|
|
exit(header("refresh:1;"));
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
echo '
|
|
|
|
|
<script>
|
|
|
|
|
$.zui.Messager("用户名错误", {type: "danger" // 定义颜色主题
|
|
|
|
|
}).show();
|
|
|
|
|
</script>';
|
|
|
|
|
exit(header("refresh:2;"));
|
|
|
|
|
}
|
2021-11-17 03:48:11 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2022-01-05 10:41:45 +00:00
|
|
|
|
echo '
|
|
|
|
|
<script>
|
|
|
|
|
new $.zui.Messager("验证码错误!", {type: "danger" // 定义颜色主题
|
|
|
|
|
}).show();
|
|
|
|
|
</script>';
|
2021-11-17 03:48:11 +00:00
|
|
|
|
}
|
2021-07-17 05:27:19 +00:00
|
|
|
|
}
|
2022-01-27 09:25:46 +00:00
|
|
|
|
|
|
|
|
|
// 退出
|
|
|
|
|
if (isset($_GET['login'])) {
|
|
|
|
|
if ($_GET['login'] = 'logout') {
|
|
|
|
|
|
|
|
|
|
if (isset($_COOKIE['auth'])) {
|
|
|
|
|
setcookie('auth', null, time() - 1, '/');
|
|
|
|
|
header("Refresh:2;url=../index.php");
|
|
|
|
|
echo '
|
|
|
|
|
<script>
|
|
|
|
|
new $.zui.Messager("退出成功", {
|
|
|
|
|
type: "success", // 定义颜色主题
|
|
|
|
|
icon: "ok-sign" // 定义消息图标
|
|
|
|
|
}).show();
|
|
|
|
|
// 延时2s跳转
|
|
|
|
|
window.setTimeout("window.location=\'../index.php\'",2000);
|
|
|
|
|
</script>
|
|
|
|
|
';
|
|
|
|
|
} else {
|
|
|
|
|
echo '
|
|
|
|
|
<script>
|
|
|
|
|
new $.zui.Messager("尚未登录", {
|
|
|
|
|
type: "danger", // 定义颜色主题
|
|
|
|
|
icon: "exclamation-sign" // 定义消息图标
|
|
|
|
|
}).show();
|
|
|
|
|
// 延时2s跳转
|
|
|
|
|
window.setTimeout("window.location=\'./index.php\'",2000);
|
|
|
|
|
</script>
|
|
|
|
|
';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-07-17 05:27:19 +00:00
|
|
|
|
?>
|
2021-11-17 03:48:11 +00:00
|
|
|
|
<form class="form-horizontal" action="<?php echo $_SERVER['SCRIPT_NAME']; ?>" method="post" onsubmit="return md5_post()">
|
2021-11-12 14:17:05 +00:00
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label for="account" class="col-sm-2">账号</label>
|
|
|
|
|
<div class="has-success col-md-3 col-sm-5">
|
2022-01-10 06:47:25 +00:00
|
|
|
|
<input type="text" name="user" id="account" class="form-control" value="" placeholder="请输入登录账号">
|
2021-11-12 14:17:05 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label for="password" class="col-sm-2">密码</label>
|
|
|
|
|
<div class="has-success col-md-3 col-sm-5">
|
2022-01-10 06:47:25 +00:00
|
|
|
|
<input type="password" name="password" id="password" class="form-control" value="" placeholder="请输入登录密码">
|
2021-11-12 14:17:05 +00:00
|
|
|
|
</div>
|
|
|
|
|
<input type="hidden" name="password" id="md5_password">
|
|
|
|
|
</div>
|
2021-11-17 03:48:11 +00:00
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label class="col-sm-2">验证码</label>
|
|
|
|
|
<div class="has-success col-md-3 col-sm-5">
|
2022-01-27 09:25:46 +00:00
|
|
|
|
<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>
|
|
|
|
|
<input class="form-control" type="text" name="code" value="" placeholder="请输入上方4位数验证码 - 不区分大小写" />
|
2021-11-17 03:48:11 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2021-11-12 14:17:05 +00:00
|
|
|
|
<div class="form-group">
|
|
|
|
|
<div class="col-sm-offset-2 col-sm-10">
|
|
|
|
|
<div class="checkbox">
|
2022-01-19 10:56:59 +00:00
|
|
|
|
<label title="选不选都记得你,想退出就点击退出才可以哦!">
|
2021-11-12 14:17:05 +00:00
|
|
|
|
<input type="checkbox" checked="checked"> 记住我
|
|
|
|
|
</label>
|
2021-07-17 05:27:19 +00:00
|
|
|
|
</div>
|
2021-11-12 14:17:05 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<div class="col-sm-offset-2 col-sm-10">
|
2021-07-17 05:27:19 +00:00
|
|
|
|
<button type="submit" class="btn btn-primary">登录</button>
|
2021-11-12 14:17:05 +00:00
|
|
|
|
</div>
|
2021-07-17 05:27:19 +00:00
|
|
|
|
</div>
|
2021-11-12 14:17:05 +00:00
|
|
|
|
</form>
|
2022-02-06 22:20:07 +00:00
|
|
|
|
<script src="<?php static_cdn(); ?>/public/static/md5/md5.min.js"></script>
|
2021-07-17 05:27:19 +00:00
|
|
|
|
<script>
|
|
|
|
|
function md5_post() {
|
|
|
|
|
var password = document.getElementById('password');
|
|
|
|
|
var md5pwd = document.getElementById('md5_password');
|
|
|
|
|
md5pwd.value = md5(password.value);
|
|
|
|
|
//可以校验判断表单内容,true就是通过提交,false,阻止提交
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
<?php
|
2021-11-09 03:43:23 +00:00
|
|
|
|
require_once APP_ROOT . '/application/footer.php';
|