me102 Posted January 17, 2008 Share Posted January 17, 2008 I have a signup form located at http://domain.com/signup/index.php now when I go to http://domain.com/ the cookie no longer works can you tell me how to make it work? Link to comment https://forums.phpfreaks.com/topic/86561-solved-cookies/ Share on other sites More sharing options...
p2grace Posted January 18, 2008 Share Posted January 18, 2008 In order for cookies to work across a domain, the cookie needs to be set in the outer most folder. Example: If you set a cookie in domain.com/folder1 and tried accessing it at domain.com it wouldn't work. But if you set the cookie at domain.com and tried accessing it at domain.com/folder1 it would work. Cookies can be accessed in a folder and subfolders, but parent folders cannot access cookies set inside a subfolder. I hope that helps Link to comment https://forums.phpfreaks.com/topic/86561-solved-cookies/#findComment-442295 Share on other sites More sharing options...
me102 Posted January 18, 2008 Author Share Posted January 18, 2008 I set the cookies this way setcookie("TestCookie", $value, time()+3600, "", "example.com", 1); and it did not work. Yes I changed the example.com Link to comment https://forums.phpfreaks.com/topic/86561-solved-cookies/#findComment-442309 Share on other sites More sharing options...
Nhoj Posted January 18, 2008 Share Posted January 18, 2008 Try this: setcookie('TestCookie', $value, (time() + 3600), '/', false, 0); Link to comment https://forums.phpfreaks.com/topic/86561-solved-cookies/#findComment-442310 Share on other sites More sharing options...
me102 Posted January 18, 2008 Author Share Posted January 18, 2008 Try this: setcookie('TestCookie', $value, (time() + 3600), '/', false, 0); Thank you. Link to comment https://forums.phpfreaks.com/topic/86561-solved-cookies/#findComment-442316 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.