mirror of
https://github.com/pi-hole/web.git
synced 2026-04-28 04:33:58 +01:00
Show names in top clients list from long-term data
Signed-off-by: Christian König <ckoenig@posteo.de>
This commit is contained in:
@@ -158,7 +158,11 @@ if (isset($_GET['topClients']) && $auth)
|
||||
{
|
||||
$limit = "WHERE timestamp <= :until";
|
||||
}
|
||||
$stmt = $db->prepare('SELECT client,count(client) FROM queries '.$limit.' GROUP by client order by count(client) desc limit 20');
|
||||
$dbquery= "Select CASE typeof(client) WHEN 'integer' THEN (";
|
||||
$dbquery .= " SELECT CASE TRIM(name) WHEN '' THEN c.ip ELSE c.name END name FROM client_by_id c WHERE c.id = q.client)";
|
||||
$dbquery .= " ELSE client END client, count(client) FROM query_storage q ".$limit." GROUP by client order by count(client) desc limit 20";
|
||||
|
||||
$stmt = $db->prepare($dbquery);
|
||||
$stmt->bindValue(":from", intval($_GET['from']), SQLITE3_INTEGER);
|
||||
$stmt->bindValue(":until", intval($_GET['until']), SQLITE3_INTEGER);
|
||||
$results = $stmt->execute();
|
||||
|
||||
Reference in New Issue
Block a user