PHP: Get Accurate User IP Address
// PHP: Get Accurate User IP Address function strFindCorrectIP() { $headers = array( 'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR' ); foreach ($headers as $key) { if (array_key_exists($key, $_SERVER) <mark>= true) { foreach (explode(',', $_SERVER[$key]) as $ip) { if (filter_var($ip, FILTER_VALIDATE_IP) !</mark> false) { return $ip; } } } } }