vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Graveyard (https://vborg.vbsupport.ru/forumdisplay.php?f=224)
-   -   Administrative and Maintenance Tools - Proxy to Real IP Conversion (https://vborg.vbsupport.ru/showthread.php?t=120082)

Aclikyano 11-26-2006 05:37 AM

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;
        }


Paul M 11-26-2006 10:16 AM

I know what's built in :) If you want to use this then follow the instructions.

Aclikyano 11-28-2006 05:55 AM

<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

Paul M 11-28-2006 07:48 AM

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.

Mecho 11-28-2006 09:58 AM

How can i make it hide for Moderators ??

Thanks

Aclikyano 11-28-2006 07:42 PM

Quote:

Originally Posted by Paul M (Post 1127048)
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 :)

NeitherSparky 11-29-2006 04:20 AM

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

kellogs 11-29-2006 11:17 AM

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

Paul M 11-29-2006 05:19 PM

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.

Aclikyano 12-02-2006 04:47 PM

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.

Paul M 12-02-2006 07:16 PM

Glad you sorted it. :)

Calibre_k 12-03-2006 08:33 PM

Where do i find class_core.php?

Shazz 12-03-2006 08:36 PM

Quote:

Originally Posted by Calibre_k (Post 1131155)
Where do i find class_core.php?

Did you extract the zip? It should say

forum root/includes/class_core.php

Calibre_k 12-03-2006 08:56 PM

Shaz found it on the server Thanks

I did all edits got this error

Fatal error: Call to undefined function: fetch_real_ip() in /home/forum/includes/class_core.php on line 1569

vBulletin version 3.6.4

I did step 1, 2, 4, 5

Paul M 12-03-2006 09:14 PM

Then you need to check what you did wrong, step 1 adds the function code.

Calibre_k 12-03-2006 09:26 PM

tried from start again this time


Parse error: syntax error, unexpected $end in /home/forum/includes/class_core.php on line 1515

geppeto 12-04-2006 12:59 PM

In vB 3.6.4 edited new class_core.php 1,2,4 & 5 steps. No errors but don't work, don't detect proxys IP.

Best regards

HeLLCiTo 12-05-2006 01:19 PM

to make an update from 2.23 what a i need?

Paul M 12-05-2006 06:14 PM

Quote:

Originally Posted by Calibre_k (Post 1131198)
tried from start again this time


Parse error: syntax error, unexpected $end in /home/forum/includes/class_core.php on line 1515

Then redo the edits - there are no errors if you do them correctly.

Quote:

Originally Posted by geppeto (Post 1131573)
In vB 3.6.4 edited new class_core.php 1,2,4 & 5 steps. No errors but don't work, don't detect proxys IP.

Read the notes.

Quote:

Originally Posted by HeLLCiTo (Post 1132411)
to make an update from 2.23 what a i need?

Re-install it.

None of you have marked this as installed, please do this if you have further questions.

McMendo 12-05-2006 07:11 PM

Using vb 3.6.4 here and trying to install this.

Step 3 tells to find in class_core.php:
Code:

                // define session constants

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

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

Instead there is:
Code:

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

and on another part of the code:
Code:

              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
                }

It's confusing.

Paul M 12-05-2006 07:16 PM

Quote:

Originally Posted by McMendo (Post 1132660)
Using vb 3.6.4 here and trying to install this.

Step 3 tells to find in class_core.php:

Please read the instructions carefully ;

Quote:

Step 3 (vB Versions 3.6.0 to 3.6.3 only).
:)

McMendo 12-05-2006 09:14 PM

Sorry, my fault. Got to have some sleep one of these days.

Thank you ;)

Paul M 12-05-2006 09:19 PM

Quote:

Originally Posted by McMendo (Post 1132767)
Sorry, my fault. Got to have some sleep one of these days.

Thank you ;)

When you have got your sleep, please feel free to click on the "Mark as Installed" link. :)

McMendo 12-05-2006 09:45 PM

*click* (installed)

Tells you loads about the anonymity of most proxies. I suppose that there will be proxies for which it doesn't work?

