diff --git a/html/includes/functions.inc.php b/html/includes/functions.inc.php index 15e77f18a4..cc476545df 100644 --- a/html/includes/functions.inc.php +++ b/html/includes/functions.inc.php @@ -1,5 +1,18 @@ = '5') { $device_query = mysql_query($sql); while($device = mysql_fetch_array($device_query)) { - if(!isset($bg) || $bg == "#ffffff") { $bg = "#eeeeee"; } else { $bg="#ffffff"; } + if(!isset($bg) || $bg == "#ffffff") { $bg = "#eeeeee"; } else { $bg="#ffffff"; } - if($_SESSION['userlevel'] == '10') { - $num = mysql_result(mysql_query("SELECT COUNT(device_id) FROM devices WHERE location = '" . $device['location'] . "'"),0); - $net = mysql_result(mysql_query("SELECT COUNT(device_id) FROM devices WHERE location = '" . $device['location'] . "' AND type = 'network'"),0); - $srv = mysql_result(mysql_query("SELECT COUNT(device_id) FROM devices WHERE location = '" . $device['location'] . "' AND type = 'server'"),0); - $fwl = mysql_result(mysql_query("SELECT COUNT(device_id) FROM devices WHERE location = '" . $device['location'] . "' AND type = 'firewall'"),0); - $hostalerts = mysql_result(mysql_query("SELECT COUNT(device_id) FROM devices WHERE location = '" . $device['location'] . "' AND status = '0'"),0); - } else { - $num = mysql_result(mysql_query("SELECT COUNT(D.device_id) FROM devices AS D, devices_perms AS P WHERE D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' AND location = '" . $device['location'] . "'"),0); - $net = mysql_result(mysql_query("SELECT COUNT(D.device_id) FROM devices AS D, devices_perms AS P WHERE D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' AND location = '" . $device['location'] . "' AND D.type = 'network'"),0); - $srv = mysql_result(mysql_query("SELECT COUNT(D.device_id) FROM devices AS D, devices_perms AS P WHERE D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' AND location = '" . $device['location'] . "' AND type = 'server'"),0); - $fwl = mysql_result(mysql_query("SELECT COUNT(D.device_id) FROM devices AS D, devices_perms AS P WHERE D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' AND location = '" . $device['location'] . "' AND type = 'firewall'"),0); - $hostalerts = mysql_result(mysql_query("SELECT COUNT(device_id) FROM devices AS D, devices_perms AS P WHERE location = '" . $device['location'] . "' AND status = '0'"),0); - } + if($_SESSION['userlevel'] == '10') { + $num = mysql_result(mysql_query("SELECT COUNT(device_id) FROM devices WHERE location = '" . $device['location'] . "'"),0); + $net = mysql_result(mysql_query("SELECT COUNT(device_id) FROM devices WHERE location = '" . $device['location'] . "' AND type = 'network'"),0); + $srv = mysql_result(mysql_query("SELECT COUNT(device_id) FROM devices WHERE location = '" . $device['location'] . "' AND type = 'server'"),0); + $fwl = mysql_result(mysql_query("SELECT COUNT(device_id) FROM devices WHERE location = '" . $device['location'] . "' AND type = 'firewall'"),0); + $hostalerts = mysql_result(mysql_query("SELECT COUNT(device_id) FROM devices WHERE location = '" . $device['location'] . "' AND status = '0'"),0); + } else { + $num = mysql_result(mysql_query("SELECT COUNT(D.device_id) FROM devices AS D, devices_perms AS P WHERE D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' AND location = '" . $device['location'] . "'"),0); + $net = mysql_result(mysql_query("SELECT COUNT(D.device_id) FROM devices AS D, devices_perms AS P WHERE D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' AND location = '" . $device['location'] . "' AND D.type = 'network'"),0); + $srv = mysql_result(mysql_query("SELECT COUNT(D.device_id) FROM devices AS D, devices_perms AS P WHERE D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' AND location = '" . $device['location'] . "' AND type = 'server'"),0); + $fwl = mysql_result(mysql_query("SELECT COUNT(D.device_id) FROM devices AS D, devices_perms AS P WHERE D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' AND location = '" . $device['location'] . "' AND type = 'firewall'"),0); + $hostalerts = mysql_result(mysql_query("SELECT COUNT(device_id) FROM devices AS D, devices_perms AS P WHERE location = '" . $device['location'] . "' AND status = '0'"),0); + } if($hostalerts) { $alert = 'alert'; } else { $alert = ""; }