PHP 判断是否使用代理 PHP Proxy Detector

1. php 类

I found this class looking for something else actually but I remembered I needed some while ago something similar and I never found one. I'm sure it will help a lot of developers who try to detect click frauds or something else. The class will scan the headers of the visitor which (in most cases when using proxies) is altered by the server. I will keep the code intact so visitors can give credits to the author :) We will have to create 4 files. Let's start with the first one called "proxy_detector.class.php" which is our little core with the class in clause. Copy paste this code and save it:

<?
/**
*	Proxy Detector v0.1
*		copyrights by: Daantje Eeltink (me@daantje.nl)
*						http://www.daantje.nl
*
*		first build: Mon Sep 18 21:43:48 CEST 2006
*		last build: Tue Sep 19 10:37:12 CEST 2006
*
*	Description:
*		This class can detect if a visitor uses a proxy server by scanning the
*		headers returned by the user client. When the user uses a proxy server,
*		most of the proxy servers alter the header. The header is returned to
*		PHP in the array $_SERVER.
*
*	License:
*		GPL v2 licence. (http://www.gnu.org/copyleft/gpl.txt)
*
*	Support:
*		If you like this class and find it usefull, please donate one or two
*		coins to my PayPal account me@daantje.nl
*
*	Todo:
*		Add open proxy black list scan.
*/

class proxy_detector {

	/**
	* CONSTRUCTOR
	*	Set defaults...
	*/
	function proxy_detector(){
		$this->config = array();
		$this->lastLog = "";

        //set default headers
		$this->scan_headers = array(
			'HTTP_VIA',
			'HTTP_X_FORWARDED_FOR',
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值