While toying around I discovered a work-around to the problem of not being able to check if cookies are enabled untill a page reload is done. This method is almost completely hidden from the user. Let me know what you think =)
Code:
<?php
/**
*First set your cookie.
*/
$value = "Cookie Check";
setcookie ('cookie', $value, 86400, '/', '.yourdomain.com', 0);
if(isset($_COOKIE['cookie']))
{
/**
*If the cookie is there, do something with the value
*/
$PHPSESSID = $_COOKIE['cookie'];
}
elseif($_GET['set'] != 'yes')
{
/**
*If set does not = 'yes' redirect them to the same script
*where it will = 'yes'!
*/
header ("Location: _test1.php?set=yes");
}
else
{
/**
*The cookie is not set, the redirect done,
*and they do not have cookies. Tell them to enable them!
*/
header ("Location: index.html");
}
?>