diff --git a/Application/Admin/Model/MemberModel.class.php b/Application/Admin/Model/MemberModel.class.php index ed1365e8d..49ac7baf0 100644 --- a/Application/Admin/Model/MemberModel.class.php +++ b/Application/Admin/Model/MemberModel.class.php @@ -79,7 +79,7 @@ class MemberModel extends Model { ); session('user_auth', $auth); session('user_auth_sign', data_auth_sign($auth)); - setcookie(session_name(),session_id(),time()+3600); + session('user_auth_expire', time()); } public function getNickName($uid){ diff --git a/Application/Common/Common/function.php b/Application/Common/Common/function.php index d3a793b4e..540686488 100644 --- a/Application/Common/Common/function.php +++ b/Application/Common/Common/function.php @@ -23,10 +23,19 @@ const ONETHINK_ADDON_PATH = './Addons/'; */ function is_login() { + // 判断是否过期 过期时间一个小时 + $expire = 3600; $user = session('user_auth'); if (empty($user)) { return 0; } else { + if (time() - intval(session('user_auth_expire')) > $expire) { // 过期正则直接去除掉session 并且返回false + session('user_auth', null); + session('user_auth_sign', null); + return 0; + } else { + session('user_auth_expire', time() + $expire); + } return session('user_auth_sign') == data_auth_sign($user) ? $user['uid'] : 0; } }