Great hack, thank you.

andrew67 12-06-2006 11:27 PM

Installed , thanks Paul :)

Paul M 12-07-2006 12:21 AM

Quote:

Originally Posted by McMendo (Post 1132797)
Tells you loads about the anonymity of most proxies. I suppose that there will be proxies for which it doesn't work?

There will be plenty it will not work for, it can only function if the proxy passes on the details, many (quite deliberately) do not.

Zelos 12-07-2006 02:03 AM

I just noticed that the version of the current XML file (v2.25) outdates the one I have installed on my site (from when I first installed the mod (v2.21)). Should I replace the old one with the new one? If so, how would I go about doing that? Should I uninstall the old one first, or just upload and overwrite?

I'm running 3.6.4 if that matters, and yes, I have already upgraded my class_core.php

Paul M 12-07-2006 04:01 AM

Just import the new xml via the product manager.

There are a couple of minor bug fixes between 2.21 and 2.25 so it's worth updating it.

brhoom 12-07-2006 09:38 AM

Thanks.

Zidane007nl 01-12-2007 10:48 AM

Thanks for this hack!
I'm having trouble lately with some idiot who keeps making accounts since he has been banned. >.<

nocte 01-15-2007 06:36 PM

I asked on vbulletin-germany.com about the reason why my database error emails don't contain the Referrer but instead the string "REFERRER".

example:
Quote:

Datenbankfehler in vBulletin :

mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Too many connections
/var/www/web1/html/forum.tld/forum/includes/class_core.php on line 273

MySQL-Fehler :
Fehler-Nr. :
Datum : Wednesday, January 10th 2007 @ 11:49:00 PM
Skript : http://www.forum.tld/forum/attachmen...1&d=1164658385
Referrer : REFERRER
IP-Adresse : 62.47.21.XX
Benutzername :
Klassenname : vB_Database
StGaensler said that maybe this hack is the reason for this..

hmusic 01-18-2007 09:09 AM

excellent hack.
installed with ease

Zolo 01-18-2007 02:38 PM

MR. Paul M the Greatest admin, The gr8test vb.Hacker & the best Supporter

Your Hacks .. are always great ones :cool: please accept our Deep Thanks Mr. Admin

Q: The Real IP Address .. will it be stored in DB for any future use?
.
.
.
.

Thank you Paul.

Paul M 01-18-2007 07:30 PM

Quote:

Originally Posted by Zolo (Post 1162239)
The Real IP Address .. will it be stored in DB for any future use?

Thank you Paul.

Both real and proxy ip are stored.

nocte 01-18-2007 07:49 PM

Quote:

Originally Posted by Paul M (Post 1162420)
Both real and proxy ip are stored.

please take a look at my posting: https://vborg.vbsupport.ru/showpost....&postcount=231 - may this hack cause the Problem with the 'REFERRER' ?

Paul M 01-18-2007 10:17 PM

Nope, this does not touch the referrer variable.

Salvar 01-19-2007 12:09 AM

I get:

XML Error: not well-formed (invalid token) at Line 1

Whats the problem

Paul M 01-19-2007 01:35 AM

It would help if you actually said what what you are doing to get that error.

If you are importing the product, then the xml file you have is corrupt, redownload and unzip it.

WAHMama 01-19-2007 10:59 AM

OK I feel like a total idiot, and I appologize if this has been asked before or if the answer is so simple my 6 year old could do it, but I need help here. I downloaded the zip file, I looked at the instructions, I tried to find the class_core.php but I don't know where or how to find this. I used the ctrl + F feature to find the text but it can't find it, I saw on here that it was in lines 1550 or something but when I opened the xml document in my html-kit there were only 150 lines so now I am so confused it's pathetic....can anyone help an idiot out and explain this all to me? I would really appreciate it!

Paul M 01-19-2007 05:00 PM

class_core.php is a default vbulletin file, in the includes folder.


All times are GMT. The time now is 01:59 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.01789 seconds
  • Memory Usage 1,838KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (5)bbcode_code_printable
  • (12)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete