Reputation: 1771
This cookie is not available to www.domain.com
but is available to domain.com. Strange thing is that firefox sees the cookie in www.domain.com
(Using the view info but my server does not recognize the cookie). I have done a decent amount of searching and the only solution I found was to set the domain to .domain.com
but then my cookies can not be read at domain.com
. Here is my code:
//this results in no access through domain.com
setcookie('username', $username, time()+3600*24, '/', '.domain.com');
//this results in domain.com access but not www.domain.com
setcookie('username', $username, time()+3600*24, '/');
What is the key to getting the cookie to be available to domain.com and all subdomains?
Upvotes: 1
Views: 554
Reputation:
Try it:
setcookie('username', $username, time()+3600*24, '/', 'domain.com');
Upvotes: 2