cache problemette

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

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("Pragma: no-cache");
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

Nel wrote:

Quoted text here. Click to load it

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..

Re: cache problemette

Quoted text here. Click to load it

I usually do a redirect after every post in order to prevent that nasty
resubmission message. Works well in IE. Just do header("Location:
index.php")  or something similiar.

Re: cache problemette

Quoted text here. Click to load it

Thanks Chung!  That is so simple and works very well in IE and Netscape.


Site Timeline