<!-- $Header: d:\cvs/3.7/Proxy-to-real-ip/Proxy-to-real-ip.txt,v 3.1 2007/12/08 23:15:05 pem Exp $ -->

Paul Marsden Proxy IP Hack Modification for vBulletin 3.7
        ^^
=========================================================

*           .          .

*                      .


vB     IPADDRESS  ALT_IP       - PROXYIP.

      IPADDRESS    , ALT_IP        PROXYIP  .

       IPADDRESS       ALT_IP       PROXYIP      .



 .

  class_core.php

 :

	function fetch_ip()
	{
		return $_SERVER['REMOTE_ADDR'];
	}


 :

	/*
	Paul M - Try to detect real ip when proxy is in use.
	*/
	function fetch_real_ip()
	{
		$real_ip = ''; 
		$ignoreprivate = false;	
		if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) 
		{
			$real_ip = $_SERVER['HTTP_X_FORWARDED_FOR']; 
		}
		else if (isset($_SERVER['HTTP_CLIENT_IP'])) 
		{
			$real_ip = $_SERVER['HTTP_CLIENT_IP']; 
		}
		else if (isset($_SERVER['HTTP_FROM'])) 
		{
			$real_ip = $_SERVER['HTTP_FROM']; 
		}
		if (preg_match("#\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}#", $real_ip, $iplist))
		{
			$real_ip = $iplist[0]; 
			if ($ignoreprivate AND preg_match("#^(127|10|172\.(1[6-9]|2[0-9]|3[0-1])|192\.168|169\.254)\.#", $real_ip))
			{ 
				$real_ip = ''; 
			} 
		}
		else  
		{
			$real_ip = ''; 
		}
		return $real_ip;
	}



 .

  class_core.php

 :

		// fetch client IP address
		$registry->ipaddress = $this->fetch_ip();
		define('IPADDRESS', $registry->ipaddress);

		// attempt to fetch IP address from behind proxies - useful, but don't rely on it...
		$registry->alt_ip = $this->fetch_alt_ip();
		define('ALT_IP', $registry->alt_ip);


 :

		// Paul M - Set Real, Alt & Proxy IP addresses
		$registry->ipaddress = $this->fetch_ip();
		$registry->alt_ip = $this->fetch_alt_ip();
		$registry->real_ip = $this->fetch_real_ip();
		define('ALT_IP', $registry->alt_ip);
		if ($registry->real_ip)
		{
			define('PROXYIP', $registry->ipaddress);
			define('IPADDRESS', $registry->real_ip); 
		}
		else
		{
			define('PROXYIP', ''); 
			define('IPADDRESS', $registry->ipaddress);
		}




 .

 class_core.php

 :

		// define session constants
		define('SESSION_HOST',   substr($registry->ipaddress, 0, 15));


 :

		// Paul M - Define session host
		define('SESSION_HOST',   substr(IPADDRESS, 0, 15));



 :

 class_core.php

 :

		if (!defined('SESSION_IDHASH'))
		{
			define('SESSION_IDHASH', md5($_SERVER['HTTP_USER_AGENT'] . $this->fetch_substr_ip($registry->alt_ip))); // this should *never* change during a session
		}


 :

		if (!defined('SESSION_IDHASH'))
		{
			// Paul M - Define session id
			define('SESSION_IDHASH', md5($_SERVER['HTTP_USER_AGENT'] . vB_Session::fetch_substr_ip(IPADDRESS)));
		}



 .

   px.gif   /images/buttons folder.



 .

     .        .


