Page is a not externally linkable
- Code, Content, and Presentation
-- PHP Server Side Scripting
---- Redirect user to previous page after logging in


scraptoft - 4:48 pm on Sep 16, 2009 (gmt 0)


My log-in script currently directs all users to account.php after logging in.

For convenience of the user I would like to redirect them to the page that prompted them to log-in.

Currently I am using $referer = $_SERVER['HTTP_REFERER']; to get the refering page and then I'm using a header redirect to send them back header("Location:$referer");

The problem:

When pressing submit $referer equals the current log-in page.

i.e.

$referer = domain.com/previouspage.html
*click - login*
$referer = domain.com/login.html
header("Location:http://www.domain.com/login.html");


Thread source:: http://www.webmasterworld.com/php/3990391.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com