PHP uses REFERER root access to address for page jump_PHP tutorial

WBOY
Release: 2016-07-21 16:13:05
Original
618 people have browsed it

For example, I developed a Yellow Pages source code and transferred it to Script Home. I previously set a demo program address: http://www.jb51.net. But now this domain name needs to be used for other sites, and what should I do if the original demo address becomes invalid? Then I can use PHP REFERER to determine the source. If it comes from the address of the webmaster's download station, I will transfer it to the site domain name.

I placed the following code in index.php on the site http://www.jb51.net to allow access from files.jb51.net to locate my server’s commonly used software download http:/ /s.jb51.net

You can go to the demo address on this page

Copy code The code is as follows:

$referHost = parse_url($_SERVER['HTTP_REFERER' ], PHP_URL_HOST);
$validDomain = 'files.jb51.net';
$valid = strstr($referHost, $validDomain) == $validDomain;
if(!empty($valid)) {
echo '<script>location.href="http://s.jb51.net";</script>';
exit;
}

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/313559.htmlTechArticleFor example, I developed a Yellow Pages source code and transferred it to Script Home. I have set a demo program address before: http://www.jb51.net But now this domain name needs to be used for other sites...
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!