You are here: Re: domain cookie problem... « PHP Programming Language « IT news, forums, messages
Re: domain cookie problem...

Posted by Erwin Moller on 12/16/68 11:58

mutale82@gmail.com wrote:

> I use the url to pass w2 the value to put in the cookie (if i want it
> to be written from w2...),
> that's not the problem, the problem is if i want to do the same thrue
> an IMG TAG (for example)...

Hi

You can pass information with the imagetag just fine, eg:
[from w1]
<img src="http://www.w2.com/images/doimage.php?id=762357">
and vise versa
[from w2]
<img src="http://www.w1.com/images/doimage.php?id=762357">

It works the same as GET as far as PHP is concerned.
doimage.php can retrieve the value with $_GET["id"]


> When im not actually moving to w1...
> On w2 (in Another page, not the landing page) i want to call a php file
> on w1, but NOT redirecting to it,
> i can read the cookie in w2 (only by JS) but i cant put the value in
> the query string of the file im calling...
> btw. i tried to read the cookie from the php file that im calling, but
> it says that there is no cookie set (apperantly its trying to read it
> from w1-Domain).
>
> so i need a way to do one of two:
> 1. transfer the value of the cookie (which read by w2 -JS) to a file on
> w1...
> 2. read the cookie from the file in w1 (whose been called by IMG TAG on
> w2).

I am not sure if you need file for that, but I do not know your setup.

Summarizing:
If you want to pass the value of the cookie from w1 to w2 via an image that
is displayed on the w1 page:

JS:
var cookiename, cookievalue;
// fill them with appropriate values

var theImgURL = "http://www.w2.com/images/doimage.php?";
theImgURL += "cookiename="+escape(cookiename);
theImgURL += "&cookievalue="+escape(cookievalue);

document.images.mycookiegif.src=theImgURL;

<img src="0.gif" name="mycookiegif">

Then from w2 doimage.php:
[php]
$cookiename = $_GET["cookiename"];
$cookievalue = $_GET["cookievalue"];

[not tested, just the bare idea]

Does that help?

Regards,
Erwin Moller

>
> --
> Thanks.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация