1. Simple anti-leech
CopyCode Code: $ admin [defaulturl] = "http://jb51.net/404.htm"; // address returned by leeching
$ Okaysites = array ("http://jb51.net/", "http://www.jb51.net"); // White List
$ Admin [url_1] = "http://jb51.net/temp/download/"; // download location 1
$ Admin [url_2] = ""; // download location 2, and so on
$ 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 [defaurl url]");
}
} Else {
Header ("Location: $ admin [defaurl url]");
}
?>
Usage: Save the preceding code as dao4.php,
For example, validatecode.rar used in my test is in my site http://jb51.net/temp/download,
Use the following code to download the connection.
Code: [copy to clipboard]
File Name? Site = 1 & file = File
2. Server anti-leech
If you use the IIS anti-leech software, you can search for it and there are many websites on the Internet. S.jb51.net
3. Anti-leech protection for software downloads
Copy code The Code is as follows: // The relative directory of the root directory of the downloaded software to the current Script directory
$ Filerelpath = ".../../software ";
// Except the URL that can be connected. Note: you do not need to enter your own domain name. It is set to download,
// An empty string ("") indicates that the URL is directly entered for download.
$ Excludereferarr = array ("www.wjb51.net", "wjb51.net ");
Chdir ($ filerelpath );
$ Filerootpath = getcwd ()."/";
$ Filepath = $ http_get_vars ["file"];
$ Url = parse_url ($ _ server ["http_referer"]);
if ($ URL [host]! = $ _ Server ["http_host"] &! In_array ($ referhost, $ excludereferarr) {
?>