Go Back   vb.org Archive > vBulletin Modifications > Archive > Modification Graveyard

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

Category: Administrative and Maintenance Tools - Version: 4.2.x Rating:
Released: 01-01-2010 Last Update: 01-03-2015 Installs: 686
DB Changes Uses Plugins Auto-Templates
Code Changes Translations  
No support by the author.


--------------------------------------------------------------------------------
This modification has been withdrawn.
vBulletin 4.0.x and 4.1.x are no longer supported.

For vBulletin 4.2.x please use the built in reverse proxy detection.
--------------------------------------------------------------------------------


This hack makes the forum always use the members real ip if 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).

For example ;

* The real ip 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.

Note: This hack relies on the proxy server passing the correct http variables to allow detection.
If they are not passed then detection will not work. By definition, annonymous proxies do not pass on these variables.


If a proxy is detected, then a red ip icon is displayed instead of the standard one.

To install, download and unzip the files and follow the instructions in the text file.

This modification involves changes to the class_core.php file - if you upgrade your vbulletin, you must reapply those changes.
If you forget these edits, the modification will continue to work for forum posts only (v4.0.4 +).



History:

v4.0.1 : 02-Jan-2010 : Initial release for vb 4.0.0 Gold.
v4.0.2 : 04-Jan-2010 : Added check for invalid alt ip address.
v4.0.3 : 13-Jan-2010 : Minor change to cope better when people forget the class_core file edits.
v4.0.4 : 15-Jan-2010 : Further changes to process forum posts when people forget the class_core file edits.
v4.0.5 : 20-Feb-2010 : Internal update, not released.
v4.0.6 : 27-Feb-2010 : Style code updates for vB 4.0.2.
v4.0.7 : 30-Oct-2010 : Style code updated to work when css stored as files.

v4.1.0 : 04-Dec-2010 : Updated for vBulletin 4.1.x

v4.1.7.0 : 16-Oct-2011 : Updated for vBulletin 4.1.7.
v4.1.8.0 : 18-Nov-2011 : Updated for vBulletin 4.1.8.

v4.2.0.0 : 24-May-2012 : Updated for vBulletin 4.2.0.
v4.2.0.1 : 02-Jan-2015 : Updated for Cloudflare Changes.

Show Your Support

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

Comments
  #212  
Old 06-17-2013, 05:25 PM
fly fly is offline
 
Join Date: Oct 2003
Posts: 1,215
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by 0verl0rd View Post
It doesn't work with cloudflare.. helpppp
https://www.google.com/search?q=cloudflare+vbulletin

Second link.
Reply With Quote
  #213  
Old 06-18-2013, 02:01 PM
0verl0rd 0verl0rd is offline
 
Join Date: Oct 2010
Posts: 46
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yeah i have seen that link already...

i also opened a ticket to cloudflare... and they are giving me those 2 options...

I already installed this add-on and the option 2 is somehow difficult because of the construction of code...



How to do this:

PHP Code:
Find: function fetch_ip() { return $_SERVER['REMOTE_ADDR']; }

replace with:

function 
fetch_ip() { if(isset($_SERVER['HTTP_CF_CONNECTING_IP'])) { return $_SERVER['HTTP_CF_CONNECTING_IP']; } return $_SERVER['REMOTE_ADDR']; } 
with these:

PHP Code:
 /**
* Fetches the IP address of the current visitor
*
* @return string
*/
function fetch_ip()
{
return 
$_SERVER['REMOTE_ADDR'];
}

