Try to calculate the time before setting it in the cookie. Create two scripts in the same dir, one that sets cookie, one that unsets it:
## Set cookie ##
if (!isset($_COOKIE['terre'])) {
$rostat = "nej";
$cTime = time()+(3600*1000);
setcookie("terre", $rostat, $cTime);
header("Location:".$PHP_SELF."");
}
else {
echo "Cookie is already set. \n<br>\n";
echo "The cookie's value is: ".$_COOKIE['terre'];
}
and
## Unset cookie ##
if (isset($_COOKIE['terre'])) {
$rostat = "";
$cTime = time()-(3600*1000);
setcookie("terre", $rostat, $cTime);
header("Location:".$PHP_SELF."");
}
else {
echo "The cookie is now unset";
echo "The cookie's value is: ".$_COOKIE['terre'];
}
Then access the scripts and try out. The header-statement will refresh the page once, and this is needed to see the cookie value displayed/removed.
knutm