Php get the path [Previous Page] page analysis function _ PHP Tutorial-php Tutorial

Source: Internet
Author: User
Tags in domain
Php retrieves analysis functions from the [previous Page] page. Php retrieval method [Previous Page] page analysis function this article provides a function to fully obtain functions on the previous page. Functiongetref ($ ref, $ fullref) {globa php gets the analysis function from the [previous Page] page.

This article provides a comprehensive function to obtain functions on the upper-level page.

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 slash 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 to obtain the road [Previous Page] page analysis function this article provides a comprehensive function to obtain the function of the upper-level page Oh, is the road function. Function getref ($ ref, $ fullref) {globa...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.