Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6772691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:34:42+00:00 2026-05-26T15:34:42+00:00

i found these questions, where the op has the same problem than me. 1

  • 0

i found these questions, where the op has the same problem than me.

1 2

However, i can’t solve my problem. The user press logout button, then the page is redirected to index.php, but the back button in browser redirects the page to the previous content (protected by login).

After refresh, all works well, the back button stops to work -> the user is redirected to login form.

php file

<?php
header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");    // Date in the past
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header ("Cache-Control: no-cache, must-revalidate");  // HTTP/1.1
header ("Pragma: no-cache");

if(empty($_COOKIE['first_name'])) {
    header("Location:index.php");
    exit();
}

if(isset($_GET['logout'])) {
    setcookie ("first_name", "", time() - 3600);
    unset($_COOKIE);
    header("Location:index.php");
    exit();
}

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html> 
<head>   
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
</head>
<body>

    <a href="?logout">logout</a>

</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T15:34:43+00:00Added an answer on May 26, 2026 at 3:34 pm

    Even though the user can press the back button and see the previous page which was protected by login, doesn’t mean the user is logged in again. They can’t do anything – it is just a static copy of a page they previously viewed.

    It is normal behaviour that the user can press the back button and see previous pages, and sites should not attempt to break this. It is a browser feature.

    In most circumstances, it is safe to allow the back button to operate normally even while a user is logged in. Breaking the back button while a user is logged in would have bad usability consequences for the user. In order to prevent a user returning to a page after logging out, you’d have to make sure all pages they view while logged in cannot be returned to with the back button, which breaks the back button for their entire session.

    There are methods you can use to try and disable the back button for logged in sessions, such as by declaring a page to be uncacheable (and unstorable). These may or may not offer varying degrees of protection against back button use. There are plenty of other questions on stackoverflow about disabling the back button – if you want to ignore advice and try to prevent it, please check it out.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I found these questions, but a couple of them were a little old: https://stackoverflow.com/questions/191556/should-i-pursue-asp-net-webforms-or-asp-net-mvc
I found some questions that looked similar, but not exactly the same so I'll
I know there are already many questions like mine but I found no answer
On the iReport documentation I found these XPath queries: /addressbook/category@name /addressbook/category/person@id /addressbook/category/person+LASTNAME /addressbook/category/person+FIRSTNAME /addressbook/category/person+hobbies*hobby
What is the best implementation of Markdown for C or C++? I found these
While editing an aspx file I found both these opening tags used for seemingly
Since a lot of these sites found on google use mathematical notation and I
First time user here. I am usually capable of finding answers for questions but
I got a bit of a problem. Related to my earlier questions about Slipstreamed
Can any one help me with this problem? As in my last question, I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.