Home > Backend Development > PHP Tutorial > php Get the source [previous page] page analysis function_PHP tutorial

php Get the source [previous page] page analysis function_PHP tutorial

WBOY
Release: 2016-07-20 11:06:29
Original
1070 people have browsed it

php get the origin [previous page] page analysis function

This article provides a comprehensive function to get the previous page, which is the origin function.

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';
}

}


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/445039.htmlTechArticlephp Get the source [previous page] Page analysis function This article provides a comprehensive function to get the previous level The function of the page is the origin function. function getref($ref,$fullref) { globa...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template