note 93641 deleted from function.setcookie by googleguy
| From: | googleguy@php.net | Date: | Tue, 22 Oct 2013 11:17:02 +0000 |
| Subject: | note 93641 deleted from function.setcookie by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-197071@lists.php.net to get a copy of this message | ||
Note Submitter: jah
----
As <info at daniel-marschall dot de> points out, firefox will prepend a period (full-stop) to
the domain value if the period is not already present.
This is because firefox expects the domain parameter value, if present, to be a domain name and not
a host name.
So using setcookie() with a domain value of www.example.com is not correct if www is a host name.
If you want to restrict the cookie to a single host, supply the domain parameter as an empty string,
for example (note the rightmost parameter):
<?php
setcookie("TestCookie", "SomeValue", time()+3600, "/~rasmus/",
"");
?>