0

I use cloudflare for my website and I am wondering why my clients IP changing every time I use this script.

In Google my IP is 5.250.13.100 also in other sites like whatismyip I have same.

But when I use this script in my site(with cloudflare) every time I load this script its give me different IP in same range?

<? 
echo $_SERVER["REMOTE_ADDR"]; 
?> 

IP range is: 173.245.. - 188.114..

By looking in CloudFlare IP ranges I found this range is from CloudFlar!

  • So how can I detect in my website my visitor's real IP?
Prix
  • 19,173
  • 14
  • 69
  • 128
nofaven
  • 3
  • 2
  • 1
    Kindly make sure to **use the search before creating new questions**, duplicate of [**CloudFlare and logging visitor IPs via in PHP**](http://stackoverflow.com/questions/14985518/cloudflare-and-logging-visitor-ips-via-in-php) – Prix Dec 28 '14 at 20:55

2 Answers2

4
<?php
$realip = $_SERVER['HTTP_CF_CONNECTING_IP'];
?>
Pieter De Clercq
  • 1,883
  • 1
  • 15
  • 27
1

various solutions from cloudflare

From CloudFlare :

To restore the original visitor IP addresses to log files and web applications running on Apache httpd web servers, you will need to install mod_cloudflare

shyammakwana.me
  • 5,244
  • 2
  • 26
  • 49