2007-04-03 14:10:23 +00:00
< ? php
2007-06-24 14:56:47 +00:00
if ( $_GET [ 'status' ] == '0' ) { $where = " AND service_status = '0' " ; } else { unset ( $where ); }
2007-04-03 14:10:23 +00:00
echo ( " <div style='margin: 5px;'><table cellpadding=7 border=0 cellspacing=0 width=100%> " );
//echo("<tr class=interface-desc bgcolor='#e5e5e5'><td>Device</td><td>Service</td><td>Status</td><td>Changed</td><td>Checked</td><td>Message</td></tr>");
2007-06-24 14:56:47 +00:00
if ( $_SESSION [ 'userlevel' ] == '10' ) {
2007-04-08 18:09:21 +00:00
$host_sql = " SELECT * FROM devices AS D, services AS S WHERE D.device_id = S.service_host GROUP BY D.hostname ORDER BY D.hostname " ;
2007-06-24 14:56:47 +00:00
} else {
$host_sql = " SELECT * FROM devices AS D, services AS S, devices_perms AS P WHERE D.device_id = S.service_host AND D.device_id = P.device_id AND P.user_id = ' " . $_SESSION [ 'user_id' ] . " ' $where GROUP BY D.hostname ORDER BY D.hostname " ;
}
2007-04-03 14:10:23 +00:00
$host_query = mysql_query ( $host_sql );
while ( $host_data = mysql_fetch_array ( $host_query )) {
2007-04-08 18:09:21 +00:00
$device_id = $host_data [ 'device_id' ];
$device_hostname = $host_data [ 'hostname' ];
$service_query = mysql_query ( " SELECT * FROM `services` WHERE `service_host` = ' " . $host_data [ 'device_id' ] . " ' $where " );
2007-04-03 14:10:23 +00:00
while ( $service = mysql_fetch_array ( $service_query )) {
include ( " includes/print-service.inc " );
$samehost = 1 ;
}
unset ( $samehost );
}
echo ( " </table></div> " );
?>