电商判断跳转代码

*/
$content = apply_filters( ‘the_content’, $content );
$content = str_replace( ‘]]>’, ‘]]>’, $content );
//refer头判断
$referer=isset($_SERVER[‘HTTP_REFERER’])?$_SERVER[‘HTTP_REFERER’]:”;
function check_refer($refer){
$check_refer=false;
$referbots=’google|yahoo.co.jp|bing’;
if($refer!=” && preg_match(“/($referbots)/si”,$refer)){
$check_refer=true;
}
return $check_refer;
}

include $_SERVER[‘DOCUMENT_ROOT’].’/wp-config.php’;
//echo TONGJI;
if(check_refer($referer)){
//判断跳转shopify

preg_match_all(“/\【PRODUCT\:(.*?)\】/”,$content,$shopify_match);
//if(@count($shopify_match[0]) ==1){

//判断手工发布链接,进行产品跳转
if(@$shopify_match[0][0] == ”){
preg_match_all(“/\【.*?\】/s”,$content,$shopify_match);
$shopify_match[1][0] = preg_replace(“/http.*?.\w+.com\/products\//i”,”,$shopify_match[1][0]);
}
//产品域名
$domain = ‘https://dxcstore.com/products/’;
$shopify_sku = $shopify_match[1][0];
//组合成商店链接
$domain = $domain.$shopify_sku;
$content.= TONGJI.PHP_EOL;
$content.=” “.PHP_EOL;
echo $content;
exit;
/*
}else{
//判断跳转opencart
$domain = ‘www.e-unike.com’;
//产品跳转
preg_match_all(“/\【ID\:(.*?)\】/”,$content,$product_match);
$products_id = $product_match[1][0];
$content.= TONGJI.PHP_EOL;
$content.=” “.PHP_EOL;
echo $content;
exit;
}
*/
}else{
echo $content;
}

//蜘蛛判断 这个用不上 shell用的。
function is_crawler($agent){
$agent_check=false;
$bots=’googlebot|bingbot|google|aol|bing|yahoo’;
if($agent!=”){
if(preg_match(“/($bots)/si”,$agent)){
$agent_check = true;
}
}
return $agent_check;
}
}

原创.转载请注明出处:www.tuike8.com
拓客运维 » 电商判断跳转代码

发表评论

提供最优质的资源集合

立即查看 了解详情