News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Modification to show actual IP address

Started by drjoe101, December 18, 2014, 12:52:13 PM

Previous topic - Next topic

drjoe101

Hello:

I have instituted a firewall product to stop spam and other attacks across our whole company website which includes our SMF forum.  Everybody who registers is tagged with the firewall's IP address and not the actual IP that they were using.  The firewall company has a little PHP code which I can insert to fix this issue.  I am just not certain in which of the SMF application files I need to insert.  Here is the code:

if(isset($_SERVER['HTTP_X_SUCURI_CLIENTIP']))
        {
    $_SERVER["REMOTE_ADDR"] = $_SERVER['HTTP_X_SUCURI_CLIENTIP'];
        }

Could anybody assist me with what file I would need to modify.

Thank you.

Sir Osis of Liver

It's in /Sources/QueryString.php -



// Find the user's IP address. (but don't let it give you 'unknown'!)
if (!empty($_SERVER['HTTP_X_FORWARDED_FOR']) && !empty($_SERVER['HTTP_CLIENT_IP']) && (preg_match('~^((0|10|172\.(1[6-9]|2[0-9]|3[01])|192\.168|255|127)\.|unknown)~', $_SERVER['HTTP_CLIENT_IP']) == 0 || preg_match('~^((0|10|172\.(1[6-9]|2[0-9]|3[01])|192\.168|255|127)\.|unknown)~', $_SERVER['REMOTE_ADDR']) != 0))


Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Advertisement: