PHP 中简略的伪造IP刷票实现

WBOY
Release: 2016-06-13 11:57:21
Original
816 people have browsed it

PHP 中简单的伪造IP刷票实现

一般而言,我们的获取用户真实ip的代码大致是这样...

/** * 获取 远程访问者的IP地址 * * @return string */function real_ip_addr(){	static $remote_ip_address = null;	if (!$remote_ip_address){					$vars = array(			val($_SERVER,'HTTP_CLIENT_IP'),			val($_SERVER,'HTTP_X_FORWARDED_FOR'),			val($_SERVER,'REMOTE_ADDR'),		);		foreach ($vars as $var){			if (!empty($var)) {				$remote_ip_address = $var;				}			continue;		}		if (empty($remote_ip_address)) $remote_ip_address = 'unknown';	}	return $remote_ip_address;}
Copy after login

?

涉及到“客户端”IP的通常使用3个环境变量:$_SERVER['HTTP_CLIENT_IP'] 和$_SERVER['X_FORWARDED_FOR']还有$_SERVER['REMOTE_ADDR']实际上,这3个环境变量都有局限性。前两 个是可以随意伪造。只要在发送的http头里设置相应值就可以,任意字符都可以,而第3个环境变量,如果用户使用了匿名代理,那这个变量显示的就是代理 IP

?

伪造下:

?

:-)...

?

?

:-) 一个小思路

1 楼 vb2005xu 19 小时前  
http://www.webshell.cc/
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template