1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-03 09:49:30 +02:00

Fixed bug preventing ipv6 addresses from being added to user's ip history.

This commit is contained in:
wagnered 2016-12-06 17:09:33 -08:00
parent a9292f8f6e
commit 0b9391e042

View file

@ -897,11 +897,15 @@ class User extends database_object
// Remove port information if any
if (!empty($sip)) {
// Use parse_url to support easily ipv6
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) === true) {
$sipar = parse_url("http://" . $sip);
} else {
$sipar = parse_url("http://[" . $sip."]");
}
$sip = $sipar['host'];
}
$ip = (!empty($sip)) ? Dba::escape(inet_pton($sip)) : '';
$ip = (!empty($sip)) ? Dba::escape(inet_pton(trim($sip, "[]"))) : '';
$date = time();
$user = $this->id;
$agent = Dba::escape($_SERVER['HTTP_USER_AGENT']);