News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

problem with returning to referer page after login

Started by chadness, February 17, 2005, 03:58:19 PM

Previous topic - Next topic

chadness

Quote from: verm on February 14, 2005, 08:04:49 AM
Additional on login/logout redirection.

I think by default the  mod_smf_login module will point to the mambo index page after login/logout. To redirect you back to the page where you login/logout, in MOS_SMF.php change this line from:

$_SESSION['login_url'] = $mosConfig_live_site;

to
$_SESSION['login_url'] = mosGetParam( $_SERVER, 'HTTP_REFERER', null );

and from:

$_SESSION['logout_url'] = $mosConfig_live_site;

to
$_SESSION['logout_url'] = mosGetParam( $_SERVER, 'HTTP_REFERER', null );

I am no php genius but I think it works! (that is after hours of experimenting)  ;D
If you load this code from the combined readme thread (click link above for the source of this), you may run in to a problem if people log in to your site while in a subdirectory.  For instance, go to your registration page, which should be in the subdirectory "directory" and login there.  You will be returned to the registration page, but if click a relative link from there (such as a "home" link on your main menu) you may end up at yoursite.com/directory/index.php.  For me, that link seems to be my regular site, but anything off of a a relative path from there is messed up (several images, my admin login, etc.).

I caught this on my test site, and I'd be curious if anyone else can verify this.  Just something to watch out for.

Advertisement: