我工作的登錄功能....如何限制用戶回到以前登錄按註銷後頁
現在我有問題......這樣
1)後用戶按下注銷..
2)如果用戶點擊瀏覽器的後退按鈕..用戶可以看到他/她以前登錄的網頁...
我怎樣才能限制..用戶去退出後退出...
一切工作正常,除了這...幫助我解決這個..
這裏是LoginViewController.php
<?php
session_start();
header("Cache-Control: private, must-revalidate, max-age=0");
header("Pragma: no-cache");
header("Expires: Fri, 4 Jun 2010 12:00:00 GMT");
include('GenericClasses/GenericCollectionClass.php');
include('Models/UsersModel.php');
include('DataObjects/Users.php');
include('DatabaseAccess/DBHandler.php');
if(!empty($_SESSION['user']))
{
header("Location:loggedin.php");
die();
}
else
{
?>
//Html code for LoginIndexpage
<?php
}
?>
這裏的login.php
<?php
session_start();
header("Cache-Control: private, must-revalidate, max-age=0");
header("Pragma: no-cache");
header("Expires: Fri, 4 Jun 2010 12:00:00 GMT");
include('GenericClasses/GenericCollectionClass.php');
include('Models/UsersModel.php');
include('DataObjects/Users.php');
include('DatabaseAccess/DBHandler.php');
if(!isset($_SESSION['user']))
{
header('Location: LoginViewController.php');
exit();
}
echo '<div style="background:white; text-align:right"> Login as:'.$_SESSION['user'].'
<a href="LogoutViewController.php" style="text-align:right">Logout</a></div>';
?>
這裏是註銷。 php
<?php
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
session_start();
session_destroy();
header("Location: LoginViewController.php");
?>
任何建議都可以接受....
會話如何創建會話ID ...我是新來這...會話 –
'$ _SESSION [「USER_ID」] = $ _ POST ['userid']'在這裏會話大括號中的user_id是會話的關鍵字 –
雖然我運行此.....它顯示了一些錯誤,如「頁面沒有正確重定向」 –