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