Having major difficulty with cookies
Posted: Wed Jan 04, 2006 12:13 am
Depending on whether I run my script from domain.com/script.php or http://www.domain.com/script.php , I get two different cookies for each address. The problem is, I may have the ability to create two different cookies, but I only have one way to read the cookies, with the php code:
$cookievalue = $_COOKIE['visitor_']
This particular code only seems to look for domain without the www at the beginning, and so most visitors will not have this cookie unless they come to my site with "domain.com/.. "
I have tried this in IE and firefox and I get the same result. If I visit the page like this domain.com , then I get a user@domain.com cookie only, but when I visit http://www.domain.com I get only a user@www.domain.com cookie.
But $cookievalue = $_COOKIE['visitor_'] will only read the cookie without the www.
Is there some php setting I need to change to fix this? Basically I need to either set a cookie for both domains at once, or be able to read either cookies specifically. Any ideas?
$cookievalue = $_COOKIE['visitor_']
This particular code only seems to look for domain without the www at the beginning, and so most visitors will not have this cookie unless they come to my site with "domain.com/.. "
I have tried this in IE and firefox and I get the same result. If I visit the page like this domain.com , then I get a user@domain.com cookie only, but when I visit http://www.domain.com I get only a user@www.domain.com cookie.
But $cookievalue = $_COOKIE['visitor_'] will only read the cookie without the www.
Is there some php setting I need to change to fix this? Basically I need to either set a cookie for both domains at once, or be able to read either cookies specifically. Any ideas?