Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- cache problemette
July 15, 2004, 11:28 pm
rate this thread
I am trying to prevent a browser going back to a logon screen and any user
being able to refresh (and the browser re-submits the post data).
I understand that the following should work. It doesn't.
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon,26 Jul 1997 05:00:00 GMT");
Any ideas. And yes I am inserting the code before any output.
DISCLAIMER: There is an extremely small but nonzero chance that,
through a process known as "Tunneling", this e-mail may spontaneously
disappear from its present location and reappear at any random place in the
Universe, including your neighbour's domicile. The sender will not be
responsible for any damages or inconvenience that may result.
Re: cache problemette
There isn't a way to prevent your form from being submitted by the
browser (it's a browser behaviour, it can do whatever it wants). One
thing you can do is set a session cookie, or a session variable
(session_start() adds the headers you've mentioned anyway) once a user
has already submitted the form, a variable is set so the next time it's
submitted it doesn't get processed again.
Those headers you've mentioned means that a browser MUST post data to go
back and view the page (which causes a dialog prompt or a "page expired"
message). Session cookies are the only way I found to get around that,
and still carry data from one page to another without using get/post and
forcing the browser to re-post it's data.
Hope this helps..
- » Problem submitting previously working form on new server
- — Next thread in » PHP Scripting Forum
- » Storing form field names in an array and writing values to a text file
- — Previous thread in » PHP Scripting Forum