disable backbutton - when page has expired...
am 22.08.2007 21:45:21 von jodleren
Hi!
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?
BR
Sonnich
Re: disable backbutton - when page has expired...
am 22.08.2007 23:20:44 von burgermeister01
On Aug 22, 2:45 pm, jodleren wrote:
> Hi!
>
> 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?
>
> BR
> Sonnich
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:
//page1.php
if(isset($_SESSION['page_token']) && $_SESSION['page_token']) ==
"beentosecondpage"){
//stop script execution, or present user with alternative content
}