Page 1 of 1

I've read all "cookie" threads..I write but can't

Posted: Mon May 05, 2003 3:41 am
by 3dron
If I write the cookie like this:
setcookie ("test", "robots")

I can retrieve it fine with:
echo $HTTP_COOKIE_VARS["test"]

If I write a cookie with:
setcookie ("test", "robots", time() + 3600, "/", ".mydomain.com", 1)

I see the file show up in my cookies directory. But when I go to retrieve with:
echo $HTTP_COOKIE_VARS["test"]

I get nothing.

Am I missing something? I've looked everywhere.

RR

Posted: Mon May 05, 2003 3:44 am
by []InTeR[]
Try var_dump($HTTP_COOKIE_VARS);

Tell us what you see.

Posted: Mon May 05, 2003 3:48 am
by twigletmac
Have you done a:

Code: Select all

echo '<pre>';
print_r($HTTP_COOKIE_VARS);
echo '</pre>';
to check if any cookie can be retrieved.

Have you tried putting your full domain instead of '.mydomain.com' - just for testing.

Mac

Posted: Mon May 05, 2003 11:56 am
by 3dron
I dumped and no it wasn't there? Only variables from the bulletin board I use came up.

I then tried adding the "www". No luck either.

I see in the cookie text file my variables are there along with the BB variables that do show up.

Why are my variables not showing up with the dump?

Help

RR

Posted: Mon May 05, 2003 7:02 pm
by Sevengraff
you turned on secure, are you using https?

Posted: Mon May 05, 2003 7:06 pm
by 3dron
no I haven't purposely turned on scure. No I'm not using https. Whay are the other variables in same text file reading fine?

RR

Re: I've read all "cookie" threads..I write but ca

Posted: Mon May 05, 2003 7:11 pm
by Sevengraff
3dron wrote:If I write a cookie with:
setcookie ("test", "robots", time() + 3600, "/", ".mydomain.com", 1)

I see the file show up in my cookies directory. But when I go to retrieve with:
echo $HTTP_COOKIE_VARS["test"]
the 1 at the end there means secure is on. should be

setcookie ("test", "robots", time() + 3600, "/", ".mydomain.com", 0)

if you don't want secure on.

Posted: Mon May 05, 2003 10:25 pm
by 3dron
Right on!!! Thanks!!!

RonR