Re: Cookies on WinXP
| From: | Tom Rogers | Date: | Thu, 31 Jul 2003 23:06:53 +0000 |
| Subject: | Re: Cookies on WinXP | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-157840@lists.php.net to get a copy of this message | ||
Hi,
Friday, August 1, 2003, 8:53:51 AM, you wrote:
SB> I still can't figure something out. I am using WinXP/Apache 1.3.24/PHP
SB> 4.2.3 on my laptop and my cookies still don't work like they
SB> should. Hopefully someone can explain to me why.
SB> <?
SB> $cookhost=$_SERVER["HTTP_HOST"];
SB> header("Set-Cookie: aa_host=$cookhost;");
SB> setcookie ("aa_host", "$cookhost",0,"/","$cookhost");
SB> setcookie ("aa_host", "localhost",0,"/","localhost");
SB> setcookie ('aa_host', 'localhost',0,'/','localhost');
?>>
SB> I can set the cookie with the "header" line with no problem, but either one
SB> of the "setcookie" lines will not set the cookie. Has anybody seen
SB> this? Does anybody know why this might be happening? BTW, no, I do not
SB> try to set all of these at once. Just showing the lines that I use. The
SB> "header" line and the first two "setcookie" lines work just fine on a
SB> RedHat 7.3/Apache 1.3.27/PHP 4.2.2 machine.
SB> Thanks
SB> Steve
try setting up a domain on your laptop, add this to the hosts file
127.0.0.1 mylaptop.com
127.0.0.1 www.mylaptop.com
Then use that instead of localhost, maybe it will be better with a
real looking domain.
--
regards,
Tom