fix bugs
parent
68ae0e6ede
commit
ba4905122f
|
@ -126,7 +126,8 @@ function _login($user = null, $password = null)
|
||||||
}
|
}
|
||||||
// 存在cookie
|
// 存在cookie
|
||||||
if (isset($_COOKIE['auth'])) {
|
if (isset($_COOKIE['auth'])) {
|
||||||
$browser_cookie = unserialize($_COOKIE['auth']);
|
$browser_cookie = json_decode($_COOKIE['auth']);
|
||||||
|
|
||||||
// cookie无法读取
|
// cookie无法读取
|
||||||
if (!$browser_cookie) return json_encode(array('code' => 400, 'level' => 0, 'messege' => '登录已过期,请重新登录'));
|
if (!$browser_cookie) return json_encode(array('code' => 400, 'level' => 0, 'messege' => '登录已过期,请重新登录'));
|
||||||
// 判断账号是否存在
|
// 判断账号是否存在
|
||||||
|
@ -153,7 +154,7 @@ function _login($user = null, $password = null)
|
||||||
// 是否管理员
|
// 是否管理员
|
||||||
if ($user === $config['user'] && $password === $config['password']) {
|
if ($user === $config['user'] && $password === $config['password']) {
|
||||||
// 将账号密码序列化后存储
|
// 将账号密码序列化后存储
|
||||||
$browser_cookie = serialize(array($user, $password));
|
$browser_cookie = json_encode(array($user, $password));
|
||||||
setcookie('auth', $browser_cookie, time() + 3600 * 24 * 14, '/');
|
setcookie('auth', $browser_cookie, time() + 3600 * 24 * 14, '/');
|
||||||
return json_encode(array('code' => 200, 'level' => 1, 'messege' => '管理员登录成功'));
|
return json_encode(array('code' => 200, 'level' => 1, 'messege' => '管理员登录成功'));
|
||||||
}
|
}
|
||||||
|
@ -162,7 +163,7 @@ function _login($user = null, $password = null)
|
||||||
// 上传者账号过期
|
// 上传者账号过期
|
||||||
if ($guestConfig[$user]['expired'] < time()) return json_encode(array('code' => 400, 'level' => 0, 'messege' => $user . '账号已过期'));
|
if ($guestConfig[$user]['expired'] < time()) return json_encode(array('code' => 400, 'level' => 0, 'messege' => $user . '账号已过期'));
|
||||||
// 未过期设置cookie
|
// 未过期设置cookie
|
||||||
$browser_cookie = serialize(array($user, $password));
|
$browser_cookie = json_encode(array($user, $password));
|
||||||
setcookie('auth', $browser_cookie, time() + 3600 * 24 * 14, '/');
|
setcookie('auth', $browser_cookie, time() + 3600 * 24 * 14, '/');
|
||||||
return json_encode(array('code' => 200, 'level' => 2, 'messege' => $user . '用户登录成功'));
|
return json_encode(array('code' => 200, 'level' => 2, 'messege' => $user . '用户登录成功'));
|
||||||
}
|
}
|
||||||
|
@ -194,7 +195,7 @@ function checkLogin()
|
||||||
// 存在cookie
|
// 存在cookie
|
||||||
if (isset($_COOKIE['auth'])) {
|
if (isset($_COOKIE['auth'])) {
|
||||||
|
|
||||||
$getCOK = unserialize($_COOKIE['auth']);
|
$getCOK = json_decode($_COOKIE['auth']);
|
||||||
|
|
||||||
// 无法读取cookie
|
// 无法读取cookie
|
||||||
if (!$getCOK) {
|
if (!$getCOK) {
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php /** 账号登录 */ if (is_who_login('status')) : ?>
|
<?php /** 账号登录 */ if (is_who_login('status')) : ?>
|
||||||
<!-- 右侧的导航项目 -->
|
<!-- 右侧的导航项目 -->
|
||||||
<li class="nav navbar-nav navbar-right hidden-xs"><a href="<?php echo $config['domain']; ?>/admin/index.php?login=logout">您好:<?php echo unserialize($_COOKIE['auth'])[0]; ?> <i class="icon icon-signout"></i></a></li>
|
<li class="nav navbar-nav navbar-right hidden-xs"><a href="<?php echo $config['domain']; ?>/admin/index.php?login=logout">您好:<?php echo json_decode($_COOKIE['auth'])[0]; ?> <i class="icon icon-signout"></i></a></li>
|
||||||
<?php else : ?>
|
<?php else : ?>
|
||||||
<li class="nav navbar-nav navbar-right hidden-xs"><a href="<?php echo $config['domain']; ?>/admin/index.php"><i class="icon icon-user"> 登录</i></a></li>
|
<li class="nav navbar-nav navbar-right hidden-xs"><a href="<?php echo $config['domain']; ?>/admin/index.php"><i class="icon icon-user"> 登录</i></a></li>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
|
@ -138,7 +138,7 @@ if ($handle->uploaded) {
|
||||||
// 开启上传者单独目录
|
// 开启上传者单独目录
|
||||||
if ($config['guest_path_status']) {
|
if ($config['guest_path_status']) {
|
||||||
if (checkLogin() == 205) {
|
if (checkLogin() == 205) {
|
||||||
$getCok = unserialize($_COOKIE['auth']);
|
$getCok = json_decode($_COOKIE['auth']);
|
||||||
$Img_path = config_path($getCok[0] . date('/Y/m/d/'));
|
$Img_path = config_path($getCok[0] . date('/Y/m/d/'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,5 +1,6 @@
|
||||||
* 2023-03-06 v2.7.8
|
* 2023-03-06 v2.7.8
|
||||||
- 增加WEB端上传签名
|
- 增加WEB端上传签名
|
||||||
|
- 修复一处漏洞
|
||||||
|
|
||||||
* 2023-03-05 v2.7.7
|
* 2023-03-05 v2.7.7
|
||||||
- 增加登录日志
|
- 增加登录日志
|
||||||
|
|
Loading…
Reference in New Issue