On Jul 31, 2003, "Steve Buehler" claimed that:

|I still can't figure something out.  I am using WinXP/Apache 1.3.24/PHP
|4.2.3 on my laptop and my cookies still don't work like they
|should.  Hopefully someone can explain to me why.
|<?
|$cookhost=$_SERVER["HTTP_HOST"];
|header("Set-Cookie: aa_host=$cookhost;");
|setcookie ("aa_host", "$cookhost",0,"/","$cookhost");
|setcookie ("aa_host", "localhost",0,"/","localhost");
|setcookie ('aa_host', 'localhost',0,'/','localhost');
|?>
|
|I can set the cookie with the "header" line with no problem, but either one
|of the "setcookie" lines will not set the cookie.  Has anybody seen
|this?  Does anybody know why this might be happening?  BTW, no, I do not
|try to set all of these at once.  Just showing the lines that I use.  The
|"header" line and the first two "setcookie" lines work just fine on a
|RedHat 7.3/Apache 1.3.27/PHP 4.2.2 machine.
|
|Thanks
|Steve

1st, what is the difference between what you are expecting and what you
are getting?

2nd, you do realize that since you're setting the cookies to have an
expiration of 0, that will delete the cookies when the brower is closed.

3rd, you know that you can't pick up the cookies in the same page where
they are set.

try letting some defaults persist to track downm errors:
setcookie ("aa_host", $cookhost,time()+3600);

Jeff
-- 
Registered Linux user #304026.
"lynx -source http://jharris.rallycentral.us/jharris.asc | gpg --import"
Key fingerprint = 52FC 20BD 025A 8C13 5FC6  68C6 9CF9 46C2 B089 0FED
Responses to this message should conform to RFC 1855.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to