<?php
detour@metalshell.comhttp://www.metalshell.com/
$expire_time = 60;
if($_COOKIE["mycookie"]) {
$cook = unserialize(stripslashes($_COOKIE["mycookie"]));
foreach($cook as $key => $value)
print "$key: $value<br>";
if(time() - $cook["expire"] >= $expire_time) {
print "<h3>Cookie set to expire.</h3>";
setcookie("mycookie", "clearing", time()-60*60*24*7);
}
print "Seconds left: " . ($expire_time - (time() - $cook["expire"])) . "<br>";
} else {
print "Setting cookie.";
$cookieset["fish"] = "trout";
$cookieset["dog"] = "hound";
$cookieset["cat"] = "cheetah";
$cookieset["expire"] = time();
setcookie("mycookie", addslashes(serialize($cookieset)), time()+60*60*24*7);
}
?>