/**
* 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_X_FORWARDED_FOR']))
{
$altip $_SERVER['HTTP_X_FORWARDED_FOR'];
}
else if (isset(
$_SERVER['HTTP_CLIENT_IP']))
{
$altip $_SERVER['HTTP_CLIENT_IP'];
}
else if (isset(
$_SERVER['HTTP_FROM']))
{
$altip $_SERVER['HTTP_FROM'];
}
else
{
$altip false;
}

if (
$altip AND $this->filter_ip($altip))
{
$alt_ip $altip;
}

return 
$alt_ip;

Reply With Quote
  #214  
Old 08-13-2013, 11:49 PM
Bubble #5 Bubble #5 is offline
 
Join Date: Apr 2005
Posts: 984
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

THANK YOU for this excellent hack Paul!
Reply With Quote
  #215  
Old 08-16-2013, 12:33 AM
boggseric's Avatar
boggseric boggseric is offline
 
Join Date: Sep 2009
Posts: 62
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Paul, thanks for the hacks!

Question, I am upgrading my 3.8 forum to 4.2. the forum has quite a few posts (15mil) and modifying the post table on the uninstall of the old mod and then the install of the new version is quite a headache and server intensive.

I was looking at the code and it appears to me the only difference is that the old proxyip field was varchar(20) whereas the new one calls for varchar(15). I'm guessing modifying the product code to not drop this column wouldn't cause a problem right? Those extra 5 characters shouldn't be an issue in my opinion but my database skills are not super high.

So basically before uninstalling the old mod change the code to not drop the column and then modify the new plugin xml to not add the column. Note, I'm not asking for instruction of how to do that I can handle that part, just curious if you think this will break anything or cause problems.
Reply With Quote
  #216  
Old 08-17-2013, 07:49 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

That sounds fine to me.

However - if you just install the new one, without uninstalling the old one, the new one will remove the old product without running the uninstall code anyway.

Same effect, less effort.
Reply With Quote
Благодарность от:
boggseric
  #217  
Old 08-17-2013, 09:25 PM
Bubble #5 Bubble #5 is offline
 
Join Date: Apr 2005
Posts: 984
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Paul, how do we nominate this modification for the MOTM? I saw no link or directions...
Reply With Quote
  #218  
Old 08-17-2013, 11:32 PM
djbaxter djbaxter is offline
 
Join Date: Aug 2006
Location: Ottawa, Canada
Posts: 2,601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Bubble #5 View Post
Paul, how do we nominate this modification for the MOTM? I saw no link or directions...
It's currently in the running for the Mod of the Month so all you need to do is go vote for it: https://vborg.vbsupport.ru/portal.php or https://vborg.vbsupport.ru/showthread.php?t=300696
Reply With Quote
  #219  
Old 08-18-2013, 02:30 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

LOL, so it is. I never noticed that.
Reply With Quote
  #220  
Old 08-19-2013, 10:23 AM
Disco_Dave's Avatar
Disco_Dave Disco_Dave is offline
 
Join Date: May 2011
Location: Belfast
Posts: 586
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Cybex View Post
We fixed it ourselves by editing the class_core.php bit:

Code:
// Detect ALL.
       if ($registry->ipaddress == $registry->alt_ip)
       {
           define('PROXYIP',''); 
       }
       else
       {
           $proxy = true;
           define('PROXYIP',$registry->ipaddress);
       }
       
       if ($proxy)
       {
           define('ALT_IP', $this->ipaddress);
           define('IPADDRESS', $_SERVER['HTTP_X_FORWARDED_FOR']);
       }
       else
       {
           define('IPADDRESS', $_SERVER['HTTP_X_FORWARDED_FOR']);
           define('ALT_IP', $this->alt_ip);
       }
Now the proxy details aren't written properly, but that's not that important for me. At least I see the real IP addresses now.

Where would I place this in the class_core.php??

Dave
Reply With Quote
  #221  
Old 08-20-2013, 02:04 AM
boggseric's Avatar
boggseric boggseric is offline
 
Join Date: Sep 2009
Posts: 62
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Paul M View Post
That sounds fine to me.

However - if you just install the new one, without uninstalling the old one, the new one will remove the old product without running the uninstall code anyway.

Same effect, less effort.
Yes, you are right. That does sound much easier. Thanks!
Reply With Quote
Reply

Thread Tools

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 05:26 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06688 seconds
  • Memory Usage 2,338KB
  • 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
  • (1)bbcode_code
  • (2)bbcode_php
  • (4)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
  • (1)pagenav_pagelinkrel
  • (11)post_thanks_box
  • (14)post_thanks_box_bit
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit
  • (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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • 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