Thread Rating:
  • 2 Vote(s) - 4.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MyBB 1.6.4 CloudFlare user ip fix
#1
This is just a fix for getting a users actual IP instead of CloudFlare's ip on MyBB 1.6.4 as the 1.6.3 fix doesn't work on 1.6.4

1. Go to /inc/ in your MyBB directory and open up functions.php

2. Go to line 2889 and edit the following:

Replace:
Code:
if(!preg_match("#^(10|172\.16|192\.168)\.#", $_SERVER['REMOTE_ADDR']))
    {
        $ip = $_SERVER['REMOTE_ADDR'];
    }

with:
Code:
if(!preg_match("#^(10|172\.16|192\.168)\.#", $_SERVER['HTTP_CF_CONNECTING_IP']))
    {
        $ip = $_SERVER['HTTP_CF_CONNECTING_IP'];
    }

Reupload the file and enjoy!
Reply
#2
This user has been denied support. This user has been denied support.
tooooo hard to dd code


my pc hanged
Reply
#3
Pretty sure 1.6.4 has a fix for this already Wink It's under Server & Optimisation settings I believe.

I could be entirely wrong though as I haven't used cloudflare for a while.
Reply
#4
http://www.cloudflare.com/wiki/MyBB_1.6

Reply
#5
Thank you Richard :p
Reply
#6
Does it work for 1.6.8 too?
Reply
#7
Not needed for 1.6.8: ACP > Config > Settings > Server and Optimization Options > Scrutinize User's IP address? = Yes
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)