xfire Posted September 27, 2007 Share Posted September 27, 2007 Hey all, I have a login page, and instead of going to the index.php page all the time after a successful login, I want the user to be directed to the last page they where at, as long as it is a page on the website. Ideas? Thanks!! Link to comment https://forums.phpfreaks.com/topic/70828-solved-login-page-previous-page/ Share on other sites More sharing options...
teng84 Posted September 27, 2007 Share Posted September 27, 2007 try HTTP_REFERER' http://www.php.net/reserved.variables Link to comment https://forums.phpfreaks.com/topic/70828-solved-login-page-previous-page/#findComment-356090 Share on other sites More sharing options...
xfire Posted September 27, 2007 Author Share Posted September 27, 2007 Yeah, tried $_SERVER['HTTP_REFERER'] and it doesn't want to work If I do an echo, it echo's the correct page, but after the login all it does is load the login page again. http://www.projectxfire.com/home/login.php Link to comment https://forums.phpfreaks.com/topic/70828-solved-login-page-previous-page/#findComment-356095 Share on other sites More sharing options...
xfire Posted September 27, 2007 Author Share Posted September 27, 2007 use guest for the username and password Link to comment https://forums.phpfreaks.com/topic/70828-solved-login-page-previous-page/#findComment-356102 Share on other sites More sharing options...
teng84 Posted September 27, 2007 Share Posted September 27, 2007 can we see how you redirect Link to comment https://forums.phpfreaks.com/topic/70828-solved-login-page-previous-page/#findComment-356103 Share on other sites More sharing options...
teng84 Posted September 27, 2007 Share Posted September 27, 2007 ohh i see you can put the value of that referrer in a hiddenfield or session so that when you go to that page it contains the last visited page and on submit do something like header('location: yoursession or hidden field') the way your code run is correct but sure that not the way you want it Link to comment https://forums.phpfreaks.com/topic/70828-solved-login-page-previous-page/#findComment-356105 Share on other sites More sharing options...
xfire Posted September 27, 2007 Author Share Posted September 27, 2007 I am currently not using SESSIONS before the person logs in (though I just found a new register/login/etc script I may switch to). How would I go about using the hidden field option? Link to comment https://forums.phpfreaks.com/topic/70828-solved-login-page-previous-page/#findComment-356108 Share on other sites More sharing options...
teng84 Posted September 27, 2007 Share Posted September 27, 2007 <input name="Input" type="hidden" value="<?=$_SERVER['HTTP_REFERER']?>"/> Link to comment https://forums.phpfreaks.com/topic/70828-solved-login-page-previous-page/#findComment-356115 Share on other sites More sharing options...
xfire Posted September 27, 2007 Author Share Posted September 27, 2007 That worked Thanks Link to comment https://forums.phpfreaks.com/topic/70828-solved-login-page-previous-page/#findComment-356195 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.