Remove fallback to ip column in network table as we removed this column in DB version 5. There will always be a corresponding entry for each device in the network table.

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2019-06-16 12:30:11 +02:00
parent 9ba59b9ef3
commit 99a53fcfd4

View File

@@ -73,17 +73,12 @@ if(isset($_GET["network"]) && $auth)
while($results !== false && $res = $results->fetchArray(SQLITE3_ASSOC))
{
$id = $res["id"];
// Backup IP column of this request in case we want to reuse it further down
$resip = $res["ip"];
// Empty array for holding the IP addresses
$res["ip"] = array();
// Get IP addresses for this device
$ips = $db->query("SELECT ip FROM network_addresses WHERE network_id = $id ORDER BY lastSeen DESC");
while($ips !== false && $ip = $ips->fetchArray(SQLITE3_ASSOC))
$network_addresses = $db->query("SELECT ip FROM network_addresses WHERE network_id = $id ORDER BY lastSeen DESC");
while($network_addresses !== false && $ip = $network_addresses->fetchArray(SQLITE3_ASSOC))
array_push($res["ip"],$ip["ip"]);
// If the network_addresses table does not contain any IPs for this client, we use the IP stored in the network table
if(count($res["ip"]) < 1)
array_push($res["ip"],$resip);
array_push($network, $res);
}