PHP anti-Leech code instance and php anti-Leech instance. PHP anti-Leech code examples, php anti-Leech instances are currently very common web programming skills. This article uses an example to demonstrate the PHP anti-Leech implementation method. I will share with you examples of PHP anti-Leech code and php anti-Leech code.
Anti-Leech is a common web programming technique. This article uses an example to demonstrate the PHP anti-Leech implementation method. Share it with you for your reference. The specific method is as follows:
The main function code is as follows:
<? Php/* usage: save the above code as dao4.php, such as test validatecode.rar in the site http://www.XXXX.com, then use the following code to download the connection. file name? Site = 1 & file = file such as the following URL: http://www.XXXX.cn/dao4.php? Siteapps1&file=validatecode.rar */$ ADMIN [defaulturl] = "http://www.XXXX.com/404.htm"; // address returned by leeching $ okaysites = array ("http://www.XXXX.com/", "http://XXXX.com "); // whitelist $ ADMIN [url_1] = "http://www.XXXX.com/download/"; // download location 1 $ ADMIN [url_2] = ""; // download location 2, similarly, $ reffer = $ HTTP_REFERER; if ($ reffer) {$ yes = 0; while (list ($ domain, $ subarray) = each ($ okaysites )) {if (ereg ($ subarray, "$ reffer") {$ 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]") ;}?>
I hope this article will help you learn PHP programming.
Php anti-Leech code
This implementation using php consumes more resources. we recommend that you start with the server and change apache configuration.
The following is the code implemented by php. xxx.mp3 is the actual address of your music file. only the php address is transmitted during external communication. The mp3 address is not publicly available.
If (strpos ($ _ SERVER ['http _ referer'], 'qq. com ')! = FALSE ){
Header ('http/1.1 404 Not Found ');
Exit;
}
Readfile('xxx.mp3 ');
?>
Php anti-Leech code
You can search for the php binary stream output image on the internet. because the image output must go through php, you can use php to determine first.
Refer anti-Leech is a very common web program design technique. This article uses an example to demonstrate the PHP anti-Leech implementation method. Share it with you...