danm68 Posted August 19, 2009 Report Share Posted August 19, 2009 (edited) Basic rundown:You visit a page that requires you to log in, you get redirected to login.php but the url of the page that redirected you is kept.After a successful login, you get redirected to the page you were trying to view earlier (which you may now see because you are logged in).Just wanted to get people's thoughts and methods on how they might accomplish this. I tried using $_SERVER['REFERER'] but when it redirects to login, the referer was blank and couldn't be used. Got some nice errors. It's like its not taking down the referer because of the header redirect. Does referer only work if the user clicks on a link?Thanks in advance.ps. Is there a problem with the session id being passed around through a cookie? What other methods are there? Edited August 21, 2009 by Reiyan Link to comment Share on other sites More sharing options...
justsomeguy Posted August 19, 2009 Report Share Posted August 19, 2009 The normal way people do that is to append the return URL when you redirect. The referer won't be set, so when you do the redirect you need to tell the login page where to go back to. If you already have a session started you can use that also. Sending the session ID through a cookie is the normal way of doing it, you can see the cookie options here:http://www.php.net/manual/en/function.sess...okie-params.phpThe alternative is to append the session ID to each link so that it gets passed around through $_GET, which would be less secure than using a cookie. Link to comment Share on other sites More sharing options...
danm68 Posted August 20, 2009 Author Report Share Posted August 20, 2009 Thank you very much Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now