Page 1 of 1

coockie notify?

Posted: Sun Dec 07, 2003 9:05 am
by thomasd1
how can i notify a visitor on my site, that he must enable his browser to accept coockies?

Posted: Sun Dec 07, 2003 9:14 am
by Gen-ik
You will need to set a temp cookie and see if it exists on the next page load/refresh.

On the first page you might have..

Code: Select all

<?php
setcookie("tempName","aValue", strtotime("+1 hour", time()));
?>
On the second page you might have..

Code: Select all

<?php

if(isset($_COOKIE["tempName"]))
{
     echo "Cookies are enabled.";
     setcookie("tempName", "", strtotime("-1 hour", time())); // deletes the temp cookie
}
else
{
     echo "Cookies are disabled. TURN THEM ON!";
}

?>