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

[eluser]bondjp[/eluser]
I was digging around and found that we can set_cookie.
Wouldn't this be a better solution?

Code:
$affiliate=$this->uri->segment(3);
$cookie = array(
                   'name'   => 'affcode',
                   'value'  => '$affiliate',
                   'expire' => '2592000', // 30 days
                   'domain' => '.mydomain.com',
                   'path'   => '/',
                   'prefix' => 'aff_',
               );


set_cookie($cookie);
// Or
set_cookie('affcode', $affiliate, '2592000'); //is this better?

redirect('home'); // or other page we want the user to end up
// or
$this->load->view('home');

So when the user registers we can check if cookie is set or not like this:

Code:
if (get_cookie('affcode')) {
$affiliate=get_cookie('affcode');

// then save affiliate code into the DB for later use

// and then delete the cookie
delete_cookie('affcode');

}

Is this ok?


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