PEAK XOOPS - Re: autologin problem with xt temas ??? in englishin japanese

Re: autologin problem with xt temas ???

List posts in the topic

normal Re: autologin problem with xt temas ???

msg# 1.1
depth:
1
Previous post - Next post | Parent - No child | Posted on 2004/11/30 15:34
GIJOE  ÀèǤ·³Áâ   Posts: 4110
hi irmtfan.
Quote:
i have a problem
if a user in my site check the "remember me" and after that go to site it always change the theme to "default theme" but i use xt temas at my site and it keep the own users themes.
every thing is ok with uncheck the "remember me" option
any idea/solution for this?
I've just fixed it.

line 213 of include/common.php
	// autologin hack GIJ
	if(empty($HTTP_SESSION_VARS['xoopsUserId']) && isset($HTTP_COOKIE_VARS['autologin_uname']) && isset($HTTP_COOKIE_VARS['autologin_pass'])) {

		// redirect to XOOPS_URL/ 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']);
		$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();
			// begin newly added in 2004-11-30
			$user_theme = $user->getVar('theme');
			if (in_array($user_theme, $xoopsConfig['theme_set_allowed'])) {
				$HTTP_SESSION_VARS['xoopsUserTheme'] = $user_theme;
			}
			// end newly added in 2004-11-30
			// update autologin cookies
			$expire = time() + ( defined('XOOPS_AUTOLOGIN_LIFETIME') ? XOOPS_AUTOLOGIN_LIFETIME : 604800 ) ; // 1 week default
			setcookie('autologin_uname', $uname, $expire, $xoops_cookie_path, '', 0);
			setcookie('autologin_pass', $pass, $expire, $xoops_cookie_path, '', 0);
		} else {
			setcookie('autologin_uname', '', time() - 3600, $xoops_cookie_path, '', 0);
			setcookie('autologin_pass', '', time() - 3600, $xoops_cookie_path, '', 0);
		}
	}
	// end of autologin hack GIJ

Quote:
also i want to know if you release this great hack for xoops2.0.9 beta? or wait for a RC version?
I'm too busy to try XOOPS-2.0.9beta.
When 2.0.9RC or stable is release, I'll make the patches.
Votes:1 Average:10.00

Posts tree

  Advanced search


Login
Username or e-mail:

Password:

Remember Me

Lost Password?

Register now!