After logging out, click back in the browser and return to the logon page.

Source: Internet
Author: User
After logging out, click the browser and return to the logon page. There are three interfaces: & nbsp; logon. php & nbsp;/& nbsp; checklogon. php & nbsp;/& nbsp; detail. php & nbsp;/& nbsp; logout. phplogon. php & nbsp;-& nbsp log out, click the browser, and return to the logon page.
There are three interfaces: logon. php/checklogon. php/detail. php/logout. php

Logon. php-session_start () and other static html including form login. click the login button and jump to checklogon. php.

Checklogon. php-connect to the database and return user information. If $ _ SESSION ['user'] = user information is successful, the page jumps 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 in the preceding figure. after clicking it, logout. php.

Logout. php-

 session_destroy();
 header("Cache-Control: private, must-revalidate, no-store");
 header("Pragma: no-cache");
 header("Expires: Sat, 26 Aug 1997 05:00:00 UTC");
 header("location: /logon.php");
 exit();
?>



After you click the logout button, the page is displayed on the logon page, but after you click the back button of the browser (IE 8/Firefox), the previous detail interface is displayed again. How can we solve this problem.

After clicking the back button, the code in detail. php is not executed, and the cached detail. php code is displayed.

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

echo('Logout');
?>

This is?
You do not have any code to verify the existence of a session, even if you have destroyed the session, what is the purpose?
------ Solution --------------------
Modify the PHP login and add the following code.
 Session_start (); // use session to store user information

If (isset ($ _ POST ["username"]) // read username from the database
{
$ Ss_user_id = "";

// Use the User-tired IsValid () method to determine whether the entered User name and password are correct
Require_once ("userclass. php"); // class for retrieving user information
$ User = new User ();
// If correct, go to the homepage of the website
If ($ user-> IsValid ($ _ POST ["username"], $ _ POST ["password"], $ ss_user_id ))
{
$ _ SESSION ["ss_user_id"] = $ ss_user_id; // user ID
Echo" ";
Echo "location = 'index. php ';";
Echo "script";
}
// If not, refresh the page
Else
{
Echo" ";
Echo "alert ('incorrect user name or password ');";

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.