Forked from wmandai/codeigniter-affiliates-program
Created
February 12, 2018 09:23
-
-
Save Eazybright/956638f0a4df76861bd5260866dd0355 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//check for referal links | |
function referal() | |
{ | |
$CI =& get_instance(); | |
$cookie_value_set = $CI->input->cookie('_tm_ref', TRUE) ? $CI->input->cookie('_tm_ref', TRUE) : ''; | |
if ($CI->input->get('ref', TRUE) AND $cookie_value_set == '') { | |
// referred user so set cookie to ref=username | |
$cookie = array( | |
'name' => 'ref', | |
'value' => $CI->input->get('ref', TRUE), | |
'expire' => '7776000', | |
); | |
$CI->input->set_cookie($cookie); | |
return TRUE; | |
}elseif ($cookie_value_set == '') { | |
$cookie = array( | |
'name' => 'ref', | |
'value' => 'sso', | |
'expire' => '15552000', | |
); | |
$CI->input->set_cookie($cookie); | |
return TRUE; | |
}elseif ($cookie_value_set != '') { | |
//already referred so ignore | |
return TRUE; | |
}else{ | |
return TRUE; | |
} | |
} | |
//end of hooks file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment