PHP's simple anti-leeching implementation is explained in detail in the code
- $ADMIN[defaulturl] = "http://www .ite5e.com/404.htm";//The address returned by the hotlink
- $okaysites = array("http://www.ite5e.com/","http://www.jb51. net"); //Whitelist
- $ADMIN[url_1] = "http://www.ite5e.com/temp/download/";//Download location 1
- $ADMIN [url_2] = "";//Download location 2, and so on
- $ffer = $HTTP_REFERER;
- if($ffer) {
- $yes = 0 ;
- while(list($domain, $subarray) = each($okaysites)) {
- if (ereg($subarray,"$ffer")) {
- $yes = 1;
- }
- }
- $theu = "url"."_"."$site";
- if ( $ADMIN[$theu] AND $yes == 1) {
- header("Location: $ADMIN[$theu]/$file");
- } else {
- header("Location: $ADMIN[defaulturl]");
- }
- } else {
- header("Location: $ADMIN[defaulturl]");
- }
- ?>
After testing on this site, it is a very simple and good method.
http://www.bkjia.com/PHPjc/486192.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/486192.htmlTechArticlePHP simple anti-hotlink implementation in code details?php $ADMIN[defaulturl] = "http://www .ite5e.com/404.htm";//The address returned by the hotlink $okaysites = array("http://www.ite5e.com/","http://www...
Statement: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