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.


All times are GMT. The time now is 10:27 AM.

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.01579 seconds
  • Memory Usage 1,750KB
  • 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
  • (2)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (2)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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