-2

I'm using PHP 5.0 and a simple team building script. However, each member's affiliate ID such as www.example.com/test where test is the username is not transferring to all pages.

So if someone clicks the register link and doesn't join right away because the person clicked to another page and then registers, that member will not be the sponsor; the system will be the sponsor because the affiliate ID was not transferred to all pages.

How can I make the members' affiliate id transfer to all pages?

  • 1
    I think/hope you're not serious about *5.0*!? The very least anyone should be using if they haven't upgraded their machines in years is 5.2.17, and even that is ancient. – deceze Jun 19 '13 at 05:52

1 Answers1

0

If I understood you right, than you want to track from which affiliate ID a user comes from. I would simply save that information to a cookie or a session variable (which would also use cookies normally).

So you can track the user even days later if your new user has decided to register or to use your service.

setcookie("AffiliateID", $affiliateID, time()+3600*24*$days);
rekire
  • 47,260
  • 30
  • 167
  • 264
  • Ok great. thanks. Its PHP 5.3 I tried a similar version of that code I found on this forum but it didn't work. Let me try that code and will get back to you.. – Aaron Soares Jun 20 '13 at 14:09
  • I inserted the code in the header.php file and I'm not sure if its working. The affiliate ID is not transferring from page to page in the url. example: www.example.com/?username the affiliates ID is not going to other pages such as.. www.example.com/join.php?username it just says www.example.com/join.php and when someone joins the affiliate is not getting credit How can I have the affiliates ID go to every page in the url when someone visits the affiliates url? – Aaron Soares Jun 20 '13 at 14:27
  • My hint about the cockies would never append anything to the url. But if the cookie is set you can allways access it with `$_COOKIE['AffiliateID']`. – rekire Jun 20 '13 at 16:56