SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Jul 2002
    0 Post(s)
    0 Thread(s)

    Question page history question

    I have two php pages, index.php and securepage.php. The index.php has a link to securepage.php. The securepage.php forces a login by generating a login page and re-calls itself on failed login attempts. After the 3rd failed attempt it returns you to index.php. On a successful login you get to see the secured page content.

    Once you get past the login and see the secured pages content if you hit the 'back' arrow on the browser you get the login again from the history of pages. I would like to be returned to the index.php page when I hit the 'back' arrow.

    Any ideas on how I might do this?

    Thanks in advance for any useful assistance.

  2. #2
    SitePoint Zealot cmorbutts's Avatar
    Join Date
    Apr 2002
    Sydney, Australia
    0 Post(s)
    0 Thread(s)
    Try to instruct the browser not to cache the page.

    Add this to securepage.php, before your <html> tag.

    PHP Code:
    // The page expires in the past
    header ("Expires: Tue, 01 Jan 1980 00:00:00 GMT");
    // The page was last modified now
    header ("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
    // prevents browser caching (HTTP 1.1)
    header ("Cache-Control: no-cache, must revalidate");
    // Prevents browser caching (HTTP 1.0)
    header ("Pragma: no-cache"); 
    Of course you will need some code to check if the user has been logged in as well.

    Let us know how you go.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts