mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-03 01:39:28 +02:00
Fixed bug preventing ipv6 addresses from being added to user's ip history.
This commit is contained in:
parent
a9292f8f6e
commit
0b9391e042
1 changed files with 6 additions and 2 deletions
|
@ -897,11 +897,15 @@ class User extends database_object
|
||||||
// Remove port information if any
|
// Remove port information if any
|
||||||
if (!empty($sip)) {
|
if (!empty($sip)) {
|
||||||
// Use parse_url to support easily ipv6
|
// Use parse_url to support easily ipv6
|
||||||
$sipar = parse_url("http://" . $sip);
|
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'];
|
$sip = $sipar['host'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$ip = (!empty($sip)) ? Dba::escape(inet_pton($sip)) : '';
|
$ip = (!empty($sip)) ? Dba::escape(inet_pton(trim($sip, "[]"))) : '';
|
||||||
$date = time();
|
$date = time();
|
||||||
$user = $this->id;
|
$user = $this->id;
|
||||||
$agent = Dba::escape($_SERVER['HTTP_USER_AGENT']);
|
$agent = Dba::escape($_SERVER['HTTP_USER_AGENT']);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue