bebeboutik/modules/invite/sponsor.php
Michael RICOIS e9b0ef0dae Fix
2018-01-17 17:48:37 +01:00

79 lines
2.6 KiB
PHP
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
include(dirname(__FILE__).'/../../config/config.inc.php');
include(dirname(__FILE__).'/../../init.php');
if(($sponsor = Tools::getValue('sponsor')) && strlen($sponsor) > 12) {
$cName = '554b43403edef30d31412286d5098965';
if ($_COOKIE[$cName] != $sponsor) {
unset($_COOKIE[$cName]);
}
setcookie($cName, $sponsor, time() + 3600 * 24 * 365, '/', '.bebeboutik.com');
$email = base64_decode(strrev(substr($sponsor, 12)));
$isExist = Db::getInstance()->ExecuteS('
SELECT `id_customer` FROM `'._DB_PREFIX_.'customer`
WHERE `email` = "'.pSQL($email).'"');
if(true || count($isExist) > 0) {
if(Configuration::get('PS_CIPHER_ALGORITHM')) {
$cipherTool = new Rijndael(_RIJNDAEL_KEY_, _RIJNDAEL_IV_);
} else {
$cipherTool = new Blowfish(_COOKIE_KEY_, _COOKIE_IV_);
}
$gclid = Tools::getIsset('gclid')?'&gclid='.Tools::getValue('gclid'):'';
/**
* @Override Antadis - Module ant_trackingtag
*/
if (!class_exists('AntTrackingTag')){
require_once(_PS_MODULE_DIR_.'/ant_trackingtag/models/AntTrackingTag.php');
}
$tags = AntTrackingTag::getTags();
$url_tag ='';
if (count($tags) > 0) {
foreach ($tags as $tag) {
if(Tools::getIsset($tag['tag'])) {
$value = Tools::getValue($tag['tag']);
$url_tag .='&'.$tag['tag'].'='.$value;
}
}
}
/* @End Override */
if (Tools::getIsset('lpes')) {
$lp = Tools::getValue('lpes');
if(_THEME_NAME_ !== 'site_mobile') {
Tools::redirect('?sponsor='.rawurlencode($cipherTool->encrypt('1|'.$email.'|')).
(isset($lp)? '&lpes='.$lp: '').$url_tag.$gclid);
}
}
if (Tools::getIsset('lp')) {
$lp = Tools::getValue('lp');
}
$query = '';
if (count($_REQUEST) > 0) {
foreach($_REQUEST as $k => $v) {
if ($k == 'sponsor') {
continue;
}
if ($k == 'lp') {
continue;
}
echo $k.'<br/>';
$query.= '&'.$k.'='.$v;
}
}
Tools::redirectLink($link->getPageLink('authentication.php').
'?create_account=1&sponsor='.rawurlencode($cipherTool->encrypt('1|'.$email.'|')).
$query.(isset($lp)? '&lp='.$lp: '').$url_tag.$gclid);
}
}
Tools::redirect();