Anti-Leech PHP code, anti-Leech PHP code _ PHP Tutorial-php Tutorial

Source: Internet
Author: User
Anti-Leech PHP code and anti-Leech PHP code. Anti-Leech PHP code and anti-Leech PHP code? Php * usage: save the upstream code as dao4.php. for example, if validatecode.rar is used in the test site www.niuzen.com, use the following code to refer to the PHP code for anti-Leech protection and the PHP code for anti-Leech protection.
 

Http://php.662p.com/thread-456-1-1.html


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 ');
?>

How to enable anti-Leech protection in PHP

I am a beginner in php. I can only help you explain the meaning of this expression. As for the proportion of server bandwidth, I have never touched on it and do not understand it.

The readfile () function reads a file and writes it to the output buffer. if "fopen wrappers" has been activated, you can use the URL as the file name in this function.

The parameter $ _ GET ['URL'] in your example should be an array, 'url' is an index, and the value should be a url address () the function writes the url address as the file name to the output cache.

Why? Php/* usage: save the above code as dao4.php, such as the test with validatecode.rar in the site http://www.niuzen.com, then use the following code...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.