Page 1 of 1

Problems with images setting cookies in a different domain

Posted: Wed Nov 07, 2007 2:48 am
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]