instead of
login.php?ref=http://mysite.com/lastpage
could I get the before page somehow else? tried HTTP_REFERER but cant get it to work
Notice: Undefined index: HTTP_REFERER in C:\test\login.php on line 18
// Newbie
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The HTTP_REFERER is not always set, that’s why you’re getting the notice. The browser may opt not to send it or the user may have entered the URL directly into his browser. You can put that value into the session, which has other drawbacks (multiple tabs in the browser have the same referrer page, for example.) I think the url is still the best way to go, if you don’t have a form, which you can append a hidden field to.
EDIT By the way: don’t use the URL in the get parameter blindly, that can be faked again by others as explained in the answers to this other question.