Zend - The PHP Company




Cookies

Add Code


Detecting if cookies are on  

Type: code fragment
Added by: ADMIN
Entered: 16/01/2000
Last modified: 08/12/1999
Rating: *** (37 votes)
Views: 17973
This code will allow to detect if user has cookies support for cookies turned on.


<?
if ($MODE!=="test") {
        
SetCookie("COOKIE""VALUE");
        
Header("Location: ".$SCRIPT_NAME."?MODE=test");
        exit;
} else if (
$COOKIE=="VALUE") {
        echo 
"You've got cookies!";
} else {
        echo 
"Turn on cookies, Mr. Paranoid.";
}
?>


Usage Example




Rate This Script





Search



This Category All Categories