Q:

How to use MaxMind GeoIP detection while using CloudFlare? 

I'd like to know how can we detect the IP of the client with maxmind GeoIP while using Cloudflare ? 

A:

You need to use CF special server variable "HTTP_CF_CONNECTING_IP" to get the actual user IP address. 
Please use the following code to replace your original server variable "HTTP_CF_CONNECTING_IP". 
$_SERVER['REMOTE_ADDR'] = isset($_SERVER["HTTP_CF_CONNECTING_IP"]) ?  $_SERVER["HTTP_CF_CONNECTING_IP"] : $_SERVER["REMOTE_ADDR"];

