PHPBuilder - Test Cookies Enable



RSS Twitter
Snippets Http

Test Cookies Enable

by: Micah
|
May 12, 2005

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.";
?>

Comment and Contribute

Your comment has been submitted and is pending approval.

Author:
Micah

Comment:



Comment:

(Maximum characters: 1200). You have characters left.