Home > Backend Development > PHP Tutorial > Detailed explanation of PHP's simple anti-leeching implementation in code_PHP tutorial

Detailed explanation of PHP's simple anti-leeching implementation in code_PHP tutorial

WBOY
Release: 2016-07-13 17:40:36
Original
852 people have browsed it

PHP's simple anti-leeching implementation is explained in detail in the code

  1. $ADMIN[defaulturl] = "http://www .ite5e.com/404.htm";//The address returned by the hotlink
  2. $okaysites = array("http://www.ite5e.com/","http://www.jb51. net"); //Whitelist
  3. $ADMIN[url_1] = "http://www.ite5e.com/temp/download/";//Download location 1
  4. $ADMIN [url_2] = "";//Download location 2, and so on
  5. $ffer = $HTTP_REFERER;
  6. if($ffer) {
  7. $yes = 0 ;
  8. while(list($domain, $subarray) = each($okaysites)) {
  9. if (ereg($subarray,"$ffer")) {
  10. $yes = 1;
  11. }
  12. }
  13. $theu = "url"."_"."$site";
  14. if ( $ADMIN[$theu] AND $yes == 1) {
  15. header("Location: $ADMIN[$theu]/$file");
  16. } else {
  17. header("Location: $ADMIN[defaulturl]");
  18. }
  19. } else {
  20. header("Location: $ADMIN[defaulturl]");
  21. }
  22. ?>


After testing on this site, it is a very simple and good method.

www.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...
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