A basic script testing the user's browser to see if cookies are enabled. There are 2 steps invloved in this process; firstly php reads the cookie data to see if there is already any data saved in them. If not; upon attepting to store some test data, the script refreshes the page. If no result has been returned; it is an obiovus indication that cookies are disabled.

if (isset($_COOKIE['stuff'])) {
echo "cookies enabled";
}

else {

if(isset($_REQUEST['test_cookies'])) {
echo "cookies disabled";
}

else {
setcookie("stuff", "1", 0, "/");
header("Location: $_SERVER['PHP_SELF']?test_cookies=1");
}

}

Tagged: cookies