note 33285 added to function.setcookie

From: Date: Fri, 20 Jun 2003 19:41:07 +0000
Subject: note 33285 added to function.setcookie
Groups: php.notes 
Request: Send a blank email to php-notes+get-50770@lists.php.net to get a copy of this message
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 ---- Manual Page -- http://www.php.net/manual/en/function.setcookie.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+33285 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+33285&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+33285&report=yes

« previous php.notes (#50770) next »