diff --git a/html/includes/hostbox.inc b/html/includes/hostbox.inc index 41ca28b54..0b96aabcd 100644 --- a/html/includes/hostbox.inc +++ b/html/includes/hostbox.inc @@ -20,7 +20,7 @@ $device[version] $device[hardware]
$device[features] - " . formatUptime($device[uptime]) . " + " . formatUptime($device[device_uptime]) . "
$device[location] diff --git a/html/pages/devices.php b/html/pages/devices.php index 436724a07..4e1b33117 100644 --- a/html/pages/devices.php +++ b/html/pages/devices.php @@ -3,29 +3,18 @@ if($_GET['ignore']) { mysql_query("UPDATE devices SET `ignore` = '1' WHERE `id` = '$_GET[ignore]'"); } if($_GET['unignore']) { mysql_query("UPDATE devices SET `ignore` = '0' WHERE `id` = '$_GET[unignore]'"); } -if($_GET['location']) { $where = "WHERE location = '$_GET[location]'"; } -if($_GET['location'] == "Unset") { $where = "WHERE location = ''"; } -if($_GET['type']) { $where = "WHERE type = '$_GET[type]'"; } -if($_GET['status'] == "alerted") { $where = $device_alert_sql; } +if($_GET['location']) { $where = "AND location = '$_GET[location]'"; } +if($_GET['location'] == "Unset") { $where = "AND location = ''"; } +if($_GET['type']) { $where = "AND type = '$_GET[type]'"; } +$sql = "select * from devices AS D, device_uptime AS U WHERE D.id = U.device_id $where ORDER BY `ignore`, `status`, `os`, `hostname`"; +if($_GET['status'] == "alerted") { $sql = "select *, D.id as id from devices AS D, device_uptime AS U WHERE D.id = U.device_id " . str_replace("WHERE", "OR", $device_alert_sql) . " GROUP BY `id` ORDER BY `ignore`, `status`, `os`, `hostname`"; } -$sql = "select * from devices $where ORDER BY `ignore`, STATUS, os, hostname"; $device_query = mysql_query($sql); echo(""); -//echo(" -// -// -// -// -// -// -//"); - while($device = mysql_fetch_array($device_query)) { - include("includes/hostbox.inc"); - } echo("
Hostname - DescriptionOperating System - VersionHardware - FeaturesUptime - Location
"); diff --git a/html/pages/locations.php b/html/pages/locations.php index dcf0e8f7c..c143a98ca 100644 --- a/html/pages/locations.php +++ b/html/pages/locations.php @@ -19,7 +19,7 @@ while($device = mysql_fetch_array($device_query)) { if($loc != "") { echo(" - +
$loc$loc $alert $num devices $net network