You've already forked EasyImages2.0
mirror of
https://github.com/icret/EasyImages2.0.git
synced 2025-12-13 11:43:58 +08:00
add~
This commit is contained in:
115
admin/index.php
115
admin/index.php
@@ -7,54 +7,7 @@ require_once APP_ROOT . '/application/header.php';
|
||||
require_once APP_ROOT . '/config/config.guest.php';
|
||||
// 验证登录
|
||||
header("Content-Type: text/html;charset=utf-8");
|
||||
if (isset($_REQUEST['code'])) {
|
||||
session_start();
|
||||
|
||||
if (strtolower($_REQUEST['code']) == $_SESSION['code']) {
|
||||
// 提交登录
|
||||
if (isset($_POST['password']) and isset($_POST['user'])) {
|
||||
|
||||
global $guestConfig;
|
||||
$postUser = strip_tags($_POST['user']);
|
||||
$postPWD = strip_tags($_POST['password']);
|
||||
|
||||
if ($postUser == $config['user'] || in_array($guestConfig[$postUser], $guestConfig)) {
|
||||
if ($postPWD == $config['password'] || $postPWD == $guestConfig[$postUser]['password']) {
|
||||
// 将账号密码序列化后存储
|
||||
$setCOK = serialize(array($postUser, $postPWD));
|
||||
|
||||
setcookie('auth', $setCOK, time() + 3600 * 24 * 14, '/');
|
||||
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>';
|
||||
header("refresh:2;");
|
||||
}
|
||||
} else {
|
||||
echo '
|
||||
<script>
|
||||
new $.zui.Messager("账号不存在", {type: "danger" // 定义颜色主题
|
||||
}).show();
|
||||
</script>';
|
||||
header("refresh:2;");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
echo '
|
||||
<script>
|
||||
new $.zui.Messager("验证码错误!", {type: "danger" // 定义颜色主题
|
||||
}).show();
|
||||
</script>';
|
||||
}
|
||||
}
|
||||
|
||||
// 退出
|
||||
if (isset($_GET['login'])) {
|
||||
@@ -86,6 +39,62 @@ if (isset($_GET['login'])) {
|
||||
';
|
||||
}
|
||||
}
|
||||
exit(require_once APP_ROOT . '/application/footer.php');
|
||||
}
|
||||
|
||||
// 验证码
|
||||
if ($config['captcha']) {
|
||||
if (isset($_REQUEST['code'])) {
|
||||
session_start();
|
||||
if (strtolower($_REQUEST['code']) !== $_SESSION['code']) {
|
||||
echo '
|
||||
<script>
|
||||
new $.zui.Messager("验证码错误!", {type: "danger" // 定义颜色主题
|
||||
}).show();
|
||||
// 延时2s跳转
|
||||
window.setTimeout("window.location=\'./index.php\'",2000);
|
||||
</script>';
|
||||
|
||||
exit(require_once APP_ROOT . '/application/footer.php');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 提交登录
|
||||
if (isset($_POST['password']) and isset($_POST['user'])) {
|
||||
|
||||
global $guestConfig;
|
||||
$postUser = strip_tags($_POST['user']);
|
||||
$postPWD = strip_tags($_POST['password']);
|
||||
|
||||
if ($postUser == $config['user'] || in_array($guestConfig[$postUser], $guestConfig)) {
|
||||
if ($postPWD == $config['password'] || $postPWD == $guestConfig[$postUser]['password']) {
|
||||
// 将账号密码序列化后存储
|
||||
$setCOK = serialize(array($postUser, $postPWD));
|
||||
|
||||
setcookie('auth', $setCOK, time() + 3600 * 24 * 14, '/');
|
||||
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>';
|
||||
header("refresh:2;");
|
||||
}
|
||||
} else {
|
||||
echo '
|
||||
<script>
|
||||
new $.zui.Messager("账号不存在", {type: "danger" // 定义颜色主题
|
||||
}).show();
|
||||
</script>';
|
||||
header("refresh:2;");
|
||||
}
|
||||
}
|
||||
?>
|
||||
<link href="<?php static_cdn(); ?>/public/static/login.css" rel="stylesheet">
|
||||
@@ -123,12 +132,14 @@ if (isset($_GET['login'])) {
|
||||
<input type="text" name="user" id="account" class="form-control" value="" placeholder="输入登录账号" autocomplete="off" required="required">
|
||||
<input type="password" name="password" id="password" class="form-control" value="" placeholder="输入登录密码" autocomplete="off" required="required">
|
||||
<input type="hidden" name="password" id="md5_password">
|
||||
<input class="form-control" type="text" name="code" value="" placeholder="输入下方4位数验证码" autocomplete="off" required="required" />
|
||||
<div class="form-group">
|
||||
<div class="col">
|
||||
<label><img src="../application/captcha.php" onClick="this.src='../application/captcha.php?nocache='+Math.random()" title="点击换一张" /></label>
|
||||
<?php if ($config['captcha']) : ?>
|
||||
<input class="form-control" type="text" name="code" value="" placeholder="输入下方4位数验证码" autocomplete="off" required="required" />
|
||||
<div class="form-group">
|
||||
<div class="col">
|
||||
<label><img src="../application/captcha.php" onClick="this.src='../application/captcha.php?nocache='+Math.random()" title="点击换一张" /></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<button type="submit" class="btn btn-block btn-primary">登 录</button>
|
||||
<p class="signup">忘记账号或密码请查看<a href="#fogot" data-moveable="inside" data-remember-pos="false" data-toggle="modal" data-target="#fogot" data-position="center">帮助信息</a></p>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user