Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2018-02-25 09:52:40 +01:00
parent 02f14ceb05
commit ee4e106d83

View File

@@ -140,28 +140,27 @@ function disconnectFTL($quiet=true)
}
$clients = [];
function resolveHostname($c)
function resolveHostname($clientip)
{
if(array_key_exists($c, $clients))
if(array_key_exists($clientip, $clients))
{
// Entry already exists
$c = $clients[$c];
$clientname = $clients[$clientip];
return $clientname;
}
if(filter_var($clientip, FILTER_VALIDATE_IP))
{
// Get host name of client and convert to lower case
$clientname = strtolower(gethostbyaddr($clientip));
}
else
{
if(filter_var($c, FILTER_VALIDATE_IP))
{
// Get host name of client and convert to lower case
$c = strtolower(gethostbyaddr($c));
}
else
{
// This is already a host name
$c = strtolower($c);
}
// Buffer result
$clients[$c] = $c;
// This is already a host name
$clientname = strtolower($clientip);
}
return $c;
// Buffer result
$clients[$clientname] = $clientip;
return $clientname;
}
?>