<?php
function MySetCookie($CkyName, $CkyVal, $exp, $pth, $Domain, $Secure) {
static $mycky;
$exp = strftime("%A, %d-%b-%Y %H:%M:%S", $exp);
$cookiestr = sprintf ("%s=%s; domain=%s; path=%s; expires=%s", $CkyName, $CkyValue, $Domain, $pth, $exp);
$mycky = ( ($mycky) ? "$mycky\n" : "") . "Set-Cookie: $cookiestr";
header($mycky);
}
$status = 0;
if (isset($myTstCky) && ($myTstCky == "ChocChip"))
$status = 1;
if (!isset($CCHK)) {
MySetCookie("myTstCky", "ChocChip");
header("Location: $PHP_SELF?CCHK=1");
exit;
}
?>
<head><title>Cookie Check</title></head>
<body bgcolor="#FFFFFF" text="#000000">
Cookie Check Status:
<?php
printf ('<font color="#%s">%s</font>;',
$status ? "00FF00" : "FF0000",
$status ? "PASSED!" : "FAILED!");
?>
</body>