<!-- $Id: Proxy-to-real-ip.txt 873 2012-05-24 01:03:17Z  $ -->


=========================================================
Paul Marsden Proxy IP Hack Modification for vBulletin 4.1
=========================================================


This makes your forum use the real ip address if a proxy server is detected, the proxy ip is recorded in an extra field.
This allows all vBulletin ip based functions, such as ip searching, who's online and ip banning to work correctly using the real ip.

Please note that proxy servers can ONLY be detected in they pass on the correct http headers.
Not all proxy servers do this, especially annonymous proxy servers since they would not be annonymous if they did.

vBulletin currently uses two global variables IPADDRESS and ALT_IP, this modification adds a third called PROXYIP.

If no proxy is detected then IPADDRESS is set to the real ip, ALT_IP is set to the real ip, and PROXYIP is set to blank.
If a proxy server is detected then IPADDRESS is set to the real ip, ALT_IP is set to the real ip, and PROXYIP is set to the proxy ip.


Step 1 (THIS STEP IS NOT REQUIRED IN vBulletin 4.1.7 - IT *IS* REQUIRED IN ALL OTHER VERSIONS, INCLUDING 4.1.8 ONWARDS).

In class_core.php ;

Find ;

		// 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);


Replace with ;

		// Paul M - Get ip addresses.
		$registry->ipaddress = $this->fetch_ip();
		$registry->alt_ip = $this->fetch_alt_ip();

		// Check that alt_ip is valid address, reset to original if not.
		if (preg_match("#\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}#", $registry->alt_ip, $iplist))
		{
			$registry->alt_ip = $iplist[0]; 
		}
		else
		{
			$registry->alt_ip = $registry->ipaddress;
		}

		// Set ip constants.
		if ($registry->ipaddress == $registry->alt_ip)
		{
			define('PROXYIP',''); 
			define('ALT_IP',$registry->alt_ip);
			define('IPADDRESS',$registry->ipaddress);
		}
		else
		{
			define('ALT_IP',$registry->alt_ip);
			define('IPADDRESS',$registry->alt_ip); 
			define('PROXYIP',$registry->ipaddress);
			$registry->ipaddress = $registry->alt_ip;
		}




Step 2.

Upload the ip-40x.png to your /images/buttons/ folder.



Step 3.

Import the modification as a product using the supplied XML file.


