php - Cookie not recognised on subdomain -
i have domain , subdomain need both recognise cookie set main domain. on www.mydomain.com set cookie javascript so:
var d = new date(); d.setdate(d.getdate() + 30); var c = "all; expires=" + d.toutcstring() + "; path=/;domain=mydomain.com"; document.cookie = "cookies=" + c;
in php utilize simple if (isset($_cookie['cookies'])) ...
works on www.mydomain.com doesn't work on sub.mydomain.com.
any suggestions? have phone call cookie within php differently?
var d = new date(); d.setdate(d.getdate() + 30); var c = "all; expires=" + d.toutcstring() + "; path=/;domain=.mydomain.com"; document.cookie = "cookies=" + c;
php javascript cookies
No comments:
Post a Comment