disable backbutton - when page has expired...

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

Threaded View

I have this on the page:
  header("Pragma: no-cache");
  header("Expires: -1");

but I want it so, that when the user goes back, (s)he might not be
allowed too - say the session has expired.

How can i achive that?


Re: disable backbutton - when page has expired...

Quoted text here. Click to load it

Generally what you're describing is something you want to avoid
whenever possible. Breaking the back button is generally bad for
usability and confusing for the user. However, if you feel that it is
entirely necessary to do, probably the best thing you can do, is set a
session variable when the user goes to the first page, and then modify
it on the second page in some way to indicate they've been to that
second page. Have a check on the first page, that looks for the
session variable and does some checks on it to ensure that the user
hasn't visited the second page. Maybe something like this:


if(isset($_SESSION['page_token']) && $_SESSION['page_token']) ==
   //stop script execution, or present user with alternative content

Site Timeline