Hello guys, I'm trying to set a user authentication cookie and im getting some odd errors.
basically this is my command for setting the cookies: setcookie("auth", "1", 0, "/", "domain.com", 0);
and when i store that in a variable it returns true. Hoewver, in $_COOKIE['auth'] the cookie is never set. and when i go to view cookies in my browser it doesn't show up. Help?
Help with weird setcookie() behavior
Moderator: General Moderators
-
jchonphoenix
- Forum Newbie
- Posts: 2
- Joined: Sun Aug 24, 2008 9:40 pm
Re: Help with weird setcookie() behavior
It's very strange.
Try this code:
Necessarily reload page in browser.
Try this code:
Code: Select all
<?php
setcookie("auth", "1");
print_r($_COOKIE);
?>-
jchonphoenix
- Forum Newbie
- Posts: 2
- Joined: Sun Aug 24, 2008 9:40 pm
Re: Help with weird setcookie() behavior
setcookie("auth", "1");
worked. Thanks. However, Can anyone give an explanation for why this is? thanks
worked. Thanks. However, Can anyone give an explanation for why this is? thanks
Re: Help with weird setcookie() behavior
Read set_cookie()jchonphoenix wrote:setcookie("auth", "1");
worked. Thanks. However, Can anyone give an explanation for why this is? thanks
I think you not correct use parameters path and domain.