yeah i have seen that link already...
i also opened a ticket to cloudflare... and they are giving me those 2 options...
I already installed this add-on and the option 2 is somehow difficult because of the construction of code...
How to do this:
PHP Code:
Find: function fetch_ip() { return $_SERVER['REMOTE_ADDR']; }
replace with:
function fetch_ip() { if(isset($_SERVER['HTTP_CF_CONNECTING_IP'])) { return $_SERVER['HTTP_CF_CONNECTING_IP']; } return $_SERVER['REMOTE_ADDR']; }
with these:
PHP Code:
/**
* Fetches the IP address of the current visitor
*
* @return string
*/
function fetch_ip()
{
return $_SERVER['REMOTE_ADDR'];
}
/**
* 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_X_FORWARDED_FOR']))
{
$altip = $_SERVER['HTTP_X_FORWARDED_FOR'];
}
else if (isset($_SERVER['HTTP_CLIENT_IP']))
{
$altip = $_SERVER['HTTP_CLIENT_IP'];
}
else if (isset($_SERVER['HTTP_FROM']))
{
$altip = $_SERVER['HTTP_FROM'];
}
else
{
$altip = false;
}
if ($altip AND $this->filter_ip($altip))
{
$alt_ip = $altip;
}
return $alt_ip;
}