Re: Too Advanced? Re: Cookies & Hidden Image
| From: | Diego Fulgueira | Date: | Wed, 03 Sep 2003 23:50:24 +0000 |
| Subject: | Re: Too Advanced? Re: Cookies & Hidden Image | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-161604@lists.php.net to get a copy of this message | ||
Nothing is too advanced for this newgroup and there is not other better. I
did not read your problem very carefully, but I think you are trying to set
a cookie on a page that does a redirect, that is just impossible unless you
do the redirect with a meta tag on the client.
Anyway, if that suggestion doesn't do it for you, I once used the following
function to set cookies and it worked for me:
function MySetCookie
($CkyName, $CkyVal, $exp, $pth, $Domain)
{
$exp = strftime("%A, %d-%b-%Y %H:%M:%S", $exp);
$cookiestr = sprintf ("%s=%s; domain=%s; path=%s; expires=%s",
$CkyName, $CkyVal, $Domain, $pth, $exp);
$mycky = (isset($mycky) ? "$mycky\n" : "")."Set-Cookie: $cookiestr";
header($mycky);
}
Cheers,
Diego
----- Original Message -----
From: "Nicole" <430ntr3k@aeontrek.com>
To: <php-general@lists.php.net>
Sent: Wednesday, September 03, 2003 3:57 PM
Subject: [PHP] Too Advanced? Re: Cookies & Hidden Image
> Is this question too advanced for this newsgroup? Is there a better
> newsgroup to post this one too?
>
> Thanks,
>
> --
> Nicole
>
>
> "Nicole" <430ntr3k@aeontrek.com> wrote in message
> news:20030903001623.18738.qmail@pb1.pair.com...
> > Hi,
> >
> > I am working on a script that uses cookie to store some info on the
client
> > side. The user will click a link that contains info about where the
link
> > was placed. The script will then store that info so that when the user
> > returns later and makes a purchase, I can see where they came from.
> >
> > The problem I am having is this:
> >
> > The link is a redirect url that first goes to one domain where the
cookie
> is
> > created by. Then they are taken to the site where products are sold.
> >
> > Then, after they make a purchase, they are taken to a thank you page
that
> > has a hidden tracker to track that sale.
> >
> > <img
> > src=http://trackerurl.com/?var=1&var=2&blahbla height=0
> > width=>
> >
> > The image loads the script from a different domain (where the cookie was
> > initialy created by). The problem now is that the script gets a blank
> > cookie when using the hidden image to load the script.
> >
> > So does anyone know why this is happening?
> >
> > I have setCookie('CookieName', $value, $expires);
> >
> > Then I try to retrieve that cookie again later with
> $_COOKIE['CookieName']
> > ... but the value stored is not there when the script is called from the
> > hidden image. HOWEVER, the value is there when the script is called
> > directly.
> >
> > Any ideas?
> >
> > Thanks!!
> >
> > Nicole
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>