hi efla.
Perhaps, this code is useful for you.
line 163 of include/common.php
//autologin GIJ
if(empty($HTTP_SESSION_VARS['xoopsUserId']) && isset($HTTP_COOKIE_VARS['autologin_uname']) && isset($HTTP_COOKIE_VARS['autologin_pass'])) {
// redirect to Root when query string exists (anti-CSRF)
if( ! empty( $HTTP_SERVER_VARS['QUERY_STRING'] ) ) {
redirect_header( XOOPS_URL.'/' , 0 , 'Now, logging in automatically' ) ;
exit ;
}
$myts =& MyTextSanitizer::getInstance();
$uname = $myts->stripSlashesGPC($HTTP_COOKIE_VARS['autologin_uname']);
$pass = $myts->stripSlashesGPC($HTTP_COOKIE_VARS['autologin_pass']);
$myts =& MyTextsanitizer::getInstance();
$user =& $member_handler->loginUserMd5(addslashes($uname), addslashes($pass));
$xoops_cookie_path = defined('XOOPS_COOKIE_PATH') ? XOOPS_COOKIE_PATH : preg_replace( '?http://[^/]+(/.*)$?' , "$1" , XOOPS_URL ) ;
if( $xoops_cookie_path == XOOPS_URL ) $xoops_cookie_path = '/' ;
if (false != $user && $user->getVar('level') > 0) {
// update time of last login
$user->setVar('last_login', time());
if (!$member_handler->insertUser($user, true)) {
}
//$HTTP_SESSION_VARS = array();
$HTTP_SESSION_VARS['xoopsUserId'] = $user->getVar('uid');
$HTTP_SESSION_VARS['xoopsUserGroups'] = $user->getGroups();
// update autologin cookies
$expire = time() + $xoopsConfig['session_expire'] * 60 ;
setcookie('autologin_uname', $uname, $expire, $xoops_cookie_path, '', 0);
setcookie('autologin_pass', $pass, $expire, $xoops_cookie_path, '', 0);
redirect_header( XOOPS_URL.'/' , 0 , 'Now, logging in automatically' ) ;
exit ;
} else {
setcookie('autologin_uname', '', time() - 3600, $xoops_cookie_path, '', 0);
setcookie('autologin_pass', '', time() - 3600, $xoops_cookie_path, '', 0);
}
}
-------------
6/21 edited) XOOPS_URL to XOOPS_URL.'/' as redirection URL.