From 049339f8212fefec834d130095fa9bdb2f1e8941 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E8=83=A1?= <3203164629@qq.com> Date: Fri, 23 Jun 2023 03:27:46 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96XH=E9=80=9A=E7=94=A8=E7=99=BB?= =?UTF-8?q?=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 小胡 <3203164629@qq.com> --- user/sso/xhlogin.php | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/user/sso/xhlogin.php b/user/sso/xhlogin.php index 7bfb5d5..6feea0d 100644 --- a/user/sso/xhlogin.php +++ b/user/sso/xhlogin.php @@ -21,22 +21,28 @@ if($_G['setting']['quick_login']){ return; } if(($user=C::t('user')->fetch_by_username($username)) || ($user=C::t('user')->fetch_by_email($email))){//用户已经存在时 + if ($user['adminid']) { + //写入日志 + writelog('loginlog', '管理员尝试XH通用登录失败'); + showmessage('为了安全,禁止管理员通过这种方式登录'); + return; + } $result = getuserbyuid($user['uid'], 1); if($result['status']>0){ //写入日志 writelog('loginlog', '尝试XH通用登录失败,此用户已停用'); showmessage('此用户已停用,请联系管理员'); } - if ($user['adminid']) { - //写入日志 - writelog('loginlog', '管理员尝试XH通用登录失败'); - showmessage('为了安全,禁止管理员通过这种方式登录'); - return; - } - $idstring = explode('_', $user['emailsenddate']); - if ($idstring[0] == (time() - $idstring[1]) < 86400) { - dsetcookie('auth', authcode("{$user['password']}\t{$user['uid']}", 'ENCODE'), 0, 1, true); + //设置登录 + setloginstatus($result, $_GET['cookietime'] ? 2592000 : 0); + + if($_G['member']['lastip'] && $_G['member']['lastvisit']) { + + dsetcookie('lip', $_G['member']['lastip'].','.$_G['member']['lastvisit']); } + + //记录登录 + C::t('user_status')->update($_G['uid'], array('lastip' => $_G['clientip'], 'lastvisit' =>TIMESTAMP, 'lastactivity' => TIMESTAMP)); writelog('loginlog', 'XH通用登录成功'); showmessage('Login_success',$_G['siteurl']); }else{ @@ -70,13 +76,17 @@ if($_G['setting']['quick_login']){ $sitename=$_G['setting']['sitename']; C::t('user')->update($uid,$base); - $idstring = explode('_', $user['emailsenddate']); + //设置登录 + $result = getuserbyuid($user['uid'], 1); + setloginstatus($result, $_GET['cookietime'] ? 2592000 : 0); - if ($idstring[0] == (time() - $idstring[1]) < 86400) { + if($_G['member']['lastip'] && $_G['member']['lastvisit']) { - dsetcookie('auth', authcode("{$user['password']}\t{$user['uid']}", 'ENCODE'), 0, 1, true); + dsetcookie('lip', $_G['member']['lastip'].','.$_G['member']['lastvisit']); + } - } + //记录登录 + C::t('user_status')->update($_G['uid'], array('lastip' => $_G['clientip'], 'lastvisit' =>TIMESTAMP, 'lastactivity' => TIMESTAMP)); writelog('loginlog', 'XH通用登录成功'); showmessage('Login_success',$_G['siteurl']); }