Click to See Complete Forum and Search --> : two problems with cookie set


mitya
05-28-2004, 07:24 PM
Hi all, I'm getting some weird problems settings cookies via my local server (testing server) on my machine. It's the PHP build from apachefriends.de

First of all, the cookies never ever appear in the cookies folder where all the other cookies go. It simply doesn't turn up, yet it is evidently there because the php scripts can find it.

Secondly, and this is a new one, they only seem to exist so long as the browser window is open. I thought it was only session vars that died when browsers were closed... this cookie has an expiry value of 999999999999 so it should stay for a long time.

Any ideas on this? Thanks in advance.

Paul Jr
05-28-2004, 07:40 PM
Can you show us the code you have?

96turnerri
05-29-2004, 10:06 AM
if you set a cookie using

setcookie("COOKIENAME", "COOKIEVALUE", time()+31536000);

and read by

echo $_COOKIE["COOKIENAME"];

you should have no trouble with the cookie, and it should be in cookie folder, what browser and os are you using also can you post some code

Rich

mitya
05-30-2004, 10:28 AM
Thanks for that guys. I wasn't aware you had to express the expiry as an expression, I thought a literal numerical value would suffice. Got it sussed now though :o)

96turnerri
05-30-2004, 10:51 AM
yes if you dont use a value for expiry cookie will be deleted when browser exits

if you do must add number to the current time eg. time()+S where S=seconds

Rich