I have a website running in PHP and I have a page (say confirm.php)
And I only want to allow the users who land to confirm.php comes from a page that I specified (e.g. say register.php), may I know is it possible to achieve this?
Regards,
Andy.
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.
You can not rely on the HTTP REFERER because users can manipulate it and browsers can refuse to send it.
The only “secure” way would be to set a session variable on register.php and check if that variable is set on confirm.php. Something like this:
register.php:
confirm.php:
However, this will not take into account if the latest page was register.php, BUT that the user have been on register.php.
Because HTTP is stateless, you need to keep track of this at the server level. If you don’t have a authenticated user for which you can track all pageviews, this is going to be very hard to implement. How secure do you really need it to be?