jwk811 Posted June 4, 2010 Share Posted June 4, 2010 this wont work. i think the only problem is the way i have the cookie being set at the end with the $domain. it works when i just write. ".domain.com" but i want to get the url in a variable. $myurl = "http://www.domain.com"; $raw_url = parse_url($myurl); $domain_only =str_replace ('www.','', $raw_url); $domain = $domain_only['host']; $expire=time()+60*60*24*30*12; setcookie("user", "$userName", $expire, "/", "." . $domain); $expire=time()+60*60*24*30*12; setcookie("pass", "$password", $expire, "/", "." . $domain); Quote Link to comment https://forums.phpfreaks.com/topic/203905-setting-cookie-with-variable-url/ Share on other sites More sharing options...
dabaR Posted June 4, 2010 Share Posted June 4, 2010 Did you try printing out $domain so that you can see whether its contents are .domain.com? It appears you end up with domain.com, I am not sure whether that would be your problem. Quote Link to comment https://forums.phpfreaks.com/topic/203905-setting-cookie-with-variable-url/#findComment-1067960 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.