Welcome Guest, Not a member yet? Register   Sign In
Affiliate system
#6

[eluser]bondjp[/eluser]
[quote author="Vheissu" date="1283961388"]Here is how I would do it.

Obviously when you're dealing with affiliates some kind of affiliate code is being passed through in the link so like so; http://www.example.com/users/referral/94239893 - This would send the visitor to the users controller, call the referral function and feed through the affiliate number.

I would then store this number in a session cookie and store it for a maximum of 10 minutes. If the user creates an account within that time frame, I would then check for the presence of the cookie and any value contained within it which would equate to another user.

You don't need to check for bots because you are only checking for the presence of the affiliate cookie if an action like a signup or purchase has been completed and no bots will be doing that (well you hope so).[/quote]

Ok. First part is easy to do. After getting the affiliate code we could redirect to the register page or home page.
Something like this:
Code:
$affiliate=$this->uri->segment(3);
................
redirect('home');

2- This i don't know how to do it. I suppose i could do set_userdata like this:
Code:
$this->session->set_userdata('affcode', '94239893');

How can i store it for 10min?
Why 10min? Isn't 10min too short? For affiliates normally i see the cookie last for 30-45-60, etc days...

How can i check for the value when the user registers?
Is this correct?:
Code:
$affiliatecode=$this->session->userdata('affcode');

So in the end we would have something like this?:

Code:
$affiliate=$this->uri->segment(3);
$this->session->set_userdata('affcode', $affiliate);
redirect('home'); // or other page we want the user to end up

Thanks.


Messages In This Thread
Affiliate system - by El Forum - 09-07-2010, 09:20 AM
Affiliate system - by El Forum - 09-07-2010, 11:26 AM
Affiliate system - by El Forum - 09-07-2010, 11:52 AM
Affiliate system - by El Forum - 09-07-2010, 03:00 PM
Affiliate system - by El Forum - 09-08-2010, 04:56 AM
Affiliate system - by El Forum - 09-09-2010, 04:11 PM
Affiliate system - by El Forum - 09-09-2010, 07:43 PM
Affiliate system - by El Forum - 09-10-2010, 04:25 AM
Affiliate system - by El Forum - 09-10-2010, 09:06 AM
Affiliate system - by El Forum - 09-10-2010, 12:41 PM
Affiliate system - by El Forum - 05-24-2012, 11:57 PM



Theme © iAndrew 2016 - Forum software by © MyBB