note 913 modified in setcookie by ronabop

From: Date: Sat, 09 Sep 2000 02:52:48 +0000
Subject: note 913 modified in setcookie by ronabop
Groups: php.notes 
Request: Send a blank email to php-notes+get-4585@lists.php.net to get a copy of this message
For a quick and dirty way to test Cookie support in a browser, here is a script that will reload itself and check the status of the cookie. It works for me. Your mileage may vary. <pre> <?php $status = 0; if (isset($myTstCky) && ($myTstCky == "ChocChip")) $status = 1; if (!isset($CCHK)) { setcookie("myTstCky", "ChocChip"); header("Location: $PHP_SELF?CCHK=1"); exit; } ?> <html> <head><title>Cookie Check</title></head> <body bgcolor="#FFFFFF" text="#000000"> Cookie Check Status: <?php printf ('<font color="#%s">%s</font><br>;', $status ? "00FF00" : "FF0000", $status ? "PASSED!" : "FAILED!"); ?> </body> </html> </pre> http://www.php.net/manual/function.setcookie.php

« previous php.notes (#4585) next »