RE: [PHP] how to detect the cookie is disabled or enabled?
| From: | Johnson, Kirk | Date: | Mon, 21 Apr 2003 14:13:59 +0000 |
| Subject: | RE: [PHP] how to detect the cookie is disabled or enabled? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-144637@lists.php.net to get a copy of this message | ||
> how to use PHP to detect browser's cookie setting (enabled or
> disabled)
Check if $_COOKIE['PHPSESSID'] is set on the second page request. One way to
do this is to do a header() redirect on the first page back to itself. For
example, if index.php is the first page, then something like this:
if(isset($_GET['redirect')) {
if(isset($_COOKIE['PHPSESSID'])) {
// cookies are enabled
}
else {
// cookies are not enabled
}
}
else {
header('Location: index.php?redirect=true');
}
Kirk