Problems with images setting cookies in a different domain

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
guarriman
Forum Commoner
Posts: 44
Joined: Thu Nov 03, 2005 4:11 am

Problems with images setting cookies in a different domain

Post by guarriman »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hi.

I want to set two cookies to user's web-browser in foo2.com but when user visits foo1.com. Very similiar to the system used by web statistics.

I use (within 'http://www.foo1.com/page.html'):
------
<img src="http://www.foo2.com/image.php" />
------

And 'www.foo2.com/image.php' sets the two cookies.

It works ok on Firefox on Linux, but doesn't work with Firefox on MS Windows and IExplorer. Any similar experience? Thank you very much. 

Code I use within 'www.foo2.com/image.php':

Code: Select all

if (!session_is_registered("user_email")) session_register("user_email");
if (!session_is_registered("user_pass")) session_register("user_pass");
$_SESSION['user_email'] = $email;
$_SESSION['user_pass'] = $hashedpw;
setcookie( 'email_cookie_stored', $email, time() + 31536000, "/");
setcookie( 'pass_cookie_stored', $hashedpw, time() + 31536000, "/");

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Post Reply