fixing things!

git-svn-id: http://www.observium.org/svn/observer/trunk@55 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2007-04-04 10:43:23 +00:00
parent fb5f32b4e4
commit d4bfb35389
5 changed files with 32 additions and 42 deletions
+11 -5
View File
@@ -1,16 +1,22 @@
<?php
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`"; }
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]'"; }
$sql = "select * from devices $where ORDER BY `ignore`, `status`, `os`, `hostname`";
if($_GET['status'] == "alerted") { $sql = "select * from devices " . $device_alert_sql . " GROUP BY `id` ORDER BY `ignore`, `status`, `os`, `hostname`"; }
$device_query = mysql_query($sql);
echo("<table cellpadding=7 cellspacing=0 class=devicetable width=100%>");
while($device = mysql_fetch_array($device_query)) {
$device[uptime] = @mysql_result(mysql_query("SELECT device_uptime FROM device_uptime WHERE device_id = '" . $device[id] ."'" ), 0);
include("includes/hostbox.inc");
}