Version: 2.0

Type: Sample Code (HOWTO)

Category: HTTP

License: GNU General Public License

Description: Test is the user have Cookies Enable



<?php
function test_cookies_enabled(){
    //Make our test cookie.
    $success = setcookie("Test","Testing cookies");

    //If setcookie was succesful, $success will be TRUE.
    //Otherwise, it will be FALSE.
    //Unset our cookie and return the result.
    setcookie("Test","",time()-60);
    return $success;
}
    /* This is just used to test the function.
    Feel free to remove it and use the function in your
    PHP wherever! */
$cookies = test_cookies_enabled();
if($cookies)
    print "Okay!";
else
    print "Not so Okay.";
?>