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;