mirror of
https://github.com/Mibew/mibew.git
synced 2025-01-31 05:20:30 +03:00
Improve algorithm in setting the value for a visitor's IP
This commit is contained in:
parent
35bbb22c56
commit
8c99b13e12
@ -580,7 +580,7 @@ function get_remote_host()
|
|||||||
$has_proxy = isset($_SERVER['HTTP_X_FORWARDED_FOR'])
|
$has_proxy = isset($_SERVER['HTTP_X_FORWARDED_FOR'])
|
||||||
&& $_SERVER['HTTP_X_FORWARDED_FOR'] != $_SERVER['REMOTE_ADDR'];
|
&& $_SERVER['HTTP_X_FORWARDED_FOR'] != $_SERVER['REMOTE_ADDR'];
|
||||||
if ($has_proxy) {
|
if ($has_proxy) {
|
||||||
$ips = explode(', ', $_SERVER['HTTP_X_FORWARDED_FOR'], 2);
|
$ips = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR'], 2);
|
||||||
$ext_addr = (count($ips) > 1)
|
$ext_addr = (count($ips) > 1)
|
||||||
? $ips[0] . ' (' . $_SERVER['HTTP_X_FORWARDED_FOR'] . ')'
|
? $ips[0] . ' (' . $_SERVER['HTTP_X_FORWARDED_FOR'] . ')'
|
||||||
: $ips[0];
|
: $ips[0];
|
||||||
|
Loading…
Reference in New Issue
Block a user