Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Sep 2012
    Thanked 0 Times in 0 Posts

    Question Clearing _GET and _POST

    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?

  2. #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Saskatoon, Saskatchewan
    Thanked 2,668 Times in 2,637 Posts
    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.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts