Page 1 of 1

Log Out Script

Posted: Thu Jan 29, 2009 11:05 pm
by Brad7928
I have a log in script that set's a cookie, each page they visit looks for this cookie, if they don't have it, they are directed to the log in screen. When user's log out it runs the script below to delete the cookie, which works fine.

Code: Select all

<?php 
$past = time() - 200; 
//this makes the time in the past to destroy the cookie 
setcookie(ID_my_site, gone, $past); 
setcookie(Key_my_site, gone, $past); 
header("Location: /gaming/index2.php"); 
?>
Problem is that the pages they have visited can still be seen if they haven't closed there browser because it stores them in temp internet files. Is there a way to delete it from temp internet files, or make it get an updated version of the page each time they try to access it?

I think i've seen it done before in the header, it sets a time on how long the page is valid for or something?

Re: Log Out Script

Posted: Thu Jan 29, 2009 11:07 pm
by nor0101
Yeah, put these before you do any output to the page.

Code: Select all

 
    header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
    header("Expires: Mon, 23 Jun 1986 12:00:00 GMT"); // This date is in the past.
    header("Pragma: no-cache");
 

Re: Log Out Script

Posted: Thu Jan 29, 2009 11:11 pm
by Brad7928
nor0101 wrote:Yeah, put these before you do any output to the page.

Code: Select all

 
    header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
    header("Expires: Mon, 23 Jun 1986 12:00:00 GMT"); // This date is in the past.
    header("Pragma: no-cache");
 
Worked a treat, your a genius lol.

Cheers buddy!