I need a little help with setting this up with Cloudflare.
Their instructions have be going into class_core.php and editing the following lines:
take the following steps.
-------------------
Open includes/class_core.php
Find function fetch_ip() { return $_SERVER['REMOTE_ADDR']; }
and replace with function
fetch_ip() { if(isset($_SERVER['HTTP_CF_CONNECTING_IP'])) { return $_SERVER['HTTP_CF_CONNECTING_IP']; } return $_SERVER['REMOTE_ADDR']; }
Find
function fetch_alt_ip() { $alt_ip = $_SERVER['REMOTE_ADDR'];
if (isset($_SERVER['HTTP_CLIENT_IP'])) { $alt_ip = $_SERVER['HTTP_CLIENT_IP']; }
And replace with
function fetch_alt_ip() { $alt_ip = $_SERVER['REMOTE_ADDR'];
if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) { $alt_ip = $_SERVER['HTTP_CF_CONNECTING_IP']; } else if (isset($_SERVER['HTTP_CLIENT_IP'])) { $alt_ip = $_SERVER['HTTP_CLIENT_IP']; }
--------------------
I can do the first step fine, but the second one is formatted differently by this mod. I have:
==============
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;
}
===========
What do I need to change in there and how should it be formatted to get this mod to work with Cloudflare?
Thanks!
|