Php anti-Leech implementation

Source: Internet
Author: User
: Php anti-Leech implementation: Sometimes users who want to access our website can only access our website through specific links or pages. in this case, we need to implement anti-Leech technology. This uses the referer content filtering in the http protocol. For example, we have a local webpage with the path localhosthttpfdl_one.php. the content is as follows: clickheretoseemore has another webpage, sometimes, users who want to access our website can only access our website through a specific link or page. at this time, anti-Leech technology is required. This uses the referer content filtering in the http protocol.

For example, we have a local webpage with the path http: // localhost/http/fdl_one.php. the content is as follows:

click here to see more
There is another webpage in the path http: // localhost/http/fdl_three.php. the content is as follows:
I also want to see more
The two web pages, namely http: // localhost/http/fdl_two.php, can be accessed separately. However, if you want to filter out fdl_three.php access, you can only use the hyperlink fdl_one.php to enter fdl_two.php. the content in fdl_two.php can be as follows:
 

Http_test_err.php stores forbidden access information.

It is worth mentioning the return value of strpos. The return value is the start position of parameter 2 in parameter 1. if parameter 2 is not found, FALSE is returned. Therefore, you should first determine whether a match is used. in this case, you should strictly control the type and value of the returned value, and use the = symbol. (The returned value may be 0 when matching !!)

What is more widely used is that a page can be accessed through its own site, rather than jump to another site. In this case, you only need to modify the content of parameter 2 in the strpos function and change it to the directory name of your site. To filter out other accesses.


The above introduces php anti-Leech implementation, including anti-Leech and php content, and hopes to be helpful to friends who are interested in PHP tutorials.

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.