Bug #9802 Updated: header() doen't work together with setcookie()
| From: | sander@php.net | Date: | Sun, 11 Nov 2001 17:07:54 +0000 |
| Subject: | Bug #9802 Updated: header() doen't work together with setcookie() | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-70124@lists.php.net to get a copy of this message | ||
ID: 9802
Updated by: sander
Reported By: fabio.ottolini@uol.com.br
Old Status: Open
Status: Feedback
Bug Type: IIS related
Operating System: Windows NT 4.0
PHP Version: 4.0.4pl1
New Comment:
Can you upgrade to the latest version of PHP? Does this problem still exist?
Previous Comments:
------------------------------------------------------------------------
[2001-03-16 22:04:29] fabio.ottolini@uol.com.br
<?php
header("Pragma: no-cache");
header("Cache-Control: no-cache, must-revalidate");
if(empty($check)) {
$page = "index.php?check=1";
header("Location: $page");
setcookie("testcookie", "1");
}
else {
if(empty($testcookie)) {
echo ("<font face=arial size=4 color=red>Problem
detected!</font><br><br>" .
"<b>Your browser does not support cookies!</b><br><br>" .
"<img src=\"imgs/bullet-info-az.gif\" width=15 height=15 align=absmiddle>
" .
"<font size=2>Enable cookies and try again.</font>");
die;
}
else {
$page = "login.php";
header("Location: $page");
}
}
?>
If I use this script with Apache running on any OS (Solaris/RH/Windows 98/ME/NT) it works fine. But
if I use the same script with IIS it simply doesn't send the cookie! I receive no error message
at all but the cookie is never sent (I have even tested it with Nestcape running on the same machine
of IIS server with the warn if cookies are sent checked). The only workaround I have found was to
substitute the header function for a meta-tag refresh. Can you please verify that?
Up the Power Trio!
BR,
Fábio Ottolini
P.S.: I'm only using IIS to host the application because it's a corporate enviroment; I
have no choice at all.
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=9802&edit=1