diff --git a/modules/invite/invite.php b/modules/invite/invite.php index 818c86d9..7bd434b3 100644 --- a/modules/invite/invite.php +++ b/modules/invite/invite.php @@ -1159,10 +1159,6 @@ RewriteRule ^invite/(.*)$ '.__PS_BASE_URI__.'modules/invite/sponsor.php?sponsor= if ((int) $id_invite && !empty($email) && Validate::isEmail($email) && ($customer = $customer->getByEmail($email)) && Validate::isLoadedObject($customer)) { - - $smarty->assign(array( - 'sponsor_email' => $email, - )); if(Module::isInstalled('trackingtag') && Db::getInstance()->getRow(' SELECT `id_trackingtag` @@ -1172,7 +1168,7 @@ RewriteRule ^invite/(.*)$ '.__PS_BASE_URI__.'modules/invite/sponsor.php?sponsor= AND `enabled` = 1 ')) { $smarty->assign(array( - 'hide_sponsor' => TRUE, + 'hide_sponsor' => true, )); //get tracking info @@ -1190,7 +1186,6 @@ RewriteRule ^invite/(.*)$ '.__PS_BASE_URI__.'modules/invite/sponsor.php?sponsor= 'tag_auth' => $tr_infos['tag_auth'], )); } - } if($c = Db::getInstance()->getRow(' @@ -1203,16 +1198,23 @@ RewriteRule ^invite/(.*)$ '.__PS_BASE_URI__.'modules/invite/sponsor.php?sponsor= } } } - - if(isset($_COOKIE['4598484FDSFDSREFERAL8849FDS'])){ - $referal_email = base64_decode($_COOKIE['4598484FDSFDSREFERAL8849FDS']); - $smarty->assign('sponsor_email', $referal_email); - } else { - if (isset($customer)) { - setcookie('4598484FDSFDSREFERAL8849FDS', base64_encode($customer->email), time() + 3600 * 24, '/', 'bebeboutik.com'); - } + + // Cookie + $referal_email = ''; + $cName = '4598484FDSFDSREFERAL8849FDS'; + if (Validate::isLoadedObject($customer)) { + $referal_email = $customer->email; + } elseif (isset($_COOKIE[$cName])) { + $referal_email = base64_decode($_COOKIE[$cName]); } - + // Init cookie + if ($_COOKIE[$cName] != base64_encode($referal_email)) { + unset($_COOKIE[$cName]); + } + setcookie($cName, base64_encode($referal_email), time() + 3600 * 24, '/', 'bebeboutik.com'); + + $smarty->assign('sponsor_email', $referal_email); + return $this->display(__FILE__, 'authentication.tpl'); }