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!! Quote 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 Quote 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 Quote 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 Quote 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 Quote 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 Quote 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? Quote 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']?>"/> Quote 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 Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.