For example, I developed a yellow page source code and transferred it to my home. Previously set a demo program address: http://www.jb51.net and now this domain name needs to be used for other sites, and do not kill the original demo address failure what to do. Then I can use php referer to determine the source. If it is from the address of the webmaster download site, I will transfer it to the site domain name.
I just put the following code in index. php ON THE http://www.jb51.net site to get it from files.jb51.net access to my server frequently used software download http://s.jb51.net
You can go to the demo address on this page.
Copy codeThe Code is 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;
}