Go Back   vb.org Archive > vBulletin Modifications > Archive > Modification Graveyard
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Proxy to Real IP Conversion Details »»
Proxy to Real IP Conversion
Version: 2.25, by Paul M Paul M is offline
Developer Last Online: Nov 2023 Show Printable Version Email this Page

Category: Administrative and Maintenance Tools - Version: 3.6.x Rating:
Released: 07-01-2006 Last Update: 11-24-2006 Installs: 633
DB Changes Uses Plugins Auto-Templates
Code Changes Translations  
No support by the author.

This modification is no longer available or supported.

This hack makes the forum always use the members real ip when a proxy is detected, meaning that all existing ip functions should continue to work, basically ignoring the proxy server (other than recording it's presence).

i.e.

* The real ip (or host) is displayed in the who's online page.
* The real and proxy server ip's are accesible for each post, the button is red for members using a proxy server.
* The real ip is searchable in the admin/mod cp (but not the proxy ip).
* The real ip can be banned by admins.

etc etc ......

Note: Obviously this hack relies on the proxy server passing the correct http variables to allow detection.

If a proxy is detected, then a red ip icon is displayed instead of the standard one. This mod will also detect if the ipinfo hack is installed and adjust itself to call the ipinfo code.


History:

v2.20 : Updated for vb 3.6. IP Info detection added.
v2.21 : Dependancies updated for 3.6.0 Gold.
v2.22 : Updated for Version Checking.
v2.23 : Fixed bug causing wrong ip in WOL display.
v2.24 : Rewritten slightly to fix a minor issue with spiders.
v2.25 : Updated for changes in vB 3.6.4.


Remember that this modification involves changes to the class_core.php file - if you upgrade your vbulletin, you must reapply those changes.

Please do not post asking why this does not work with some proxy servers, the answer is already in the notes above, and also in Post #160.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #202  
Old 11-26-2006, 05:37 AM
Aclikyano Aclikyano is offline
 
Join Date: Apr 2006
Posts: 481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ugh.... vB 3.6.4 already comes with this built in.
So am I overwriting whats in 3.6.4?

I see a similar code EX BELOW:

ONE THAT COMES WITH VB 3.6.4
Code:
/**
	* Fetches an alternate IP address of the current visitor, attempting to detect proxies etc.
	*
	* @return	string
	*/
	function fetch_alt_ip()
	{
		$alt_ip = $_SERVER['REMOTE_ADDR'];

		if (isset($_SERVER['HTTP_CLIENT_IP']))
		{
			$alt_ip = $_SERVER['HTTP_CLIENT_IP'];
		}
		else if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) AND preg_match_all('#\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}#s', $_SERVER['HTTP_X_FORWARDED_FOR'], $matches))
		{
			// make sure we dont pick up an internal IP defined by RFC1918
			foreach ($matches[0] AS $ip)
			{
				if (!preg_match("#^(10|172\.16|192\.168)\.#", $ip))
				{
					$alt_ip = $ip;
					break;
				}
			}
		}
		else if (isset($_SERVER['HTTP_FROM']))
		{
			$alt_ip = $_SERVER['HTTP_FROM'];
		}

		return $alt_ip;
	}
THE ONE YOU INCLUDED IN ZIP FILE

Code:
/*
	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;
	}
Reply With Quote
  #203  
Old 11-26-2006, 10:16 AM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I know what's built in If you want to use this then follow the instructions.
Reply With Quote
  #204  
Old 11-28-2006, 05:55 AM
Aclikyano Aclikyano is offline
 
Join Date: Apr 2006
Posts: 481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

<a href="http://www.vbulletin.com/forum/showthread.php?p=1260425#post1260425" target="_blank">http://www.vbulletin.com/forum/showt...25#post1260425</a>
Whole site crashed... after doing those specific edits to class_core.php
Reply With Quote
  #205  
Old 11-28-2006, 07:48 AM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That error has nothing to do with this mod, or any edits to class_core.php (as you proved yourself by uploading the original). That is a basic mysql connection error meaning the database/user/password in your config.php is being rejected by the server.
Reply With Quote
  #206  
Old 11-28-2006, 09:58 AM
Mecho's Avatar
Mecho Mecho is offline
 
Join Date: Aug 2006
Posts: 648
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

How can i make it hide for Moderators ??

Thanks
Reply With Quote
  #207  
Old 11-28-2006, 07:42 PM
Aclikyano Aclikyano is offline
 
Join Date: Apr 2006
Posts: 481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Paul M View Post
That error has nothing to do with this mod, or any edits to class_core.php (as you proved yourself by uploading the original). That is a basic mysql connection error meaning the database/user/password in your config.php is being rejected by the server.
ah.. before I edited the class_core.php the site was up.
As soon after.. i edited the class_core.php with the hack the site had a DB error. I checked the sites email and it said it was from class_core.php Line 237 (i think thats the number..)

IM NOT KNOCKING YOUR HACKS.. I just found it...rather..funny..thats all..
This is a great hack and you make good hacks that ive seen.. but hopefully you understood to a point were I came from seeing I didnt understand why that specific file I edited with the hack happened to be the same one throwing the site of or whatever.

Thanks Paul
Reply With Quote
  #208  
Old 11-29-2006, 04:20 AM
NeitherSparky's Avatar
NeitherSparky NeitherSparky is offline
 
Join Date: Aug 2006
Location: Sacramento, CA
Posts: 118
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I don't remember which mod it was, but after installing one and editing some file or another my site went down (I just got a white page). Turned out I had left a single bracket out when making the edits. Are you positive you made all your edits 100% correctly? Those darn php files are so picky.
Reply With Quote
  #209  
Old 11-29-2006, 11:17 AM
kellogs kellogs is offline
 
Join Date: May 2006
Posts: 33
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi Paul,

Thank you for this addon.

The proxy is using the following HTTP HEADER

X-Remote-Addr

May i know how do i edit your script?

Thank you
Edy
Reply With Quote
  #210  
Old 11-29-2006, 05:19 PM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

As far as I can tell, X-Remote-Addr is not the ip address of the client, but the ip address of the proxy server, therefore it is not much use in this code as you already know the proxy server ip. This is designed to pick out the headers giving the client ip.
Reply With Quote
  #211  
Old 12-02-2006, 04:47 PM
Aclikyano Aclikyano is offline
 
Join Date: Apr 2006
Posts: 481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Paul... youll be happier to know that this hack did indeed install properly this time.. we did alot of troubleshooting and it was infact our password being the same as our WHM's which infact was the server host's fault as we were misinformed.

So... needless to say.. great hack as you know..!
I assumed wrong at the time of the install (long story).. just keep making good hacks!.

peace.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:25 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07036 seconds
  • Memory Usage 2,312KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (2)pagenav_pagelinkrel
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete