icon Posted April 12, 2006 Share Posted April 12, 2006 hi i have made a site which uses mysql with sessions, but what i wont to know is i have the following code:<?if(!$_SESSION['username']){header("Location: [a href=\"http://domain");\" target=\"_blank\"]http://domain");[/a]} else {print <<<ENDhtmlEND;}?> on the page to protect and if there is no session name in the current session it redirect to the login page how do i have a query string added to the url that send it back to the page it come from like ie domain.com/bahbah/?url=http://home.domain.comthanks Link to comment https://forums.phpfreaks.com/topic/7237-help-with-redirection/ Share on other sites More sharing options...
jworisek Posted April 12, 2006 Share Posted April 12, 2006 what you say is exactly right...just add ?url=http://www....whateveror you could even just use php server variable to get the referring page.I like to add an error variable on to saty something like[code]$error_explain="Your Session has timed out. Please log back in.";header("Location: http://domain/login.php?url=http://referrer&error=$error_explain");[/code] Link to comment https://forums.phpfreaks.com/topic/7237-help-with-redirection/#findComment-26353 Share on other sites More sharing options...
icon Posted April 12, 2006 Author Share Posted April 12, 2006 i have added url=http://referrer& on the end of the url but it doesnt work, is there a variable that calls what page it come from Link to comment https://forums.phpfreaks.com/topic/7237-help-with-redirection/#findComment-26407 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.