[thelist] Setting cookies w/ PHP

Alan McCoy a.r.mccoy at larc.nasa.gov
Wed Oct 18 06:23:47 CDT 2000


> >    <?php
> >        setcookie ("mycookie", "cookie_value", 600, "/", ".mydomain.com",
> > "0");
> >        echo "<html><head><meta http-equiv=\"Refresh\"
> > content=\"0;url=http://www.mydomain.com\"></head></html>";
> >    ?>
>
> Have you tried making the domain just "mydomain.com"? I seem to
> remember an
> issue a while back when someone was making the domain www.mydomain.com and
> couldn't read it from mydomain.com (without the www.). The solution was to
> take the www. from the domain of the cookie. Could that begininning dot be
> screwing things up?

I had originally tried it like that. Then I read in Netscape's cookie specs
that it's better to use the "." before the "mydomain.com". That would not
only allow www.mydomain.com and mydomain.com, but also
whatever.mydomain.com.

The notes under the setcookie() docs in the PHP online manual appear to have
some browser issue debugging info. Taking a look-see now...

Alan





More information about the thelist mailing list