时间:2021-07-01 10:21:17 帮助过:3人阅读
本文章提供一款功能全面的获取上一级页面的函数哦,就是来路函数了。
function getref(&$ref,&$fullref) {
global $err,$conf,$HTTP_GET_VARS,$_GET;
if(isset($_GET['anr'])) $refer=$_GET['anr'];
elseif(isset($HTTP_GET_VARS['anr'])) $refer=$HTTP_GET_VARS['anr'];
else $refer='undefined';
if(empty($refer)) $refer='undefined';
if(!strcmp($refer,'null')) $refer='undefined';
$refer=urldecode($refer);
$refer=modsec($refer);
$refer=txtproc($refer);
//to correct back slashes http://111cn.cnindex
$refer=str_replace("","/",$refer);
//to remove unnecessary points http://111cn.cn.
$refer=preg_replace("//./",'/',$refer);
$refer=preg_replace("/.//",'/',$refer);
$refer=preg_replace("/.*$/",'',$refer);
$refer=preg_replace("/("|')*$/",'',$refer);
//to remove unnecessary duplicates of slashes http://111cn.cn///
$refer=preg_replace("/([^:])(/)+/",'$1/',$refer);
$fullref=$refer;
$refer=preg_replace("/^(https?://)(www.)?/i",'',$refer);
$ref=preg_replace("/[?|&|#|;].*$/i",'',$refer);
$ref=preg_replace("/(/)*$/",'',$ref);
$ref=trim($ref);
$ref=preg_replace("/.*$/",'',$ref);
$ref=preg_replace("/("|')*$/",'',$ref);
$ref=trim($ref);
//check referrer (bad)
if(empty($ref)) $ref='undefined';
//search "." in domain name
if(!preg_match("/^([^./]+.)+([^./])+/i",$ref)) $ref='undefined';
}
}
http://www.bkjia.com/PHPjc/445039.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/445039.htmlTechArticlephp 获取来路[前一页]页面分析函数 本文章提供一款功能全面的获取上一级页面的函数哦,就是来路函数了。 function getref($ref,$fullref) { globa...