Reputation: 562
In my application has three web pages. 1.) login page. 2.) welcome page 3.) logout page
I have managed the session using PHP session object. In my application log-In and log-Out functionality is working properly.
Here problem is that: After successful logout when user click on browser back button from logout.php page, again he reach to welcome.php page Whereas he log-Out successfully. But I want to there page has been expired or should not to come back welcome.php page.
Thanks in advance.
Upvotes: 1
Views: 1037
Reputation: 5001
If you use CakePHP 2, you can also just do
$this->response->disableCache();
that basically does the same thing than the answer given by Repox
Upvotes: 0
Reputation: 99
Why dont you check the authentication on ur welcome page.
Example:
if($_SESSION['authenticated'] = true)
include('welcome.php')
else
include('login.php)
Another better application will be to redirect using Headers.
header('Location: ' (LINK) );
Upvotes: 0
Reputation: 15476
This is actually a bit tricky, but (as far as I'm aware) this has something to do with cache.
I managed to avoid this particular problem by adding some headers through PHP:
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
header("Pragma: no-cache");
These should of course only be set when the user is logged in, as caching should be considered a good thing normally.
Upvotes: 3
Reputation: 106
you need to force it to refresh the page and not laod it from cache.
plus diffrent browsers handle this diffrently. try adding a second section to your doc on the browse page
<HEAD>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
</HEAD>
Upvotes: 0