开发者

can't send cache limit cheaker and problem in back button session variable still displaying after logout and if i prees back button

HI everyone

1. As user enter username and password in sign-in-form.php then values are collected in sign-in-action-form.php page and the i am storing username into session variable like this In database i have a table named employee

<a href="logout_file.php">Sign Out</a>
if (username and passwords are matched)
{
session_start();
$_SESSION['employee']['id'] = $row['User_Id'];
$_SESSION['employee']['username'] =$row['Username'];
}
then on each page i am passing logout-file.php link and checking session variable like this

<body bgcolor="white">
<a href="logout_file.php">Sign Out</a>
<?php
session_start();
if(!isset($_SESSION['employee']))
{
echo "Your are Logged Out";
exit;
}
else
{
echo "Welcome Mr.".$_SESSION['employee']['username']; //check it
}
?>
Body data like other links
</body>

Now on each pa开发者_如何学Pythonge i have given links like this

Now listen my problem on each page i am printing echo "Welcome Mr.".$_SESSION['employee']['username']; So think i am on signinactionpage where there other link like show file,upload file etc.. with sign out button now as i click on sign out button i am redirected to login page(no probelm up to here) But when i press back button (now i am logeed out) then i am again in signinaction form and Mr.Deepak.Narwal is still displaying there why so if i am looed out session destroyed and why this name is displaying..why so

2. along with this one more error is displaying on each page which contain logout button and this session coading...

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at E:\xampp\htdocs\upload_file.php:6) in E:\xampp\htdocs\upload_file.php on line 7

My logout-file.php page is like this
<?php
session_start();
session_unset();
session_destroy();
header ("Location: signinform.php");
?>


The session_start() method should be called at the begin of the file. Try to put it as the first operation that you do in the logout.


By default, in both MSIE and Firefox, pressing the back button takes the user to a cached page even if the server explicitly instructed the browser not to cache the contents.

There are limits to this (but note that when you close some browsers with open tabs, then when it resumes at the same page, it may again use local copies of non0-cacheable content).

To avoid this, then you could imlpement any page where authentication details are submitted as post-redirect-get and also disable form field caching by the browser using autocomplete="off"

C.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