
- You are not logged in. | Login
November 17, 2006 12:41 am
- mellis
- Member


session cookie doesn't work!
I'm new here so first I'll say hello.
Hello!
Now, I've got trouble with a cookie on my page that gets setup when my user logs into my site. The cookie only works in my /login/ directory and not everywhere on my website.
I set up my cookie using this:
setcookie("username2", $username);
And I looked in the php manual and it says i need to specify the directory and domain, so i tried
setcookie("username2", $username, '/', 'mywebsite.com');
but that isn't working at all now.
Can someone give me the right code to use to make the cookie work on my whole website?
December 6, 2006 3:17 pm
- senjor_itc
- Member


Re: session cookie doesn't work!
Hi, Try to use the following:
setcookie("username2", $username, 360000000, '/', 'mywebsite.com');
where 360000000 is expiration time for this cookie in seconds.
Thanks


