Connecting Tech Pros Worldwide Help | Site Map

disable backbutton - when page has expired...

 
LinkBack Thread Tools Search this Thread
  #1  
Old August 22nd, 2007, 07:55 PM
jodleren
Guest
 
Posts: n/a
Default disable backbutton - when page has expired...

Hi!

I have this on the page:
<?php
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


  #2  
Old August 22nd, 2007, 09:25 PM
burgermeister01@gmail.com
Guest
 
Posts: n/a
Default Re: disable backbutton - when page has expired...

On Aug 22, 2:45 pm, jodleren <sonn...@hot.eewrote:
Quote:
Hi!
>
I have this on the page:
<?php
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
}

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.