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
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.
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.
Who is online
Users browsing this forum: Semrush [Bot] and 31 guests