From 4aea8999cb79eef5734d3ae49565dcf0486fbaab Mon Sep 17 00:00:00 2001 From: DL6ER Date: Tue, 11 Jun 2019 00:18:54 +0200 Subject: [PATCH] Offer multiple IP addresses through API if available Signed-off-by: DL6ER --- api_db.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/api_db.php b/api_db.php index 00c6ba2e..bd23e828 100644 --- a/api_db.php +++ b/api_db.php @@ -71,7 +71,16 @@ if(isset($_GET["network"]) && $auth) $results = $db->query('SELECT * FROM network'); while($results !== false && $res = $results->fetchArray(SQLITE3_ASSOC)) + { + $id = $res["id"]; + $ipaddr = array(); + $ips = $db->query("SELECT ip FROM network_addresses WHERE id = $id"); + while($ips !== false && $ip = $ips->fetchArray(SQLITE3_ASSOC)) + array_push($ipaddr,$ip["ip"]); + if(count($ipaddr) > 0) + $res["ip"] = $ipaddr; array_push($network, $res); + } $data = array_merge($data, array('network' => $network)); }