Jump to content

setting cookie with variable url


jwk811

Recommended Posts

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);

Link to comment
https://forums.phpfreaks.com/topic/203905-setting-cookie-with-variable-url/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.