From e4dc7b69f21dbc9a2b6ded9647130c29a16222cf Mon Sep 17 00:00:00 2001 From: Junior Date: Sat, 10 Jan 2026 16:24:12 -0500 Subject: [PATCH] Update to show zone ID on device list --- ajax/getdevices.php | 3 ++- boardstatus.php | 12 ++++++++++++ js/minimal.js | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/ajax/getdevices.php b/ajax/getdevices.php index f64a071..3c6ae55 100644 --- a/ajax/getdevices.php +++ b/ajax/getdevices.php @@ -2,7 +2,7 @@ require "../header.php"; -$query = "SELECT mac, ipaddress, label, board, firmware, service, lastupdate FROM devices ORDER BY label, lastupdate DESC"; +$query = "SELECT mac, ipaddress, label, board, firmware, service, zoneid, lastupdate FROM devices ORDER BY label, lastupdate DESC"; $sth = $globaldbh->prepare($query); $sth->execute(); @@ -15,6 +15,7 @@ while ( $row = $sth->fetch(PDO::FETCH_ASSOC) ) { $d["board"] = $row["board"]; $d["firmware"] = $row["firmware"]; $d["service"] = $row["service"]; + $d["zoneid"] = $row["zoneid"]; $d["lastupdate"] = $row["lastupdate"]; $data[] = $d; } diff --git a/boardstatus.php b/boardstatus.php index 3b1a556..6744c42 100644 --- a/boardstatus.php +++ b/boardstatus.php @@ -27,4 +27,16 @@ $sth->bindValue(":firmware", $firmware, PDO::PARAM_STR); $sth->bindValue(":service", $service, PDO::PARAM_STR); $sth->execute(); +$query = "SELECT zoneid FROM devices WHERE mac=:mac"; +$sth = $globaldbh->prepare($query); +$sth->bindValue(":mac", $mac, PDO::PARAM_STR); +$sth->execute(); + +$zoneid = 0; +if ( $row = $sth->fetch(PDO::FETCH_ASSOC) ) { + $zoneid = $row["zoneid"]; +} +echo($zoneid); + + exit(); diff --git a/js/minimal.js b/js/minimal.js index d97da5f..bbef413 100755 --- a/js/minimal.js +++ b/js/minimal.js @@ -75,6 +75,7 @@ function getDevices() { html += "
"; html += "
Service:" + escapeHTML(device.service) + "
"; html += "
Label:" + escapeHTML(device.label) + "
"; + html += "
ZoneId:" + device.zoneid + "
"; html += "
Board:" + escapeHTML(device.board) + "
"; html += "
IP Address:" + escapeHTML(device.ipaddress) + "
"; html += "
Last Update:" + escapeHTML(device.lastupdate) + "
";