...

View Full Version : Clearing _GET and _POST



john6
10-10-2012, 12:02 PM
Hi, I'm making a system which uses _GET and _POST a lot, but I don't want anything to mess up if I or someone else presses 'back' on their browser (or something like that).

Is there a way to 'clear' _GET and _POST only if the user got to the page in a different way?

Fou-Lu
10-10-2012, 03:49 PM
Nope, you can't stop a retransmit for a back button. All that really matters is likely a post though.
You can use tokens for this. Simply create a token when a form is accessed and save it in a session, it can be anything random. When they submit the form, consume the token and respond accordingly. If they hit back and explicitly retransmit the post data, then the token is no longer available to be consumed, so don't react to the input. Since they repost the same data, the token provided by the form will not match if a new token is created or if there is no token to use at all.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum