Reputation: 1
im in the middle of creating my website and need some help with stopping people from going to a page in my website manually. Basically, i've set up a contact form and once it's filled in, it sends you to a thankyou page. I want to stop people going to that page manually by typing in the url for it. I want them to only be able to access it by filling out the form and hitting 'send'.
Firstly, is this possible, and if so, HOW?!
Thanks in advance!!
Upvotes: 0
Views: 1445
Reputation: 23662
You can insert a special hidden hash value in your form and check for it on the page you redirect to. It's not foolproof though.
Upvotes: 0
Reputation: 10280
Maybe you can check the http method. If it is post, presumably the user used the form. If it is get, presumably they typed the address themselves.
Good luck!
Upvotes: 0
Reputation: 73011
You'll need to use a redirect in combination with some kind of persistent storage (DB, cookie, session).
Essentially on the thank you page, check that they came from the contact form, via persistent storage, otherwise redirect them.
Upvotes: 0
Reputation: 943980
Have the page as the response to the POST and don't redirect to it.
Upvotes: 1