You are here

function referral_set_cookie in User Referral 7

Same name and namespace in other branches
  1. 5 referral.module \referral_set_cookie()
  2. 6 referral.module \referral_set_cookie()
2 calls to referral_set_cookie()
referral_get in ./referral.module
Page callback for 'referral'
referral_user_view in ./referral.module
Implements hook_user_view().

File

./referral.module, line 345
The referral module.

Code

function referral_set_cookie($uid) {
  $cookie = array(
    'uid' => $uid,
    'timestamp' => time(),
    'ip' => ip_address(),
    'referer' => $_SERVER['HTTP_REFERER'],
  );
  $cookie_lifetime = variable_get('referral_cookie_lifetime', 1) * 86400;
  $cookie_name = variable_get('referral_cookie_name', REFERRAL_COOKIE_DEFAULT);
  setcookie($cookie_name, serialize($cookie), time() + $cookie_lifetime, '/');
}