Hi All,

I want to shared between some website (community) a same cookie to allowed users to login only once.

It means I've to create a cookie for a main domain and each domain have to read it.

I found this code, it allow, in theorie, to create a cookie for another domain of the current domain .. but it doesn't work well :

 
header("P3P: policyref=\"http://www.nomdomaine.com/p3p.xml\",CP=\"NON DSP COR CURa PSA PSD OUR BUS NAV STA\"");
setcookie("moncookie",$valeurducookie, time()+(3600*$nb_heures), "/", "nomdomaine.com",0);
 

p3p.xml :

 
<?xml version="1.0" encoding="UTF-8" ?>
<META xmlns="http://www.w3.org/2000/12/P3Pv1">
<POLICY-REFERENCES>
   <POLICY-REF about="/w3c/policy.xml">
     <INCLUDE>/*</INCLUDE>
     <COOKIE-INCLUDE>* * *</COOKIE-INCLUDE>      
</POLICY-REF> </POLICY-REFERENCES> </META>

I know it is possible to do it. For example : http://www.xiti.com/en/home.aspx
When you visit a website with the xiti tag, it create a cookie for the xiti domain even the website isn't xiti !!!
So, it is possible to do it, but I can't find how to do it ?

If somebody can help me, I'll really appreciate 😉

Thanks al ot

    You cant create a cookie for multiple domains, but you can create third party cookie for each domain:

    php_manual wrote:

    bool [man]setcookie[/man] ( string $name [, string $value [, int $expire [, string $path [, string $domain [, bool $secure [, bool $httponly]]]]]] )
    domain
    The domain that the cookie is available. To make the cookie available on all subdomains of example.com then you'd set it to '.example.com'. The . is not required but makes it compatible with more browsers. Setting it to www.example.com will make the cookie only available in the www subdomain. Refer to tail matching in the &#187; spec for details.

      Write a Reply...