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 ');";