Re: Bulletproof POST remove
| From: | Joe Wollard | Date: | Tue, 12 Apr 2005 05:32:51 +0000 |
| Subject: | Re: Bulletproof POST remove | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-212882@lists.php.net to get a copy of this message | ||
Andy,
I've done this in the past when setting a cookie for a user-defined theme and also for a message board which used the post method. In my case I put all of the logic into a separate page altogether. So you'd have your form on page A, logic in page B and a landing page which can be the same as A. The logic page (B) would perform some validation and then redirect the browser back to page A with either a GET var in the redirected URL indicating failure or success.
basically:
http://127.0.0.1/A.php-[form submission POST]-> http://127.0.0.1/B.php-[HTTP REDIRECT-> http://127.0.0.1/A.php?exit_code=0
I know this is similar to your existing flow, but try it in a separate page. The additional redirect seems to do the trick. Besides, it helps keep logic separate from UI. ;-)
Andy Pieters wrote:
Hi all I noticed some sites are able to remove POST data 100% of the time. Even if the user presses the back button there is no more POST data pressent. I would like to achieve the same thing and currently I use a location header to transfer the user to the same page. Like check post do action header('Location: $thispage'); die(); But then when the user presses the back button they can still retransmit the action. I tried playing with the MUST-REVALIDATE, pragma-nocache header and stuff but it doesn't seem to work. Also I notice that on some sites, when I press the back button, there is a white page that sais "Your session has expired". It should be noticed that I do not use sessions. It should be like POST-once, after that there should be no more remnants of it. With kind regards Andy