Jump to content

Form Confirmation Page


Spunky

Recommended Posts

So I have a page that the form action sends the user to once they submit the form. This handles everything from sending the form to emails and giving the user a confirmation that it is sent.

 

My question is, how do I stop robots from being able to enter this page or simply typing it in on the url (www.mysite.com/form_confirmation.html for example).

 

A while back I dabbled in something like this when I was messing with creating a login session, if the page was attempted to be entered without the login session being active, it would redirect or error or something.

 

So, I'm pretty sure it would be some sort of header that checks for something right? What might I check for? Just a little unsure how I would handle this.

Link to comment
Share on other sites

The most common way is to make sure that they actually submitted the form to get there. Check for values in $_POST. If $_POST is empty, they didn't submit the form. You can also use the $_SERVER array to make sure the request is actually a post request and not a get request. You could also set a value in the session on the form and then check for it on the processing page, but that's going to break for anyone who sits on the form for too long before submitting it unless you keep the session alive with ajax or something.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...