Crappy fix for IPv6 compatibility (watch multi-account!)

This commit is contained in:
nemunaire 2020-11-15 17:26:41 +01:00
parent 934c6a89fd
commit a5586af0ba

View File

@ -72,6 +72,7 @@ function encode_ip($dotquad_ip=FALSE)
if(!$dotquad_ip) $dotquad_ip = $_SERVER['REMOTE_ADDR']; if(!$dotquad_ip) $dotquad_ip = $_SERVER['REMOTE_ADDR'];
$ip_sep = explode('.', $dotquad_ip); $ip_sep = explode('.', $dotquad_ip);
if (empty($ip_sep[3])) $ip_sep = explode('.', "127.0.0.1");
return sprintf('%02x%02x%02x%02x', $ip_sep[0], $ip_sep[1], $ip_sep[2], $ip_sep[3]); return sprintf('%02x%02x%02x%02x', $ip_sep[0], $ip_sep[1], $ip_sep[2], $ip_sep[3]);
} }