= '5') {
$sql = "SELECT * FROM `temperature` AS T, `devices` AS D WHERE T.temp_host = D.device_id ORDER BY D.hostname, T.temp_descr";
} else {
$sql = "SELECT * FROM `temperature` AS T, `devices` AS D, devices_perms as P WHERE T.temp_host = D.device_id AND D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' ORDER BY D.hostname, T.temp_descr";
}
$query = mysql_query($sql);
echo("
");
echo("
| Device |
Sensor |
Current |
Alert |
Notes |
");
$row = 1;
while($temp = mysql_fetch_array($query)) {
if(is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
$speed = humanspeed($temp['ifSpeed']);
$type = humanmedia($temp['ifType']);
$temp_url = "graph.php?id=" . $temp['temp_id'] . "&type=temp&from=$week&to=$now&width=400&height=150";
$temp_popup = "', LEFT);\" onmouseout=\"return nd();\">
" . $temp['temp_descr'] . " ";
$temp_perc = $temp['temp_current'] / $temp['temp_limit'] * 100;
$temp_colour = percent_colour($temp_perc);
echo("
| " . generatedevicelink($temp) . " |
$temp_popup |
" . $temp['temp_current'] . " |
" . $temp['temp_limit'] . " |
" . $temp['temp_notes'] . " |
\n");
$row++;
}
echo("
");
?>