note 33285 deleted from function.setcookie by tularis
| From: | tularis@php.net | Date: | Sun, 02 Jan 2005 14:26:30 +0000 |
| Subject: | note 33285 deleted from function.setcookie by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-82594@lists.php.net to get a copy of this message | ||
Note Submitter: winfield at support dot email dot ne dot jp
----
This is a revised edition of a way determining if user's browser can handle cookie.
Call this function at the begining of your global routine.
function cooktest() {
// Most of all, if certain variable your script USUALLY get is NOT given ('mode' for
exapmple)
if(!isset($_GET['mode'])) {
setcookie("check_cookie", "on", time()+3600);
// If 'cooktest' (a var ONLY for this function) is not given (means First Time)
if (!isset($_GET['cooktest'])) {
Header("Location: $_SERVER[PHP_SELF]?cooktest=1");
exit;
}
// If sctipt can NOT read COOKIE after reloaded
elseif (!isset($_COOKIE['check_cookie'])) {
print <<<EOM
<html>
<body>
Sorry. You should set COOKIE enabled.
</body>
</html>
EOM;
exit;
}
}}
Thank you ,Kayvan.
Best Regards,
Tats