CodeIgniter Forums
Login and logout session and cache - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Login and logout session and cache (/showthread.php?tid=33228)



Login and logout session and cache - El Forum - 08-19-2010

[eluser]minerbog[/eluser]
I know this isn't really about CI but its a problem I have come apon today and believe it or not google doesn't have the answer OMG!!

Anyway, when I log out of my app, I kill the session data and the session and redirect to the login page. When you hit the back button a cached version of the page is shown (I'm using FF3.6.8). I've tried all the google answers about
Code:
<meta http-equiv="PRAGMA" content="NO-CACHE">
<meta http-equiv="Expires" content="-1">
<meta http-equiv="CACHE-CONTROL" content="NO-CACHE">

header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' );
header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' );
header( 'Cache-Control: no-cache, must-revalidate, max-age=0' );
header( 'Pragma: no-cache' );
etc etc, but nothing seems to work.

However, google have managed to do it? :roll: Anyone know how this is done??

Thanks
Gav.


Login and logout session and cache - El Forum - 08-19-2010

[eluser]mi6crazyheart[/eluser]
I also want to know little bit more about this. Guys, plz show some light if any body have some clear cut idea about this...


Login and logout session and cache - El Forum - 08-19-2010

[eluser]WanWizard[/eluser]
For pages that I don't want cached, all I do is
Code:
// make sure the page isn't cached
header("Cache-Control: no-cache, no-store, must-revalidate");
header("Pragma: no-cache");

and that seems to work...


Login and logout session and cache - El Forum - 08-19-2010

[eluser]mi6crazyheart[/eluser]
Wow!!! this piece of code is really working well. Thx WinWizard...


Login and logout session and cache - El Forum - 08-20-2010

[eluser]minerbog[/eluser]
[quote author="WanWizard" date="1282258213"]For pages that I don't want cached, all I do is
Code:
// make sure the page isn't cached
header("Cache-Control: no-cache, no-store, must-revalidate");
header("Pragma: no-cache");

and that seems to work...[/quote]

Cheers WanWizard, this works a treat :cheese: . But still, I'm one of those really annoying people that is just not satisfied that it works, and want to know why it works!!! Sorry! Confusedmirk:

Whats the difference from my code except the no store addition? What does that do?

Code:
header( 'Cache-Control: no-cache, must-revalidate, max-age=0' );
header( 'Pragma: no-cache' );



Login and logout session and cache - El Forum - 08-20-2010

[eluser]WanWizard[/eluser]
See http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.2