note 14921 deleted from function.setcookie by sniper
| From: | sniper@php.net | Date: | Wed, 11 Dec 2002 07:20:45 +0000 |
| Subject: | note 14921 deleted from function.setcookie by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-40744@lists.php.net to get a copy of this message | ||
MULTIPLE DOMAINS COOKIE
the system assumes that you - of course - have access to all of the domains
not tested in all navigators though (ie5 only)
I did this :
in "page.php" , anywhere there is :
$myvalue = "hello"
<img src=http://www.domain1.fr/imagecookie.php?value=$myvalue
width=1
height=1 border=0>
<img src=http://www.domain2.com/imagecookie.php?value=$myvalue
width=1
height=1 border=0>
<img src=http://www.domain3.net/test/imagecookie.php?value=$myvalue
width=1
height=1 border=0>
etc..
on each of the specified servers, place the imagecookie.php which contains :
<?
setcookie("AAA",$value, time()+432000, "","",0);
header("Content-Type: image/gif");
readfile("imagecookie.gif");
?>
by calling page.php, three cookies will be created, from domain1, domain2,
domain3
now in any page (in specified directories), of the three servers, you can
:
<?
echo $AAA;
?>
It works well and is still secure as you have to have the access to the servers to put the script
that creates the cookie.
Serge
PS Thanks for this great site and users !