Php simple anti-leech Implementation Method

Source: Internet
Author: User
This article mainly introduces the php simple anti-leech implementation method, which involves php's skills related to server-side predefined variable calls and string processing. It has some reference value. If you need it, you can refer

This article mainly introduces the php simple anti-leech implementation method, which involves php's skills related to server-side predefined variable calls and string processing. It has some reference value. If you need it, you can refer

This article describes how to implement simple anti-leech protection in php. Share it with you for your reference. The details are as follows:

<? Php $ ADMIN = array ('defaulturl' => 'HTTP: // blog. qita. in/images/banner-header.gif ', // address returned by leeching 'url _ 1' => 'HTTP: // blog. qita. in/file', 'url _ 2' => 'HTTP: // blog. qita. in/file1',); $ okaysites = array ('HTTP: // qita. in ', 'HTTP: // blog. qita. in ', // whitelist 'HTTP: // blog. qita. in/1.html ',); $ reffer = $ _ SERVER ['HTTP _ referer']; if ($ reffer) {$ yes = 0; while (list ($ domain, $ subarray) = each ($ okaysites) {if (ereg ($ subarray , "$ Reffer") {$ yes = 1 ;}}$ theu = 'url _'. $ _ GET ['SITE']; $ file =$ _ GET ['file']; if ($ ADMIN [$ theu] and $ yes = 1) {header ("Location: $ ADMIN [$ theu]/$ file");} else {header ("Location: $ ADMIN [defaulturl]");} else {header ("Location: $ ADMIN [defaulturl]");} print_r ($ _ SERVER ['HTTP _ referer']);?>

I hope this article will help you with php programming.

,

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.