For example, I have a development of a yellow page source code to go to the cloud habitat community. Previously fixed a demo program address: Http://www.jb51.net and now this domain name needs to be used for other stations, and do not kill the original demo address How to do it? Then I can use PHP referer to judge the source if it is from the address of the webmaster download station, I will transfer it to the site domain name.
I was in http://www.jb51.net this site index.php placed the following code to get it from the files.jb51.net access to my server to download the most common software downloads http://s.jb51.net
You can go to the demo address on this page
Copy Code code as follows:
<?php
$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
}