Setting cookie very broken! Please help!
| From: | Casey Allen Shobe | Date: | Tue, 15 Jan 2002 15:15:17 +0000 |
| Subject: | Setting cookie very broken! Please help! | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-80565@lists.php.net to get a copy of this message | ||
I've set up a new machine in a production environment to roll over an
existing PHP script onto. Unfortunately, I'm running into a strange error:
I have a login form, using fields named 'username' and 'password'. These are
also used as variables. Using IE, the cookie never shows up as I would
expect it to in the cookies directory. Additionally, I can't login as the
variables are returned as null values to the script.
Even stranger...I made a test.php that just echoes $username. I call it with
?username=test, and it works. Then I try the script that sets cookies, and
it doesn't work. Then I go back to the same test.php request, and it doesn't
show the value I passed to it (though it will show ones of other names that I
didn't try to set in a cookie)!
I know the code is valid, as it's working fine on 2 other production machines.
I had PHP compiled into Apache, and just rebuilt both using APXS...same
results.
This is the code that I'm passing $username to, that totally screws things
up, but works on other machines:
if ($username != null) {
$time = mktime()+3600;
$date = gmdate("D, d-M-Y H:i:s", ($time));
header ('Set-Cookie: username='.$username.'; expires='.$date.' GMT;
path=/;
domain='.$SERVER_ADDR);
}
Restarting IE makes the test.php page work again...nothing else. Please, if
anybody could assist or ask me for any other information required to
diagnose, I would be very thankful. I need to get this working ASAP, and
have been fighting it to no avail for the past few hours.
--
Casey Allen Shobe
cshobe@softhome.net
'Why do people with closed minds always open their mouths?'