Log off and click on the browser back to the landing after the interface

Source: Internet
Author: User
After logging off, click the browser back and back to the login interface
There are three interface logon.php/checklogon.php/detail.php/logout.php

Logon.php-session_start () and other static HTML including landing form, click on the button to jump to checklogon.php.

checklogon.php-Connect to the database and return user information. If successful $_session[' user ' = information about the users, and jump to detail.php.

$user = Userbusiness::getuser ($_post["username"], $_post["password"]);
if ($user = = null)
{
Header ("Location:/index.php");
Exit
}
$_session[' user '] = $user;



detail.php-A logout link is included above, and logout.php is called when clicked.

Logout.php-

Session_destroy ();
Header ("Cache-control:private, Must-revalidate, No-store");
Header ("Pragma:no-cache");
Header ("Expires:sat, 1997 05:00:00 UTC");
Header ("Location:/logon.php");
Exit ();
?>



When clicked on the Logout button, the page to the landing screen, but click the browser Back button (IE 8/firefox), the previous detail interface is displayed. How can we solve this problem?

When the Back button is clicked, the code inside the detail.php is not executed, and the cached detail.php should be displayed.

Share to:


------Solution--------------------
Reference:

Echo (' Logout ');
?>

This is it?
There's no code inside you to verify that the session exists, even if you destroy the session.
------Solution--------------------
To modify the login PHP, add the following code.
!--? php
session_start ();//use session to store user information

if (isset ($_post["username"))/ /database read username user name
{
$ss _user_id= "";

//Use the user-tired IsValid () method to determine if the username and password entered are correct
require_once ("userclass.php"); The class that gets the user information
$user =new User ();
If correct, go to the site home page
if ($user->isvalid ($_post["username"],$_post["password"], $ss _user_id))
{
$_session[ ss_user_id "]= $ss _user_id; User ID
echo "";
}
//If it is not correct, refresh the page
else
{
echo "echo "alert (' Username or password error ');";
  • & #xe63a;
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.