Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Prevent direct access

Status
Not open for further replies.
Jul 17, 2003
155
US
Hi,

A visitor visits page a.html. When he clicks on a submit button, he is directed to page b.html. How can I prevent the visitor from accessing page b.html directly without first going to page a.html?

Illustration:

a.html --> b.html (OK)
going to b.html directly without first going through a.html is not allowed.
 
1. You can use session variables in your scripting environment (ASP, PHP, etc). If the visitor goes to a.html, set a session variable to True. When page b.html is called, check the session variable, if it is False, redirect the user back to a.html.

2. On page b.html, check that the page is called with HTTP POST, if not redirect them to a.html.

Hope this helps.
 
or check the referer page first if it isn't a.html redirect them.


thereptilian120x120.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top