Post by MAXI600 » Thu May 01, 2014 12:23 am

Hello, I am using shared hosting with opencart and using CloudFlare Services.

I face problem with customers IP, I see CloudFlare IP not Customers IP, I am contact CloudFlare to resolve this Problem, CloudFlare say you Must Install mod_cloudflare in your server !! My Server not accept to install mod_cloudflare.


Now CloudFlare Give to me second Chance it's code:

Note: This will only fix the IP address for scripts that need to know the IP and not your actual server logs.

If you can't install mod_cloudflare, or if there is no plugin available for your CMS platform to restore original visitor IP, you would want to put this code in your site in or before the <body>:

`<?php if (isset($_SERVER['HTTP_CF_CONNECTING_IP']))
$_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_CF_CONNECTING_IP'];
?>`



Now My question How can use this Code Please .. Where i put it ?



Thanks

Newbie

Posts

Joined
Sun Mar 23, 2014 1:20 am

Post by rph » Thu May 01, 2014 3:54 am

I would place it in /system/startup.php .

-Ryan


rph
Expert Member

Posts

Joined
Fri Jan 08, 2010 5:05 am
Location - Lincoln, Nebraska

Post by MAXI600 » Thu May 01, 2014 4:30 am

Thanks for reply, It's work fine .

Newbie

Posts

Joined
Sun Mar 23, 2014 1:20 am

Post by markmarkus » Mon Jun 02, 2014 5:53 am

I had to put it into index.php

Right after //Version

if ($_SERVER["HTTP_CF_CONNECTING_IP"]) {
$_SERVER["REMOTE_ADDR"] = $_SERVER["HTTP_CF_CONNECTING_IP"];
}

And then it works. You can check it in Reports/Clients/Clients Online
If you click on the IP number you can see the procedence of the IP number, before it was always Cloudflare, now it shows the proper country and ISP.

New member

Posts

Joined
Thu Dec 26, 2013 7:51 am
Who is online

Users browsing this forum: Semrush [Bot] and 31 guests