Preserve current url when logging in. Pass the current url as part of the url to the login form

so we can return the user to the starting url after login.
This commit is contained in:
Alexander Nicolaysen Sørnes
2007-06-15 23:40:21 +00:00
committed by WineHQ
parent 9d35df1b54
commit c5e1b08b5d
5 changed files with 26 additions and 4 deletions

View File

@@ -903,4 +903,20 @@ function util_trim_description($sDescription)
return trim(strip_tags($aDesc[0]));
}
/* This allows us to pass on the current URL to the login form so that the user is returned
to the current page once he has logged in */
function login_url()
{
$sCurrentUrl = $_SERVER['REQUEST_URI'];
$sLoginUrl = BASE."account.php?sCmd=login";
/* If we are on the login page that means the URL already contains an sReturnTo value,
and we don't want two. Besides, there is little point in redirecting to the login page
after login. */
if(!strpos($sCurrentUrl, "sReturnTo") && !strpos($sCurrentUrl, "account.php"))
$sLoginUrl .= "&sReturnTo=".$sCurrentUrl;
return $sLoginUrl;
}
?>