|
|
@ -26,24 +26,35 @@ class Welcome extends CI_Controller {
|
|
|
|
|
|
|
|
|
|
|
|
//跳转函数,用来跟踪PPC订单,或者newsletter链接等等
|
|
|
|
//跳转函数,用来跟踪PPC订单,或者newsletter链接等等
|
|
|
|
public function redirect() {
|
|
|
|
public function redirect() {
|
|
|
|
//要转向的URL
|
|
|
|
//要转向的URL
|
|
|
|
$url = $this->input->get('url');
|
|
|
|
$url = $this->input->get('url');
|
|
|
|
|
|
|
|
|
|
|
|
//订单类型 Google PPC 32034 Bing PPC 32035
|
|
|
|
// 指定要匹配的域名
|
|
|
|
$typecode = $this->input->get('code');
|
|
|
|
$domainAH = 'asiahighlights.com';
|
|
|
|
if (!empty($typecode)) {
|
|
|
|
$domainCH = 'chinahighlights.com';
|
|
|
|
set_cookie('inquireTrackFrom', $typecode, 604800); //604800秒=7天过期时间
|
|
|
|
$domainGH = 'globalhighlights.com';
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$veryfiedDomain =
|
|
|
|
//获取google的搜索来源
|
|
|
|
hasDomain($url, $domainAH) ||
|
|
|
|
if (isset($_SERVER['HTTP_REFERER'])) {
|
|
|
|
hasDomain($url, $domainCH) ||
|
|
|
|
$inquireTrackGoogle = $_SERVER['HTTP_REFERER'];
|
|
|
|
hasDomain($url, $domainGH);
|
|
|
|
set_cookie('inquireTrackGoogle', $inquireTrackGoogle, 604800); //604800秒=7天过期时间
|
|
|
|
|
|
|
|
}
|
|
|
|
if ($veryfiedDomain) {
|
|
|
|
|
|
|
|
|
|
|
|
redirect($url);
|
|
|
|
redirect($url);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
send_404();
|
|
|
|
|
|
|
|
exit;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function hasDomain($url, $domain) {
|
|
|
|
|
|
|
|
$parsed = parse_url($url);
|
|
|
|
|
|
|
|
$host = $parsed['host'];
|
|
|
|
|
|
|
|
// 去掉 www. 前缀(如有必要)
|
|
|
|
|
|
|
|
$domain = preg_replace('#^www\.#', '', $domain);
|
|
|
|
|
|
|
|
// 判断 host 是否以指定域名结尾
|
|
|
|
|
|
|
|
return preg_match('/' . preg_quote($domain, '/') . '$/i', $host);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* End of file welcome.php */
|
|
|
|
/* End of file welcome.php */
|
|
|
|