im trying to do a simple log in/logout script with PHP.
it's quite simple but apparently IE7 refuses to work well (FF has no problem)
tested on localhost only at the moment.
check for cookie at the beginning of every member-only page
<?php require_once("logchk.php"); ?>
the checking script looks like this
<?php
if(isset($_COOKIE['ck'])) {
$u_id = $_COOKIE['ck'];
setcookie("ck",$u_id,time()+3600);
}
else {
header('Location: index.php');
}
?>
if cookie is NOT set, immediately redirect back to index.php
logout script is liddat
<?php
if(!isset($_COOKIE['ck'])) {
//do nothing.
}
else {
setcookie("ck","",time()-3600);
}
header('Location: index.php');
?>
set time to negative to expire cookie.
problem with IE7 is:
after i logout
i copy the member-only link back into the address bar.
they still can load, telling me my cookie is still there!!
firefox apparently destroys the cookie correctly
only IE7 has this problem. any solution?