Hello all,
I must be looking over something very obvious here because the following never works (I tried with PHP versions 4.3.0-dev, 4.2.1, 4.1.2, 4.0.6 all installed as CGI on an IIS 4.0 on an NT4 WS SP6a):
<?
$status = 0;
if (isset($cktest) && ($cktest == "tralala")) {$status = 1;}
if (!isset($CCHK)) {
setcookie('cktest','tralala',(time()+2592000),'/','',0);
/ Comment/Uncomment following line to reproduce bug /
//exit;
header("Location: ".$PHP_SELF."?CCHK=1");
exit;
}
?>
<head>
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta HTTP-EQUIV="Expires" CONTENT="Mon, 01 Jan 1996 23:59:59 GMT">
<title>Cookie Check</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
Cookie Check Status:
<?
printf ('<font color="#%s">%s</font>',
$status ? "00FF00" : "FF0000",
$status ? "PASSED!" : "FAILED!");
?>
</body>
This always returns me FAILED unless I uncomment the "exit;" right after the "setcookie" instruction.
FYI, I have the following settings in my php.ini:
- register_globals = On
- output_buffering = Off
Could anyone tell me what's wrong here ?
Thx,
Steven