PDA

View Full Version : Cookie length


29th July 2004, 06:09 PM
Can anyone advise on Post affiliate (not PRO).

I can create a sale quite easily but when returning from the same PC after a few minutes and completing a second order (with any referrer id) then the cookie seems not to be seen and no sale created.

In short I want to offer affiliates and infinite cookie length BUT am also concerned about multiple payments to affiliates i.e. a user having cookies from several affiliates on their PC?

Any advice?

Thanks

Darren

dazzling
29th July 2004, 06:11 PM
Can anyone advise on Post affiliate (not PRO).

I can create a sale quite easily but when returning from the same PC after a few minutes and completing a second order (without any referrer id) then the cookie seems not to be seen and no sale created.

In short I want to offer affiliates and infinite cookie length BUT am also concerned about multiple payments to affiliates i.e. a user having cookies from several affiliates on their PC?

Any advice?

Thanks

Darren

mark
29th July 2004, 07:45 PM
Hello,

by default the cookie will expire after you close the browser.
If you want to make it last longer, you should edit the affiliate.php script and add one more parameter to SetCookie function.


SetCookie ("ref",$_GET['ref'], time() + 365*24*60*60);

third parameter is expiration time in seconds from now. In my example cookie will expire after 1 year (days*hours*minutes*seconds) from now.

But users cannot have cookies of several affiliates on their PC, new affiliate will overwrite the cookie of the old one.

regards,

mark

30th July 2004, 03:11 PM
Thanks for the reply. The modified code appears not to work unfortunately. Is there an reason why the line below appears 6 times in affiliate.php i.e.

SetCookie ("ref",$_GET['ref'])
SetCookie ("ref",$_GET['ref'])
SetCookie ("ref",$_GET['ref'])
SetCookie ("ref",$_GET['ref'])
SetCookie ("ref",$_GET['ref'])
SetCookie ("ref",$_GET['ref'])

I have used the following for a 20 year cookie:

SetCookie ("ref",$_GET['ref'], time() + 20*365*24*60*60);
SetCookie ("ref",$_GET['ref'], time() + 20*365*24*60*60);
SetCookie ("ref",$_GET['ref'], time() + 20*365*24*60*60);
SetCookie ("ref",$_GET['ref'], time() + 20*365*24*60*60);
SetCookie ("ref",$_GET['ref'], time() + 20*365*24*60*60);
SetCookie ("ref",$_GET['ref'], time() + 20*365*24*60*60);

Any help once again appreciated.

Darren

mark
30th July 2004, 10:01 PM
Hello,

I must say I don't know why it is not working for you. It is working for me. I normally set 10 yrs, not 20 for "infinite" cookies, but I don't think this should be the reason why it is not working.

Repeating the same line multiple times is a hack, I found out that sometimes PHP failed to save a cookie when I called the function only once.
I know it is strange behavior, maybe it was some bug which is corrected already, but that's why.

regards,

mark

31st July 2004, 04:01 PM
Have sorted it (stupid error!). Thanks a lot for your help.

Darren