some formatting cleanups, introduce some more FIXMEs to look at, plus replace mysql_fetch_array by mysql_fetch_assoc, for great justice

git-svn-id: http://www.observium.org/svn/observer/trunk@2029 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans
2011-04-06 13:54:50 +00:00
parent 51e242b896
commit f55a30f744
163 changed files with 476 additions and 460 deletions

View File

@@ -6,7 +6,7 @@ include("config.php");
include("includes/functions.php");
$alert_query = mysql_query("SELECT *, A.id as id FROM `alerts` as A, `devices` as D where A.device_id = D.device_id AND alerted = '0'");
while ($alert = mysql_fetch_array($alert_query))
while ($alert = mysql_fetch_assoc($alert_query))
{
$id = $alert['id'];
$host = $alert['hostname'];

View File

@@ -13,7 +13,7 @@ $i = '0';
$interface_query = mysql_query("SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id $where");
while ($interface = mysql_fetch_array($interface_query))
while ($interface = mysql_fetch_assoc($interface_query))
{
$errors = $interface['ifInErrors_delta'] + $interface['ifOutErrors_delta'];
if ($errors > '1')

View File

@@ -7,7 +7,7 @@ include("includes/functions.php");
$sql = "SELECT * FROM devices AS D, services AS S WHERE S.device_id = D.device_id ORDER by D.device_id DESC";
$query = mysql_query($sql);
while ($service = mysql_fetch_array($query))
while ($service = mysql_fetch_assoc($query))
{
if ($service['status'] = "1")
{

View File

@@ -12,7 +12,7 @@ $query = "SELECT *,A.id as id FROM ipv4_addresses AS A, ports as I, devices as D
$data = mysql_query($query);
while ($row = mysql_fetch_array($data))
while ($row = mysql_fetch_assoc($data))
{
$addr = Net_IPv4::parseAddress($row['ipv4_address']."/".$row['ipv4_prefixlen']);
$mask = $addr->netmask;
@@ -31,7 +31,7 @@ while ($row = mysql_fetch_array($data))
$sql = "SELECT * FROM devices WHERE status = '1'";
$query = mysql_query($sql);
while ($device = mysql_fetch_array($query))
while ($device = mysql_fetch_assoc($query))
{
echo($device['hostname'] . " \n\n");
@@ -51,7 +51,7 @@ while ($device = mysql_fetch_array($query))
$sql = "SELECT * FROM ip6addr AS A, ports AS I, devices as D WHERE A.interface_id = I.interface_id AND I.device_id = '".$device['device_id']."'";
$data = mysql_query($sql);
while ($row = mysql_fetch_array($data))
while ($row = mysql_fetch_assoc($data))
{
echo($row['ipv6_address'] . "\n");
unset($valid);
@@ -66,7 +66,7 @@ while ($device = mysql_fetch_array($query))
$query = "SELECT * FROM ports AS I, devices as D WHERE I.device_id = D.device_id AND D.status = '1'";
$data = mysql_query($query);
while ($row = mysql_fetch_array($data))
while ($row = mysql_fetch_assoc($data))
{
$index = $row['ifIndex'];
@@ -87,7 +87,7 @@ while ($row = mysql_fetch_array($data))
echo(mysql_result(mysql_query("SELECT COUNT(*) FROM `ports`"), 0) . " ports at start\n");
$interface_query = mysql_query("SELECT interface_id,device_id FROM `ports`");
while ($interface = mysql_fetch_array($interface_query))
while ($interface = mysql_fetch_assoc($interface_query))
{
$device_id = $interface['device_id'];
$interface_id = $interface['interface_id'];
@@ -103,7 +103,7 @@ echo(mysql_result(mysql_query("SELECT COUNT(*) FROM `ports`"), 0) . " ports at e
echo(mysql_result(mysql_query("SELECT COUNT(id) FROM `links`"), 0) . " links at start\n");
$link_query = mysql_query("SELECT id,local_interface_id,remote_interface_id FROM `links`");
while ($link = mysql_fetch_array($link_query))
while ($link = mysql_fetch_assoc($link_query))
{
$id = $link['id'];
$src = $link['local_interface_id'];
@@ -119,7 +119,7 @@ echo(mysql_result(mysql_query("SELECT COUNT(id) FROM `links`"), 0) . " links at
echo(mysql_result(mysql_query("SELECT COUNT(adj_id) FROM `adjacencies`"), 0) . " adjacencies at start\n");
$link_query = mysql_query("SELECT * FROM `adjacencies` AS A, `ports` AS I, `devices` AS D, networks AS N WHERE I.interface_id = A.interface_id AND D.device_id = I.device_id AND N.id = A.network_id");
while ($link = mysql_fetch_array($link_query))
while ($link = mysql_fetch_assoc($link_query))
{
$id = $link['adj_id'];
$netid = $link['network_id'];

View File

@@ -93,7 +93,7 @@ if (file_exists('.svn'))
list(,$dbu_rev) = preg_split('/: /',@shell_exec('svn info database-update.sql|grep ^Revision'));
$device_query = mysql_query("SELECT revision FROM `dbSchema`");
if ($rev = @mysql_fetch_array($device_query))
if ($rev = @mysql_fetch_assoc($device_query))
{
$db_rev = $rev['revision'];
}
@@ -146,7 +146,7 @@ if (file_exists('.svn'))
$discovered_devices = 0;
$device_query = mysql_query("SELECT * FROM `devices` WHERE status = 1 AND disabled = 0 $where ORDER BY device_id DESC");
while ($device = mysql_fetch_array($device_query))
while ($device = mysql_fetch_assoc($device_query))
{
$device_start = utime(); // Start counting device poll time

View File

@@ -8,7 +8,7 @@ include("includes/functions.php");
$handle = fopen("ips.txt", "w");
$query = mysql_query("SELECT * FROM `ipv4_networks`");
while ($data = mysql_fetch_array($query))
while ($data = mysql_fetch_assoc($query))
{
$cidr = $data['ipv4_network'];
list ($network, $bits) = explode("/", $cidr);

View File

@@ -21,7 +21,7 @@ if (!$_SESSION['authenticated']) { echo("unauthenticated"); exit; }
if (is_numeric($_GET['device_id']))
{
$ports = mysql_query("SELECT * FROM ports WHERE device_id = '".$_GET['device_id']."'");
while ($interface = mysql_fetch_array($ports))
while ($interface = mysql_fetch_assoc($ports))
{
echo("obj.options[obj.options.length] = new Option('".$interface['ifDescr']." - ".$interface['ifAlias']."','".$interface['interface_id']."');\n");
}

View File

@@ -58,7 +58,7 @@ $rate_95th = $rate_data['rate_95th'] * 1000;
$rate_average = $rate_data['rate_average'] * 1000;
$bi_q = mysql_query("SELECT * FROM bills WHERE bill_id = $bill_id");
$bi_a = mysql_fetch_array($bi_q);
$bi_a = mysql_fetch_assoc($bi_q);
$bill_name = $bi_a['bill_name'];
$countsql = mysql_query("SELECT count(`delta`) FROM `bill_data` WHERE `bill_id` = '$bill_id' AND `timestamp` >= '$datefrom' AND `timestamp` <= '$dateto'");
@@ -84,7 +84,7 @@ $dur = $end - $start;
$sql = "SELECT *, UNIX_TIMESTAMP(timestamp) AS formatted_date FROM bill_data WHERE bill_id = $bill_id AND timestamp >= $datefrom AND timestamp <= $dateto ORDER BY timestamp ASC";
$data = mysql_query($sql);
while ($row = mysql_fetch_array($data))
while ($row = mysql_fetch_assoc($data))
{
@$timestamp = $row['formatted_date'];
if (!$first) { $first = $timestamp; }

View File

@@ -10,7 +10,7 @@ function authenticate($username,$password)
$sql = "SELECT username FROM `users` WHERE `username`='".$_SESSION['username'] . "'";;
$query = mysql_query($sql);
$row = @mysql_fetch_array($query);
$row = @mysql_fetch_assoc($query);
if ($row['username'] && $row['username'] == $_SESSION['username'])
{
return 1;
@@ -54,14 +54,14 @@ function user_exists($username)
function get_userlevel($username)
{
$sql = "SELECT level FROM `users` WHERE `username`='".mres($username)."'";
$row = mysql_fetch_array(mysql_query($sql));
$row = mysql_fetch_assoc(mysql_query($sql));
return $row['level'];
}
function get_userid($username)
{
$sql = "SELECT user_id FROM `users` WHERE `username`='".mres($username)."'";
$row = mysql_fetch_array(mysql_query($sql));
$row = mysql_fetch_assoc(mysql_query($sql));
return $row['user_id'];
}

View File

@@ -68,7 +68,7 @@ function get_userlevel($username)
{
# FIXME should come from LDAP
$sql = "SELECT level FROM `users` WHERE `username`='".mres($username)."'";
$row = mysql_fetch_array(mysql_query($sql));
$row = mysql_fetch_assoc(mysql_query($sql));
return $row['level'];
}
@@ -76,7 +76,7 @@ function get_userid($username)
{
# FIXME should come from LDAP
$sql = "SELECT user_id FROM `users` WHERE `username`='".mres($username)."'";
$row = mysql_fetch_array(mysql_query($sql));
$row = mysql_fetch_assoc(mysql_query($sql));
return $row['user_id'];
}

View File

@@ -84,14 +84,14 @@ function user_exists($username)
function get_userlevel($username)
{
$sql = "SELECT level FROM `users` WHERE `username`='".mres($username)."'";
$row = mysql_fetch_array(mysql_query($sql));
$row = mysql_fetch_assoc(mysql_query($sql));
return $row['level'];
}
function get_userid($username)
{
$sql = "SELECT user_id FROM `users` WHERE `username`='".mres($username)."'";
$row = mysql_fetch_array(mysql_query($sql));
$row = mysql_fetch_assoc(mysql_query($sql));
return $row['user_id'];
}

View File

@@ -1,16 +1,15 @@
<?php
if ($_GET['id'] && is_numeric($_GET['id'])) { $atm_vp_id = $_GET['id']; }
$sql = "SELECT * FROM `juniAtmVp` as J, `ports` AS I, `devices` AS D";
$sql .= " WHERE J.juniAtmVp_id = '".$atm_vp_id."' AND I.interface_id = J.interface_id AND I.device_id = D.device_id";
$query = mysql_query($sql);
$vp = mysql_fetch_array($query);
if ($config['allow_unauth_graphs'] || port_permitted($vp['interface_id'])) {
$vp = mysql_fetch_assoc($query);
if ($config['allow_unauth_graphs'] || port_permitted($vp['interface_id']))
{
$port = $vp;
$device = device_by_id_cache($port['device_id']);
$title = generate_device_link($device);
@@ -18,7 +17,6 @@ if ($config['allow_unauth_graphs'] || port_permitted($vp['interface_id'])) {
$title .= " :: VP ".$vp['vp_id'];
$auth = TRUE;
$rrd_filename = $config['rrd_dir'] . "/" . $vp['hostname'] . "/" . safename("vp-" . $vp['ifIndex'] . "-".$vp['vp_id'].".rrd");
}
?>

View File

@@ -4,7 +4,7 @@
$i = 0;
while ($port = mysql_fetch_array($ports))
while ($port = mysql_fetch_assoc($ports))
{
if (is_file($config['rrd_dir'] . "/" . $port['hostname'] . "/port-" . safename($port['ifIndex'] . ".rrd")))
{

View File

@@ -1,6 +1,6 @@
<?php
$sensor = mysql_fetch_array(mysql_query("SELECT * FROM entPhysical as E, devices as D WHERE entPhysical_id = '".mres($_GET['a'])."' and D.device_id = E.device_id"));
$sensor = mysql_fetch_assoc(mysql_query("SELECT * FROM entPhysical as E, devices as D WHERE entPhysical_id = '".mres($_GET['a'])."' and D.device_id = E.device_id"));
switch ($sensor['entSensorType'])
{

View File

@@ -3,7 +3,7 @@
## Generate a list of ports and then call the multi_bits grapher to generate from the list
$query = mysql_query("SELECT * FROM `ports` AS I, `devices` AS D WHERE `port_descr_type` = 'cust' AND `port_descr_descr` = '".mres($_GET['id'])."' AND D.device_id = I.device_id");
while ($int = mysql_fetch_array($query))
while ($int = mysql_fetch_assoc($query))
{
if (is_file($config['rrd_dir'] . "/" . $int['hostname'] . "/port-" . safename($int['ifIndex'] . ".rrd")))
{

View File

@@ -8,7 +8,7 @@ $rrd_options .= " -l 0 -E ";
$iter = "1";
$sql = mysql_query("SELECT * FROM sensors WHERE sensor_class='current' AND device_id = '$id'");
$rrd_options .= " COMMENT:' Cur Min Max\\n'";
while ($current = mysql_fetch_array($sql))
while ($current = mysql_fetch_assoc($sql))
{
switch ($iter)
{

View File

@@ -6,7 +6,7 @@ if ($_GET['device']) { $id = mres($_GET['device']); }
$i = 1;
$query = mysql_query("SELECT * FROM `ucd_diskio` AS U, `devices` AS D WHERE D.device_id = '".$id."' AND U.device_id = D.device_id");
while ($disk = mysql_fetch_array($query))
while ($disk = mysql_fetch_assoc($query))
{
$rrd_filename = $config['rrd_dir'] . "/" . $disk['hostname'] . "/ucd_diskio-" . safename($disk['diskio_descr'] . ".rrd");
if (is_file($rrd_filename))

View File

@@ -7,7 +7,7 @@ $i = 1;
$query = mysql_query("SELECT * FROM `ucd_diskio` AS U, `devices` AS D WHERE D.device_id = '".$id."' AND U.device_id = D.device_id");
while ($disk = mysql_fetch_array($query))
while ($disk = mysql_fetch_assoc($query))
{
$rrd_filename = $config['rrd_dir'] . "/" . $disk['hostname'] . "/ucd_diskio-" . safename($disk['diskio_descr'] . ".rrd");
if (is_file($rrd_filename))

View File

@@ -10,7 +10,8 @@ $iter = "1";
$sql = mysql_query("SELECT * FROM sensors WHERE sensor_class='fanspeed' AND device_id = '$id'");
$rrd_options .= " COMMENT:'RPM Cur Min Max\\n'";
while ($fanspeed = mysql_fetch_array($sql))
# FIXME generic colour function
while ($fanspeed = mysql_fetch_assoc($sql))
{
switch ($iter)
{

View File

@@ -8,8 +8,10 @@ $rrd_options .= " -l 0 -E ";
$iter = "1";
$sql = mysql_query("SELECT * FROM sensors WHERE sensor_class='freq' AND device_id = '$id'");
$rrd_options .= " COMMENT:' Cur Min Max\\n'";
while ($frequency = mysql_fetch_array($sql))
while ($frequency = mysql_fetch_assoc($sql))
{
# FIXME generic colour function
switch ($iter)
{
case "1":

View File

@@ -8,8 +8,9 @@ $rrd_options .= " -l 0 -E ";
$iter = "1";
$sql = mysql_query("SELECT * FROM sensors WHERE sensor_class='humidity' AND device_id = '$id' ORDER BY sensor_index");
$rrd_options .= " COMMENT:' Cur Min Max\\n'";
while ($humidity = mysql_fetch_array($sql))
while ($humidity = mysql_fetch_assoc($sql))
{
# FIXME generic colour function
switch ($iter)
{
case "1":

View File

@@ -10,8 +10,9 @@ $rrd_options .= " -u 100 -l 0 -E -b 1024 ";
$iter = "1"; $i=1;
$rrd_options .= " COMMENT:' Min Cur Max\\n'";
while ($mempool = mysql_fetch_array($query))
while ($mempool = mysql_fetch_assoc($query))
{
# FIXME generic colour function
if ($iter=="1") { $colour="CC0000"; } elseif ($iter=="2") { $colour="008C00"; } elseif ($iter=="3") { $colour="4096EE"; }
elseif ($iter=="4") { $colour="73880A"; } elseif ($iter=="5") { $colour="D01F3C"; } elseif ($iter=="6") { $colour="36393D"; }
elseif ($iter=="7") { $colour="FF0084"; unset($iter); }

View File

@@ -5,7 +5,7 @@ $query = mysql_query("SELECT * FROM `processors` where `device_id` = '".$id."'")
$i = 0;
while ($proc = mysql_fetch_array($query))
while ($proc = mysql_fetch_assoc($query))
{
$rrd_filename = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("processor-" . $proc['processor_type'] . "-" . $proc['processor_index'] . ".rrd");

View File

@@ -11,8 +11,9 @@ $iter = "1";
$sql = mysql_query("SELECT * FROM storage where device_id = '$id'");
$rrd_options .= " COMMENT:' Size Used %age\\l'";
while ($storage = mysql_fetch_array($sql))
while ($storage = mysql_fetch_assoc($sql))
{
# FIXME generic colour function
if ($iter=="1") { $colour="CC0000"; } elseif ($iter=="2") { $colour="008C00"; } elseif ($iter=="3") { $colour="4096EE"; }
elseif ($iter=="4") { $colour="73880A"; } elseif ($iter=="5") { $colour="D01F3C"; } elseif ($iter=="6") { $colour="36393D"; }
elseif ($iter=="7") { $colour="FF0084"; $iter = "0"; }

View File

@@ -9,8 +9,9 @@ $rrd_options .= " -l 0 -E ";
$iter = "1";
$sql = mysql_query("SELECT * FROM sensors WHERE sensor_class='temperature' AND device_id = '$id' ORDER BY sensor_index");
$rrd_options .= " COMMENT:'".str_pad('',$descr_len)." Cur Min Max\\n'";
while ($temperature = mysql_fetch_array($sql))
while ($temperature = mysql_fetch_assoc($sql))
{
# FIXME generic colour function
switch ($iter)
{
case "1":

View File

@@ -8,8 +8,9 @@ $rrd_options .= " -l 0 -E ";
$iter = "1";
$sql = mysql_query("SELECT * FROM toner where device_id = '$id'");
$rrd_options .= " COMMENT:'Toner level Cur Min Max\\n'";
while ($toner = mysql_fetch_array($sql))
while ($toner = mysql_fetch_assoc($sql))
{
# FIXME generic colour function
switch ($iter)
{
case "1":

View File

@@ -10,8 +10,9 @@ $rrd_options .= " COMMENT:'".str_pad('',$descr_len)." Cur Min Max\\
$iter = "1";
$sql = mysql_query("SELECT * FROM sensors WHERE sensor_class='voltage' AND device_id = '$id'");
while ($sensor = mysql_fetch_array($sql))
while ($sensor = mysql_fetch_assoc($sql))
{
# FIXME generic colour function
switch ($iter)
{
case "1":

View File

@@ -3,7 +3,7 @@
if (is_numeric($id))
{
$query = mysql_query("SELECT * FROM `ucd_diskio` AS U, `devices` AS D WHERE U.diskio_id = '".$id."' AND U.device_id = D.device_id");
$disk = mysql_fetch_array($query);
$disk = mysql_fetch_assoc($query);
if (is_numeric($disk['device_id']) && ($config['allow_unauth_graphs'] || device_permitted($disk['device_id'])))
{

View File

@@ -4,7 +4,7 @@ if ($_GET['id']) { $id = $_GET['id']; }
$query = mysql_query("SELECT * FROM `ucd_diskio` AS U, `devices` AS D WHERE U.diskio_id = '".$id."' AND U.device_id = D.device_id");
$disk = mysql_fetch_array($query);
$disk = mysql_fetch_assoc($query);
if (is_file($config['rrd_dir'] . "/" . $disk['hostname'] . "/ucd_diskio-" . safename($disk['diskio_descr'] . ".rrd")))
{

View File

@@ -35,10 +35,8 @@ $vertical = mres($_GET['vertical']);
$legend = mres($_GET['legend']);
$id = mres($_GET['id']);
if ($config['allow_unauth_graphs'])
if (!$config['allow_unauth_graphs'])
{
$allow_unauth = TRUE;
} else {
if (!$_SESSION['authenticated']) { graph_error("Not authenticated"); exit; }
}

View File

@@ -5,7 +5,7 @@ $i = 0;
foreach (explode(",", $id) as $ifid)
{
$query = mysql_query("SELECT * FROM `ports` AS I, devices as D WHERE I.interface_id = '" . mres($ifid) . "' AND I.device_id = D.device_id");
$port = mysql_fetch_array($query);
$port = mysql_fetch_assoc($query);
if (is_file($config['rrd_dir'] . "/" . $port['hostname'] . "/port-" . safename($port['ifIndex'] . ".rrd")))
{
$rrd_list[$i]['filename'] = $config['rrd_dir'] . "/" . $port['hostname'] . "/port-" . safename($port['ifIndex'] . ".rrd");

View File

@@ -6,7 +6,7 @@ include("includes/graphs/common.inc.php");
$rrd_options .= " COMMENT:' Last Max\\n'";
$fanspeed = mysql_fetch_array(mysql_query("SELECT * FROM sensors WHERE sensor_class='fanspeed' AND sensor_id = '".mres($_GET['id'])."'"));
$fanspeed = mysql_fetch_assoc(mysql_query("SELECT * FROM sensors WHERE sensor_class='fanspeed' AND sensor_id = '".mres($_GET['id'])."'"));
$hostname = mysql_result(mysql_query("SELECT hostname FROM devices WHERE device_id = '" . $fanspeed['device_id'] . "'"),0);

View File

@@ -3,7 +3,7 @@
$query = mysql_query("SELECT * FROM `mac_accounting` AS M, `ports` AS I, `devices` AS D WHERE M.ma_id = '".mres($_GET['id'])."'
AND I.interface_id = M.interface_id AND I.device_id = D.device_id");
$acc = mysql_fetch_array($query);
$acc = mysql_fetch_assoc($query);
if (is_file($config['rrd_dir'] . "/" . $acc['hostname'] . "/" . safename("cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd")))
{
$rrd_filename = $config['rrd_dir'] . "/" . $acc['hostname'] . "/". safename("cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd");

View File

@@ -3,7 +3,7 @@
$query = mysql_query("SELECT * FROM `mac_accounting` AS M, `ports` AS I, `devices` AS D WHERE M.ma_id = '".mres($_GET['id'])."'
AND I.interface_id = M.interface_id AND I.device_id = D.device_id");
$acc = mysql_fetch_array($query);
$acc = mysql_fetch_assoc($query);
if (is_file($config['rrd_dir'] . "/" . $acc['hostname'] . "/" . safename("cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd")))
{
$rrd_filename = $config['rrd_dir'] . "/" . $acc['hostname'] . "/" . safename("cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd");

View File

@@ -43,19 +43,19 @@ $query = mysql_query($sql);
$pluses = ""; $iter = '0';
$rrd_options .= " COMMENT:' In\: Current Maximum Total Out\: Current Maximum Total\\\\n'";
while ($acc = mysql_fetch_array($query))
while ($acc = mysql_fetch_assoc($query))
{
$this_rrd = $config['rrd_dir'] . "/" . $acc['hostname'] . "/" . safename("cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd");
if (is_file($this_rrd))
{
$mac = formatmac($acc['mac']);
$name = $mac;
$addy = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_mac where mac_address = '".$acc['mac']."' AND interface_id = '".$acc['interface_id']."'"));
$addy = mysql_fetch_assoc(mysql_query("SELECT * FROM ipv4_mac where mac_address = '".$acc['mac']."' AND interface_id = '".$acc['interface_id']."'"));
if ($addy)
{
$name = $addy['ipv4_address'] . " (".$mac.")";
$peer = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_addresses AS A, ports AS I, devices AS D
$peer = mysql_fetch_assoc(mysql_query("SELECT * FROM ipv4_addresses AS A, ports AS I, devices AS D
WHERE A.ipv4_address = '".$addy['ipv4_address']."'
AND I.interface_id = A.interface_id AND D.device_id = I.device_id"));
if ($peer)
@@ -67,7 +67,7 @@ while ($acc = mysql_fetch_array($query))
$addy['ipv4_address']."'"),0))
{
$peer_query = mysql_query("SELECT * FROM bgpPeers WHERE device_id = '".$acc['device_id']."' AND bgpPeerIdentifier = '".$addy['ipv4_address']."'");
$peer_info = mysql_fetch_array($peer_query);
$peer_info = mysql_fetch_assoc($peer_query);
$name .= " - AS".$peer_info['bgpPeerRemoteAs'];
}

View File

@@ -5,7 +5,7 @@
$query = mysql_query("SELECT * FROM `ports` WHERE `device_id` = '".$port['device_id']."' AND `pagpGroupIfIndex` = '".$port['ifIndex']."'");
$i=0;
while ($int = mysql_fetch_array($query))
while ($int = mysql_fetch_assoc($query))
{
if (is_file($config['rrd_dir'] . "/" . $hostname . "/port-" . safename($int['ifIndex'] . ".rrd")))
{

View File

@@ -89,7 +89,7 @@ if ($device['os'] == "ios" || $device['os'] == "iosxe")
} elseif ($interface['ifVlan']) {
echo("<span class=box-desc><span class=blue>VLAN " . $interface['ifVlan'] . "</span></span>");
} elseif ($interface['ifVrf']) {
$vrf = mysql_fetch_array(mysql_query("SELECT * FROM vrfs WHERE vrf_id = '".$interface['ifVrf']."'"));
$vrf = mysql_fetch_assoc(mysql_query("SELECT * FROM vrfs WHERE vrf_id = '".$interface['ifVrf']."'"));
echo("<span style='color: green;'>" . $vrf['vrf_name'] . "</span>");
}
}
@@ -122,7 +122,7 @@ echo("<td width=375 valign=top class=interface-desc>");
if (strpos($interface['label'], "oopback") === false && !$graph_type)
{
$link_query = mysql_query("select * from links AS L, ports AS I, devices AS D WHERE L.local_interface_id = '$if_id' AND L.remote_interface_id = I.interface_id AND I.device_id = D.device_id");
while ($link = mysql_fetch_array($link_query))
while ($link = mysql_fetch_assoc($link_query))
{
# echo("<img src='images/16/connect.png' align=absmiddle alt='Directly Connected' /> " . generate_port_link($link, makeshortif($link['label'])) . " on " . generate_device_link($link, shorthost($link['hostname'])) . "</a><br />");
# $br = "<br />";
@@ -136,7 +136,7 @@ if (strpos($interface['label'], "oopback") === false && !$graph_type)
{ ## Show which other devices are on the same subnet as this interface
$sql = "SELECT `ipv4_network_id` FROM `ipv4_addresses` WHERE `interface_id` = '".$interface['interface_id']."' AND `ipv4_address` NOT LIKE '127.%'";
$nets_query = mysql_query($sql);
while ($net = mysql_fetch_array($nets_query))
while ($net = mysql_fetch_assoc($nets_query))
{
$ipv4_network_id = $net['ipv4_network_id'];
$sql = "SELECT I.interface_id FROM ipv4_addresses AS A, ports AS I, devices AS D
@@ -144,7 +144,7 @@ if (strpos($interface['label'], "oopback") === false && !$graph_type)
AND A.ipv4_network_id = '".$net['ipv4_network_id']."' AND D.device_id = I.device_id
AND D.device_id != '".$device['device_id']."'";
$new_query = mysql_query($sql);
while ($new = mysql_fetch_array($new_query))
while ($new = mysql_fetch_assoc($new_query))
{
echo($new['ipv4_network_id']);
$this_ifid = $new['interface_id'];
@@ -158,7 +158,7 @@ if (strpos($interface['label'], "oopback") === false && !$graph_type)
$sql = "SELECT ipv6_network_id FROM ipv6_addresses WHERE interface_id = '".$interface['interface_id']."'";
$nets_query = mysql_query($sql);
while ($net = mysql_fetch_array($nets_query))
while ($net = mysql_fetch_assoc($nets_query))
{
$ipv6_network_id = $net['ipv6_network_id'];
$sql = "SELECT I.interface_id FROM ipv6_addresses AS A, ports AS I, devices AS D
@@ -166,7 +166,7 @@ if (strpos($interface['label'], "oopback") === false && !$graph_type)
AND A.ipv6_network_id = '".$net['ipv6_network_id']."' AND D.device_id = I.device_id
AND D.device_id != '".$device['device_id']."' AND A.ipv6_origin != 'linklayer' AND A.ipv6_origin != 'wellknown'";
$new_query = mysql_query($sql);
while ($new = mysql_fetch_array($new_query))
while ($new = mysql_fetch_assoc($new_query))
{
echo($new['ipv6_network_id']);
$this_ifid = $new['interface_id'];
@@ -181,7 +181,7 @@ if (strpos($interface['label'], "oopback") === false && !$graph_type)
foreach ($int_links as $int_link)
{
$link_if = mysql_fetch_array(mysql_query("SELECT * from ports AS I, devices AS D WHERE I.device_id = D.device_id and I.interface_id = '".$int_link."'"));
$link_if = mysql_fetch_assoc(mysql_query("SELECT * from ports AS I, devices AS D WHERE I.device_id = D.device_id and I.interface_id = '".$int_link."'"));
echo("$br");
@@ -198,11 +198,11 @@ if (strpos($interface['label'], "oopback") === false && !$graph_type)
}
$pseudowires = mysql_query("SELECT * FROM `pseudowires` WHERE `interface_id` = '" . $interface['interface_id'] . "'");
while ($pseudowire = mysql_fetch_array($pseudowires))
while ($pseudowire = mysql_fetch_assoc($pseudowires))
{
#`interface_id`,`peer_device_id`,`peer_ldp_id`,`cpwVcID`,`cpwOid`
$pw_peer_dev = mysql_fetch_array(mysql_query("SELECT * from `devices` WHERE `device_id` = '" . $pseudowire['peer_device_id'] . "'"));
$pw_peer_int = mysql_fetch_array(mysql_query("SELECT * from `ports` AS I, pseudowires AS P WHERE I.device_id = '".$pseudowire['peer_device_id']."' AND
$pw_peer_dev = mysql_fetch_assoc(mysql_query("SELECT * from `devices` WHERE `device_id` = '" . $pseudowire['peer_device_id'] . "'"));
$pw_peer_int = mysql_fetch_assoc(mysql_query("SELECT * from `ports` AS I, pseudowires AS P WHERE I.device_id = '".$pseudowire['peer_device_id']."' AND
P.cpwVcID = '".$pseudowire['cpwVcID']."' AND
P.interface_id = I.interface_id"));
$pw_peer_int = ifNameDescr($pw_peer_int);
@@ -211,7 +211,7 @@ while ($pseudowire = mysql_fetch_array($pseudowires))
}
$members = mysql_query("SELECT * FROM `ports` WHERE `pagpGroupIfIndex` = '".$interface['ifIndex']."' and `device_id` = '".$device['device_id']."'");
while ($member = mysql_fetch_array($members))
while ($member = mysql_fetch_assoc($members))
{
echo("$br<img src='images/16/brick_link.png' align=absmiddle> <strong>" . generate_port_link($member) . " (PAgP)</strong>");
$br = "<br />";
@@ -219,7 +219,7 @@ while ($member = mysql_fetch_array($members))
if ($interface['pagpGroupIfIndex'] && $interface['pagpGroupIfIndex'] != $interface['ifIndex'])
{
$parent = mysql_fetch_array(mysql_query("SELECT * FROM `ports` WHERE `ifIndex` = '".$interface['pagpGroupIfIndex']."' and `device_id` = '".$device['device_id']."'"));
$parent = mysql_fetch_assoc(mysql_query("SELECT * FROM `ports` WHERE `ifIndex` = '".$interface['pagpGroupIfIndex']."' and `device_id` = '".$device['device_id']."'"));
echo("$br<img src='images/16/bricks.png' align=absmiddle> <strong>" . generate_port_link($parent) . " (PAgP)</strong>");
$br = "<br />";
}

View File

@@ -11,7 +11,7 @@ if (isset($config['enable_bgp']) && $config['enable_bgp'])
}
$query_a = mysql_query("SELECT * FROM `devices`");
while ($device = mysql_fetch_array($query_a))
while ($device = mysql_fetch_assoc($query_a))
{
$this_alert = 0;
if ($device['status'] == 0 && $device['ignore'] == '0') { $this_alert = "1"; } elseif ($device['ignore'] == '0')

View File

@@ -9,7 +9,7 @@ echo("<td width=200 class=box-desc>" . $vlan['vlan_descr'] . "</td>");
echo("<td class=list-bold>");
$ports_query = mysql_query("SELECT * FROM ports WHERE `device_id` = '" . $device['device_id'] . "' AND `ifVlan` = '" . $vlan['vlan_vlan'] . "' ");
while ($port = mysql_fetch_array($ports_query))
while ($port = mysql_fetch_assoc($ports_query))
{
if ($_GET['opta'])
{

View File

@@ -8,13 +8,14 @@ echo("<td width=200 class=list-large><a href='vrf/".$vrf['mplsVpnVrfRouteDisting
echo("<td width=150 class=box-desc>" . $vrf['mplsVpnVrfDescription'] . "</td>");
echo("<td width=100 class=box-desc>" . $vrf['mplsVpnVrfRouteDistinguisher'] . "</td>");
echo("<td class=list-bold>");
echo('<td class="list-bold">');
$ports_query = mysql_query("SELECT * FROM ports WHERE `device_id` = '" . $device['device_id'] . "' AND `ifVrf` = '" . $vrf['vrf_id'] . "' ");
while ($port = mysql_fetch_array($ports_query)) {
if ($_GET['opta']) {
$graph_type = "port_" . $_GET['opta'];
echo("<div style='display: block; padding: 2px; margin: 2px; min-width: 139px; max-width:139px; min-height:85px; max-height:85px; text-align: center; float: left; background-color: #e9e9e9;'>
while ($port = mysql_fetch_assoc($ports_query))
{
if ($_GET['opta'])
{
$graph_type = "port_" . $_GET['opta'];
echo("<div style='display: block; padding: 2px; margin: 2px; min-width: 139px; max-width:139px; min-height:85px; max-height:85px; text-align: center; float: left; background-color: #e9e9e9;'>
<div style='font-weight: bold;'>".makeshortif($port['ifDescr'])."</div>
<a href='device/".$device['device_id']."/interface/".$port['interface_id']."/' onmouseover=\"return overlib('\
<div style=\'font-size: 16px; padding:5px; font-weight: bold; color: #e5e5e5;\'>".$device['hostname']." - ".$port['ifDescr']."</div>\
@@ -30,6 +31,7 @@ while ($port = mysql_fetch_array($ports_query)) {
$vrf['port_sep'] = ", ";
}
}
echo("</td>");
echo("</tr>");

View File

@@ -42,7 +42,7 @@ if (isset($_GET['format']) && preg_match("/^[a-z]*$/", $_GET['format']))
}
else
{
while ($device = mysql_fetch_array($deviceresult))
while ($device = mysql_fetch_assoc($deviceresult))
{
if ($device)
{
@@ -54,7 +54,7 @@ if (isset($_GET['format']) && preg_match("/^[a-z]*$/", $_GET['format']))
$map .= "\"".$device['hostname']."\" [fontsize=20 fillcolor=\"lightblue\" URL=\"{$config['base_url']}/device/".$device['device_id']."/map/\" shape=box3d]\n";
}
while ($link = mysql_fetch_array($links))
while ($link = mysql_fetch_assoc($links))
{
$local_interface_id = $link['local_interface_id'];
$remote_interface_id = $link['remote_interface_id'];
@@ -95,10 +95,10 @@ if (isset($_GET['format']) && preg_match("/^[a-z]*$/", $_GET['format']))
$dst = $link['remote_hostname'];
}
$sif = ifNameDescr(mysql_fetch_array(mysql_query("SELECT * FROM ports WHERE `interface_id`=" . $link['local_interface_id'])),$device);
$sif = ifNameDescr(mysql_fetch_assoc(mysql_query("SELECT * FROM ports WHERE `interface_id`=" . $link['local_interface_id'])),$device);
if ($remote_interface_id)
{
$dif = ifNameDescr(mysql_fetch_array(mysql_query("SELECT * FROM ports WHERE `interface_id`=" . $link['remote_interface_id'])));
$dif = ifNameDescr(mysql_fetch_assoc(mysql_query("SELECT * FROM ports WHERE `interface_id`=" . $link['remote_interface_id'])));
} else {
$dif['label'] = $link['remote_port'];
$dif['interface_id'] = $link['remote_hostname'] . $link['remote_port'];

View File

@@ -27,7 +27,7 @@ else
}
$query = mysql_query("SELECT * FROM `devices` ORDER BY `hostname`");
while ($device = mysql_fetch_array($query))
while ($device = mysql_fetch_assoc($query))
{
$devicesform .= "<option value='" . $device['device_id'] . "'>" . $device['hostname'] . "</option>";
}

View File

@@ -7,7 +7,7 @@ if ($_SESSION['userlevel'] == '10')
echo("<table cellspacing=0 cellpadding=1 width=100%>");
while ($entry = mysql_fetch_array($data))
while ($entry = mysql_fetch_assoc($data))
{
if ($bg == $list_colour_a) { $bg = $list_colour_b; } else { $bg=$list_colour_a; }

View File

@@ -21,7 +21,7 @@ else
}
$peer_query = mysql_query("select * from bgpPeers AS B, devices AS D WHERE B.device_id = D.device_id $where ORDER BY D.hostname, B.bgpPeerRemoteAs, B.bgpPeerIdentifier");
while ($peer = mysql_fetch_array($peer_query))
while ($peer = mysql_fetch_assoc($peer_query))
{
unset($bg_image);
@@ -34,7 +34,7 @@ else
if ($peer['bgpPeerRemoteAS'] >= '64512' && $peer['bgpPeerRemoteAS'] <= '65535') { $peer_type = "<span style='color: #f00;'>Priv eBGP</span>"; }
}
$peerhost = mysql_fetch_array(mysql_query("SELECT * FROM ipaddr AS A, ports AS I, devices AS D WHERE A.addr = '".$peer['bgpPeerIdentifier']."' AND I.interface_id = A.interface_id AND D.device_id = I.device_id"));
$peerhost = mysql_fetch_assoc(mysql_query("SELECT * FROM ipaddr AS A, ports AS I, devices AS D WHERE A.addr = '".$peer['bgpPeerIdentifier']."' AND I.interface_id = A.interface_id AND D.device_id = I.device_id"));
if ($peerhost) { $peername = generate_device_link($peerhost, shorthost($peerhost['hostname'])); } else { unset($peername); }

View File

@@ -10,7 +10,7 @@ if ($_SESSION['userlevel'] == "10")
if (bill_permitted($bill_id))
{
$bi_q = mysql_query("SELECT * FROM bills WHERE bill_id = $bill_id");
$bill_data = mysql_fetch_array($bi_q);
$bill_data = mysql_fetch_assoc($bi_q);
$today = str_replace("-", "", mysql_result(mysql_query("SELECT CURDATE()"), 0));
$yesterday = str_replace("-", "", mysql_result(mysql_query("SELECT DATE_SUB(CURDATE(), INTERVAL 1 DAY)"), 0));
@@ -102,7 +102,7 @@ if (bill_permitted($bill_id))
WHERE B.bill_id = '".$bill_id."' AND P.interface_id = B.port_id
AND D.device_id = P.device_id");
while ($port = mysql_fetch_array($ports))
while ($port = mysql_fetch_assoc($ports))
{
echo(generate_port_link($port) . " on " . generate_device_link($port) . "<br />");
}

View File

@@ -1,9 +1,10 @@
<?php
if ($_POST['action'] == "delete_bill" && $_POST['confirm'] == "confirm") {
if ($_POST['action'] == "delete_bill" && $_POST['confirm'] == "confirm")
{
$port_query = mysql_query("SELECT * FROM `bill_ports` WHERE `bill_id` = '$bill_id'");
while ($port_data = mysql_fetch_array($port_query)) {
while ($port_data = mysql_fetch_assoc($port_query))
{
mysql_query("DELETE FROM `port_in_measurements` WHERE `port_id` = '".mres($port_data['bill_id'])."'");
mysql_query("DELETE FROM `port_out_measurements` WHERE `port_id` = '".mres($port_data['bill_id'])."'");
}
@@ -16,13 +17,12 @@ if ($_POST['action'] == "delete_bill" && $_POST['confirm'] == "confirm") {
echo("<div class=infobox>Bill Deleted. Redirecting to Bills list.</div>");
echo("<meta http-equiv='Refresh' content=\"2; url='bills/'\">");
}
if ($_POST['action'] == "add_bill_port") { mysql_query("INSERT INTO `bill_ports` (`bill_id`, `port_id`) VALUES ('".mres($_POST['bill_id'])."','".mres($_POST['interface_id'])."')"); }
if ($_POST['action'] == "delete_bill_port") { mysql_query("DELETE FROM `bill_ports` WHERE `bill_id` = '".mres($bill_id)."' AND `port_id` = '".mres($_POST['interface_id'])."'"); }
if ($_POST['action'] == "update_bill") {
if ($_POST['action'] == "update_bill")
{
mysql_query("UPDATE `bills` SET `bill_name` = '".mres($_POST['bill_name'])."',
`bill_day` = '".mres($_POST['bill_day'])."',
`bill_gb` = '".mres($_POST['bill_gb'])."',
@@ -32,9 +32,8 @@ if ($_POST['action'] == "update_bill") {
if (mysql_affected_rows())
{
echo("<div class=infobox>Bill Properties Updated</div>");
print_message("Bill Properties Updated");
}
}
?>

View File

@@ -69,11 +69,10 @@ $ports_array = mysql_query("SELECT * FROM `bill_ports` AS B, `ports` AS P, `devi
if (mysql_affected_rows())
{
echo("<h3>Billed Ports</h3>");
echo("<table cellpadding=5 cellspacing=0>");
while ($port = mysql_fetch_array($ports_array))
while ($port = mysql_fetch_assoc($ports_array))
{
if ($bg == $list_colour_a) { $bg = $list_colour_b; } else { $bg=$list_colour_a; }
echo("<tr style=\"background-color: $bg\">");
@@ -89,9 +88,9 @@ if (mysql_affected_rows())
echo("</table>");
}
echo("<h4>Add Port</h4>");
echo("<h4>Add Port</h4>");
echo("<form action='' method='post'>
echo("<form action='' method='post'>
<input type='hidden' name='action' value='add_bill_port'>
<input type='hidden' name='bill_id' value='".$bill_id."'>
@@ -99,14 +98,15 @@ if (mysql_affected_rows())
<td><select id='device' class='selector' name='device' onchange='getInterfaceList(this)'>
<option value=''>Select a device</option>");
$device_list = mysql_query("SELECT * FROM `devices` ORDER BY hostname");
while ($device = mysql_fetch_array($device_list)) {
unset($done);
foreach ($access_list as $ac) { if ($ac == $device['device_id']) { $done = 1; } }
if (!$done) { echo("<option value='" . $device['device_id'] . "'>" . $device['hostname'] . "</option>"); }
}
$device_list = mysql_query("SELECT * FROM `devices` ORDER BY hostname");
while ($device = mysql_fetch_assoc($device_list))
{
unset($done);
foreach ($access_list as $ac) { if ($ac == $device['device_id']) { $done = 1; } }
if (!$done) { echo("<option value='" . $device['device_id'] . "'>" . $device['hostname'] . "</option>"); }
}
echo("</select></td></tr><tr>
echo("</select></td></tr><tr>
<td>Interface: </td><td><select class=selector id='interface_id' name='interface_id'>
</select></td>
</tr><tr></table><input type='submit' name='Submit' value=' Add '></form>");

View File

@@ -123,7 +123,7 @@ if ($_GET['opta'] == "add")
$query = mysql_query($sql);
echo("<table border=0 cellspacing=0 cellpadding=5 class=devicetable width=100%>");
$i=1;
while ($bill = mysql_fetch_array($query))
while ($bill = mysql_fetch_assoc($query))
{
#echo("<pre>");
#print_r($permissions);

View File

@@ -19,7 +19,7 @@ echo("
$i = 1;
while ($customer = mysql_fetch_array($cust_query))
while ($customer = mysql_fetch_assoc($cust_query))
{
$i++;
@@ -30,7 +30,7 @@ while ($customer = mysql_fetch_array($cust_query))
if (!is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; }
while ($port = mysql_fetch_array($port_query))
while ($port = mysql_fetch_assoc($port_query))
{
$device = device_by_id_cache($port['device_id']);

View File

@@ -22,7 +22,7 @@ if ($_REQUEST['id'])
$query = mysql_query("SELECT * FROM `devices` ORDER BY `hostname`");
while ($data = mysql_fetch_array($query))
while ($data = mysql_fetch_assoc($query))
{
echo("<option value='".$data['device_id']."'>".$data['hostname']."</option>");
}

View File

@@ -13,7 +13,7 @@ if ($_SESSION['userlevel'] < '5')
}
$query = mysql_query("SELECT * FROM `services` AS S, `devices` AS D WHERE S.device_id = D.device_id ORDER BY hostname");
while ($device = mysql_fetch_array($query))
while ($device = mysql_fetch_assoc($query))
{
$servicesform .= "<option value='" . $device['service_id'] . "'>" . $device['service_id'] . "." . $device['hostname'] . " - " . $device['service_type'] . "</option>";
}

View File

@@ -25,7 +25,7 @@ if ($_SESSION['userlevel'] < '10') { include("includes/error-no-perm.inc.php");
# FIXME v mysql query should be replaced by authmodule
$userlist = mysql_query("SELECT * FROM `users`");
while ($userentry = mysql_fetch_array($userlist))
while ($userentry = mysql_fetch_assoc($userlist))
{
$i++;
echo($i . ". " . $userentry['username'] . "

View File

@@ -6,7 +6,7 @@ print_optionbar_start();
unset($sep);
while ($app = mysql_fetch_array($query))
while ($app = mysql_fetch_assoc($query))
{
echo($sep);
@@ -26,7 +26,7 @@ while ($app = mysql_fetch_array($query))
print_optionbar_end();
$app = mysql_fetch_array(mysql_query("SELECT * FROM `applications` WHERE `device_id` = '".$device['device_id']."' AND `app_type` = '".$_GET['opta']."'"));
$app = mysql_fetch_assoc(mysql_query("SELECT * FROM `applications` WHERE `device_id` = '".$device['device_id']."' AND `app_type` = '".$_GET['opta']."'"));
if (is_file("pages/device/apps/".mres($_GET['opta']).".inc.php"))
{

View File

@@ -7,11 +7,11 @@ echo('<table border="0" cellspacing="0" cellpadding="5" width="100%">');
$i = "1";
while ($arp = mysql_fetch_array($query))
while ($arp = mysql_fetch_assoc($query))
{
if (!is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; }
$arp_host = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_addresses AS A, ports AS I, devices AS D WHERE A.ipv4_address = '".$arp['ipv4_address']."' AND I.interface_id = A.interface_id AND D.device_id = I.device_id"));
$arp_host = mysql_fetch_assoc(mysql_query("SELECT * FROM ipv4_addresses AS A, ports AS I, devices AS D WHERE A.ipv4_address = '".$arp['ipv4_address']."' AND I.interface_id = A.interface_id AND D.device_id = I.device_id"));
if ($arp_host) { $arp_name = generate_device_link($arp_host); } else { unset($arp_name); }
if ($arp_host) { $arp_if = generate_port_link($arp_host); } else { unset($arp_if); }

View File

@@ -4,7 +4,7 @@ print_optionbar_start();
unset ($sep);
$query = mysql_query("SELECT `entSensorType` FROM `entPhysical` WHERE device_id = '".$device['device_id']."' AND entSensorType != '' AND entSensorType NOT LIKE 'No%' GROUP BY `entSensorType` ORDER BY `entSensorType`");
while ($data = mysql_fetch_array($query))
while ($data = mysql_fetch_assoc($query))
{
$type = $data['entSensorType'];
if (!$_GET['opta']) { $_GET['opta'] = $type; }
@@ -20,11 +20,11 @@ unset ($sep);
print_optionbar_end();
$query = mysql_query("SELECT * FROM `entPhysical` WHERE device_id = '".$device['device_id']."' and entSensorType = '".$_GET['opta']."' ORDER BY `entPhysicalName`");
while ($data = mysql_fetch_array($query))
while ($data = mysql_fetch_assoc($query))
{
if ($data['entSensorMeasuredEntity'])
{
$measured = mysql_fetch_array(mysql_query("SELECT * FROM entPhysical WHERE device_id = '".$device['device_id']."' AND entPhysicalIndex = '".$data['entSensorMeasuredEntity']."'"));
$measured = mysql_fetch_assoc(mysql_query("SELECT * FROM entPhysical WHERE device_id = '".$device['device_id']."' AND entPhysicalIndex = '".$data['entSensorMeasuredEntity']."'"));
}
echo("<div><h3>".$measured['entPhysicalName']." ".$data['entPhysicalName']."</h3>");

View File

@@ -106,9 +106,8 @@ $(document).ready(function(){
$row=1;
$query = mysql_query("SELECT * FROM `ports` WHERE device_id='".$device['device_id']."' ORDER BY `ifIndex` ");
while ($port = mysql_fetch_array($query))
while ($port = mysql_fetch_assoc($query))
{
$port = ifLabel($port);
if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
@@ -137,11 +136,9 @@ while ($port = mysql_fetch_array($query))
echo("</td>");
echo("<td align=left>".$port['ifAlias'] . "</td>");
echo("</tr>
");
echo("</tr>\n");
$row++;
}
echo('</table>');

View File

@@ -28,7 +28,7 @@ if ($handle = opendir($config['install_dir'] . "/includes/services/"))
}
$query = mysql_query("SELECT * FROM `devices` ORDER BY `hostname`");
while ($device = mysql_fetch_array($query))
while ($device = mysql_fetch_assoc($query))
{
$devicesform .= "<option value='" . $device['device_id'] . "'>" . $device['hostname'] . "</option>";
}
@@ -39,7 +39,7 @@ if (mysql_result(mysql_query("SELECT COUNT(*) from `services` WHERE `device_id`
{
$i = "1";
$service_query = mysql_query("select * from services WHERE device_id = '".$device['device_id']."' ORDER BY service_type");
while ($service = mysql_fetch_array($service_query))
while ($service = mysql_fetch_assoc($service_query))
{
$existform .= "<option value='" . $service['service_id'] . "'>" . $service['service_type'] . "</option>";
}

View File

@@ -5,7 +5,7 @@ function printEntPhysical($ent, $level, $class)
global $device;
$query = mysql_query("SELECT * FROM `entPhysical` WHERE device_id = '".$device['device_id']."' AND entPhysicalContainedIn = '".$ent."' ORDER BY entPhysicalContainedIn,entPhysicalIndex");
while ($ent = mysql_fetch_array($query))
while ($ent = mysql_fetch_assoc($query))
{
echo("
<li class='$class'>");
@@ -27,7 +27,7 @@ function printEntPhysical($ent, $level, $class)
if ($ent['ifIndex'])
{
$interface = mysql_fetch_array(mysql_query("SELECT * FROM `ports` WHERE ifIndex = '".$ent['ifIndex']."' AND device_id = '".$device['device_id']."'"));
$interface = mysql_fetch_assoc(mysql_query("SELECT * FROM `ports` WHERE ifIndex = '".$ent['ifIndex']."' AND device_id = '".$device['device_id']."'"));
$ent['entPhysicalName'] = generate_port_link($interface);
}

View File

@@ -4,7 +4,7 @@ $query = "SELECT *,DATE_FORMAT(datetime, '%D %b %Y %T') as humandate FROM `even
$data = mysql_query($query);
echo('<table cellspacing="0" cellpadding="2" width="100%">');
while ($entry = mysql_fetch_array($data))
while ($entry = mysql_fetch_assoc($data))
{
include("includes/print-event.inc.php");
}

View File

@@ -14,7 +14,7 @@ echo('<table cellspacing="0" cellpadding="5" width="100%">');
$row = 1;
while ($drive = mysql_fetch_array($query))
while ($drive = mysql_fetch_assoc($query))
{
if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }

View File

@@ -8,7 +8,7 @@ echo("<table width=100% cellpadding=6 cellspacing=0>");
$i = '1';
$mempools = mysql_query("SELECT * FROM `mempools` WHERE device_id = '" . $device['device_id'] . "'");
while ($mempool = mysql_fetch_array($mempools))
while ($mempool = mysql_fetch_assoc($mempools))
{
if (!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }

View File

@@ -7,7 +7,7 @@ echo("<table width=100% cellpadding=6 cellspacing=0>");
$i = '1';
$procs = mysql_query("SELECT * FROM `processors` WHERE device_id = '" . $device['device_id'] . "'");
while ($proc = mysql_fetch_array($procs))
while ($proc = mysql_fetch_assoc($procs))
{
$proc_url = "device/".$device['device_id']."/health/processors/";

View File

@@ -7,7 +7,7 @@ echo("<table cellspacing=0 cellpadding=5 width=100%>");
$row = 1;
while ($temp = mysql_fetch_array($query))
while ($temp = mysql_fetch_assoc($query))
{
if (!is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }

View File

@@ -16,7 +16,7 @@ echo("<tr class=tablehead>
$row = 1;
while ($drive = mysql_fetch_array($query))
while ($drive = mysql_fetch_assoc($query))
{
if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }

View File

@@ -3,7 +3,7 @@
echo("<table width=100%>");
$hrdevices = mysql_query("SELECT * FROM `hrDevice` WHERE `device_id` = '".$device['device_id']."' ORDER BY `hrDeviceIndex`");
while ($hrdevice = mysql_fetch_array($hrdevices))
while ($hrdevice = mysql_fetch_assoc($hrdevices))
{
echo("<tr><td>".$hrdevice['hrDeviceIndex']."</td>");
@@ -30,8 +30,9 @@ while ($hrdevice = mysql_fetch_array($hrdevices))
echo('<td>'.$mini_graph.'</td>');
} elseif ($hrdevice['hrDeviceType'] == "hrDeviceNetwork") {
$int = str_replace("network interface ", "", $hrdevice['hrDeviceDescr']);
$interface = mysql_fetch_array(mysql_query("SELECT * FROM ports WHERE device_id = '".$device['device_id']."' AND ifDescr = '".$int."'"));
if ($interface['ifIndex']) {
$interface = mysql_fetch_assoc(mysql_query("SELECT * FROM ports WHERE device_id = '".$device['device_id']."' AND ifDescr = '".$int."'"));
if ($interface['ifIndex'])
{
echo("<td>".generate_port_link($interface)."</td>");
$graph_array['height'] = "20";

View File

@@ -45,7 +45,7 @@ if ($services['total'])
$sql = "SELECT * FROM services WHERE device_id = '" . $device['device_id'] . "' ORDER BY service_type";
$query = mysql_query($sql);
while ($data = mysql_fetch_array($query))
while ($data = mysql_fetch_assoc($query))
{
if ($data[service_status] == "0" && $data[service_ignore] == "1") { $status = "grey"; }
if ($data[service_status] == "1" && $data[service_ignore] == "1") { $status = "green"; }
@@ -68,7 +68,7 @@ if (mysql_affected_rows() > "0")
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
echo("<p style='padding: 0px 5px 5px;' class=sectionhead><img align='absmiddle' src='".$device['base_url']."/images/16/printer.png'> Recent Syslog</p>");
echo("<table cellspacing=0 cellpadding=2 width=100%>");
while ($entry = mysql_fetch_array($query)) { include("includes/print-syslog.inc.php"); }
while ($entry = mysql_fetch_assoc($query)) { include("includes/print-syslog.inc.php"); }
echo("</table>");
echo("</div>");
}
@@ -101,7 +101,7 @@ $data = mysql_query($query);
echo("<table cellspacing=0 cellpadding=2 width=100%>");
while ($entry = mysql_fetch_array($data))
while ($entry = mysql_fetch_assoc($data))
{
include("includes/print-event-short.inc.php");
}

View File

@@ -9,7 +9,7 @@ if (mysql_num_rows($results))
echo('<p style="padding: 0px 5px 5px;" class="sectionhead"><a class="sectionhead" href="device/'.$device['device_id'].'/health/' . strtolower($sensor_type) . '/"><img align="absmiddle" src="'.$config['base_url'].'/images/icons/' . strtolower($sensor_type) . '.png"> ' . $sensor_type . '</a></p>');
$i = '1';
echo('<table width="100%" valign="top">');
while ($sensor = mysql_fetch_array($results))
while ($sensor = mysql_fetch_assoc($results))
{
if (is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }

View File

@@ -12,7 +12,7 @@ if (mysql_result(mysql_query("SELECT count(*) from mempools WHERE device_id = '"
$mempool_rows = '1';
$mempools = mysql_query("SELECT * FROM `mempools` WHERE device_id = '" . $device['device_id'] . "'");
while ($mempool = mysql_fetch_array($mempools))
while ($mempool = mysql_fetch_assoc($mempools))
{
if (is_integer($mempool_rows/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
$perc = round($mempool['mempool_used'] / ($mempool['mempool_total']) * 100,2);

View File

@@ -48,7 +48,7 @@ if ($ports['total'])
$query = mysql_query($sql);
$ifsep = "";
while ($data = mysql_fetch_array($query))
while ($data = mysql_fetch_assoc($query))
{
$data = ifNameDescr($data);
$data = array_merge($data, $device);

View File

@@ -12,7 +12,7 @@ if (mysql_result(mysql_query("SELECT count(*) from processors WHERE device_id =
echo("<table width=100% cellspacing=0 cellpadding=5>");
$i = '1';
$procs = mysql_query("SELECT * FROM `processors` WHERE device_id = '" . $device['device_id'] . "' ORDER BY processor_descr ASC");
while ($proc = mysql_fetch_array($procs))
while ($proc = mysql_fetch_assoc($procs))
{
if (is_integer($processor_rows/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }

View File

@@ -12,7 +12,7 @@ if (mysql_result(mysql_query("SELECT count(storage_id) from storage WHERE device
$drive_rows = '0';
$drives = mysql_query("SELECT * FROM `storage` WHERE device_id = '" . $device['device_id'] . "' ORDER BY storage_descr ASC");
while ($drive = mysql_fetch_array($drives))
while ($drive = mysql_fetch_assoc($drives))
{
$skipdrive = 0;

View File

@@ -6,9 +6,10 @@ $query = mysql_query($sql);
echo('<table border="0" cellspacing="0" cellpadding="5" width="100%">');
$i = "1";
while ($arp = mysql_fetch_array($query)) {
while ($arp = mysql_fetch_assoc($query))
{
if (!is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; }
$arp_host = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_addresses AS A, ports AS I, devices AS D WHERE A.ipv4_address = '".$arp['ipv4_address']."' AND I.interface_id = A.interface_id AND D.device_id = I.device_id"));
$arp_host = mysql_fetch_assoc(mysql_query("SELECT * FROM ipv4_addresses AS A, ports AS I, devices AS D WHERE A.ipv4_address = '".$arp['ipv4_address']."' AND I.interface_id = A.interface_id AND D.device_id = I.device_id"));
if ($arp_host) { $arp_name = generate_device_link($arp_host); } else { unset($arp_name); }
if ($arp_host) { $arp_if = generate_port_link($arp_host); } else { unset($arp_if); }

View File

@@ -8,7 +8,7 @@ if (!$graph_type) { $graph_type = "atmvp_bits"; }
echo('<table cellspacing="0" cellpadding="5" border="0">');
$vps = mysql_query("SELECT * FROM juniAtmVp WHERE interface_id = '".$interface['interface_id']."'");
while ($vp = mysql_fetch_array($vps))
while ($vp = mysql_fetch_assoc($vps))
{
if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
echo('<tr bgcolor="'.$row_colour.'">');

View File

@@ -127,20 +127,20 @@ if ($_GET['optd'] == "top10")
`ports` AS I, `devices` AS D WHERE M.interface_id = '".$interface['interface_id']."' AND I.interface_id = M.interface_id
AND I.device_id = D.device_id ORDER BY bps DESC");
while ($acc = mysql_fetch_array($query))
while ($acc = mysql_fetch_assoc($query))
{
if (!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
$addy = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_mac where mac_address = '".$acc['mac']."'"));
$addy = mysql_fetch_assoc(mysql_query("SELECT * FROM ipv4_mac where mac_address = '".$acc['mac']."'"));
$name = gethostbyaddr($addy['ipv4_address']);
$arp_host = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_addresses AS A, ports AS I, devices AS D WHERE A.ipv4_address = '".$addy['ipv4_address']."' AND I.interface_id = A.interface_id AND D.device_id = I.device_id"));
$arp_host = mysql_fetch_assoc(mysql_query("SELECT * FROM ipv4_addresses AS A, ports AS I, devices AS D WHERE A.ipv4_address = '".$addy['ipv4_address']."' AND I.interface_id = A.interface_id AND D.device_id = I.device_id"));
if ($arp_host) { $arp_name = generate_device_link($arp_host); $arp_name .= " ".generate_port_link($arp_host); } else { unset($arp_if); }
if ($name == $addy['ipv4_address']) { unset ($name); }
if (mysql_result(mysql_query("SELECT count(*) FROM bgpPeers WHERE device_id = '".$acc['device_id']."' AND bgpPeerIdentifier = '".$addy['ipv4_address']."'"),0))
{
$peer_query = mysql_query("SELECT * FROM bgpPeers WHERE device_id = '".$acc['device_id']."' AND bgpPeerIdentifier = '".$addy['ipv4_address']."'");
$peer_info = mysql_fetch_array($peer_query);
$peer_info = mysql_fetch_assoc($peer_query);
} else { unset ($peer_info); }
if ($peer_info)

View File

@@ -26,7 +26,7 @@ echo("<a href='/device/".$device['device_id']."/interface/".$interface['interfac
<img src='$yearly_traffic' border=0></a>");
$members = mysql_query("SELECT * FROM `ports` WHERE `pagpGroupIfIndex` = '".$interface['ifIndex']."' and `device_id` = '".$device['device_id']."'");
while ($member = mysql_fetch_array($members))
while ($member = mysql_fetch_assoc($members))
{
echo("$br<img src='images/16/brick_link.png' align=absmiddle> <strong>" . generate_port_link($member) . " (PAgP)</strong>");
$br = "<br />";

View File

@@ -5,7 +5,7 @@ if (mysql_result(mysql_query("select count(service_id) from services WHERE devic
echo("<div style='margin: 5px;'><table cellpadding=7 border=0 cellspacing=0 width=100%>");
$i = "1";
$service_query = mysql_query("select * from services WHERE device_id = '".$device['device_id']."' ORDER BY service_type");
while ($service = mysql_fetch_array($service_query))
while ($service = mysql_fetch_assoc($service_query))
{
include("includes/print-service.inc.php");
}

View File

@@ -14,7 +14,7 @@ print_optionbar_start('25');
<option value="">All Programs</option>
<?php
$query = mysql_query("SELECT `program` FROM `syslog` WHERE device_id = '" . $device['device_id'] . "' GROUP BY `program` ORDER BY `program`");
while ($data = mysql_fetch_array($query)) {
while ($data = mysql_fetch_assoc($query)) {
echo("<option value='".$data['program']."'");
if ($data['program'] == $_POST['program']) { echo("selected"); }
echo(">".$data['program']."</option>");
@@ -43,7 +43,7 @@ $sql = "SELECT *, DATE_FORMAT(timestamp, '%D %b %T') AS date from syslog WHERE
$sql .= " ORDER BY timestamp DESC LIMIT 1000";
$query = mysql_query($sql);
echo("<table cellspacing=0 cellpadding=2 width=100%>");
while ($entry = mysql_fetch_array($query)) { include("includes/print-syslog.inc.php"); }
while ($entry = mysql_fetch_assoc($query)) { include("includes/print-syslog.inc.php"); }
echo("</table>");
?>

View File

@@ -16,7 +16,7 @@ echo('<table border="0" cellspacing="0" cellpadding="5" width="100%">');
$i = "1";
$vlan_query = mysql_query("select * from vlans WHERE device_id = '".$device['device_id']."' ORDER BY 'vlan_vlan'");
while ($vlan = mysql_fetch_array($vlan_query))
while ($vlan = mysql_fetch_assoc($vlan_query))
{
include("includes/print-vlan.inc.php");
$i++;

View File

@@ -5,7 +5,7 @@ echo('<table border="0" cellspacing="0" cellpadding="5" width="100%" class="sort
$i = "1";
$vm_query = mysql_query("SELECT id, vmwVmVMID, vmwVmDisplayName, vmwVmGuestOS, vmwVmMemSize, vmwVmCpus, vmwVmState FROM vmware_vminfo WHERE device_id = '".$device['device_id']."' ORDER BY vmwVmDisplayName");
while ($vm = mysql_fetch_array($vm_query))
while ($vm = mysql_fetch_assoc($vm_query))
{
include("includes/print-vm.inc.php");
$i++;

View File

@@ -14,7 +14,7 @@ print_optionbar_end();
echo("<div style='margin: 5px;'><table border=0 cellspacing=0 cellpadding=5 width=100%>");
$i = "0";
$vrf_query = mysql_query("select * from vrfs WHERE device_id = '".$device['device_id']."' ORDER BY 'vrf_name'");
while ($vrf = mysql_fetch_array($vrf_query))
while ($vrf = mysql_fetch_assoc($vrf_query))
{
include("includes/print-vrf.inc.php");
$i++;

View File

@@ -28,7 +28,7 @@ print_optionbar_start(62);
<option value=''>All OSes</option>
<?php
$query = mysql_query("SELECT `os` FROM `devices` AS D WHERE 1 GROUP BY `os` ORDER BY `os`");
while ($data = mysql_fetch_array($query))
while ($data = mysql_fetch_assoc($query))
{
if ($data['os'])
{
@@ -44,7 +44,7 @@ while ($data = mysql_fetch_array($query))
<option value=''>All Versions</option>
<?php
$query = mysql_query("SELECT `version` FROM `devices` AS D WHERE 1 GROUP BY `version` ORDER BY `version`");
while ($data = mysql_fetch_array($query))
while ($data = mysql_fetch_assoc($query))
{
if ($data['version'])
{
@@ -61,7 +61,7 @@ while ($data = mysql_fetch_array($query))
<option value="">All Platforms</option>
<?php
$query = mysql_query("SELECT `hardware` FROM `devices` AS D WHERE 1 GROUP BY `hardware` ORDER BY `hardware`");
while ($data = mysql_fetch_array($query))
while ($data = mysql_fetch_assoc($query))
{
if ($data['hardware'])
{
@@ -77,7 +77,7 @@ while ($data = mysql_fetch_array($query))
<option value="">All Featuresets</option>
<?php
$query = mysql_query("SELECT `features` FROM `devices` AS D WHERE 1 GROUP BY `features` ORDER BY `features`");
while ($data = mysql_fetch_array($query))
while ($data = mysql_fetch_assoc($query))
{
if ($data['features'])
{

View File

@@ -8,7 +8,7 @@ if ($_SESSION['userlevel'] != '10') { include("includes/error-no-perm.inc.php");
{
if ($_GET['user_id'])
{
$user_data = mysql_fetch_array(mysql_query("SELECT * FROM users WHERE user_id = '" . $_GET['user_id'] . "'"));
$user_data = mysql_fetch_assoc(mysql_query("SELECT * FROM users WHERE user_id = '" . $_GET['user_id'] . "'"));
echo("<p><h2>" . $user_data['realname'] . "</h2><a href='?page=edituser'>Change...</a></p>");
// Perform actions if requested
@@ -61,7 +61,7 @@ if ($_SESSION['userlevel'] != '10') { include("includes/error-no-perm.inc.php");
echo("<h3>Device Access</h3>");
$device_perm_data = mysql_query("SELECT * from devices_perms as P, devices as D WHERE `user_id` = '" . $_GET['user_id'] . "' AND D.device_id = P.device_id");
while ($device_perm = mysql_fetch_array($device_perm_data))
while ($device_perm = mysql_fetch_assoc($device_perm_data))
{
echo("<strong>" . $device_perm['hostname'] . " <a href='?page=edituser&action=deldevperm&user_id=" . $_GET['user_id'] . "&device_id=" . $device_perm['device_id'] . "'><img src='images/16/cross.png' align=absmiddle border=0></a></strong><br />");
$access_list[] = $device_perm['device_id'];
@@ -79,7 +79,7 @@ if ($_SESSION['userlevel'] != '10') { include("includes/error-no-perm.inc.php");
<select name='device_id' class=selector>");
$device_list = mysql_query("SELECT * FROM `devices` ORDER BY hostname");
while ($device = mysql_fetch_array($device_list))
while ($device = mysql_fetch_assoc($device_list))
{
unset($done);
foreach ($access_list as $ac) { if ($ac == $device['device_id']) { $done = 1; } }
@@ -97,7 +97,7 @@ if ($_SESSION['userlevel'] != '10') { include("includes/error-no-perm.inc.php");
$interface_perm_data = mysql_query("SELECT * from ports_perms as P, ports as I, devices as D WHERE `user_id` = '" . $_GET['user_id'] .
"' AND I.interface_id = P.interface_id AND D.device_id = I.device_id");
while ($interface_perm = mysql_fetch_array($interface_perm_data))
while ($interface_perm = mysql_fetch_assoc($interface_perm_data))
{
echo("<table><tr><td><strong>".$interface_perm['hostname']." - ".$interface_perm['ifDescr']."</strong><br />".
"" . $interface_perm['ifAlias'] . "</td><td width=50>&nbsp;&nbsp;<a href='?page=edituser&action=delifperm&user_id=" . $_GET['user_id'] .
@@ -119,7 +119,7 @@ if ($_SESSION['userlevel'] != '10') { include("includes/error-no-perm.inc.php");
<option value=''>Select a device</option>");
$device_list = mysql_query("SELECT * FROM `devices` ORDER BY hostname");
while ($device = mysql_fetch_array($device_list))
while ($device = mysql_fetch_assoc($device_list))
{
unset($done);
foreach ($access_list as $ac) { if ($ac == $device['device_id']) { $done = 1; } }
@@ -137,7 +137,7 @@ if ($_SESSION['userlevel'] != '10') { include("includes/error-no-perm.inc.php");
$bill_perm_data = mysql_query("SELECT * from bills AS B, bill_perms AS P WHERE P.user_id = '" . $_GET['user_id'] .
"' AND P.bill_id = B.bill_id");
while ($bill_perm = mysql_fetch_array($bill_perm_data))
while ($bill_perm = mysql_fetch_assoc($bill_perm_data))
{
echo("<table><tr><td><strong>".$bill_perm['bill_name']."</strong></td><td width=50>&nbsp;&nbsp;<a href='?page=edituser&action=delbillperm&user_id=" .
$_GET['user_id'] . "&bill_id=" . $bill_perm['bill_id'] . "'><img src='images/16/cross.png' align=absmiddle border=0></a></td></tr></table>");
@@ -157,7 +157,7 @@ if ($_SESSION['userlevel'] != '10') { include("includes/error-no-perm.inc.php");
<select name='bill_id' class=selector>");
$bills = mysql_query("SELECT * FROM `bills` ORDER BY `bill_name`");
while ($bill = mysql_fetch_array($bills))
while ($bill = mysql_fetch_assoc($bills))
{
unset($done);
foreach ($bill_access_list as $ac) { if ($ac == $bill['bill_id']) { $done = 1; } }
@@ -179,7 +179,7 @@ if ($_SESSION['userlevel'] != '10') { include("includes/error-no-perm.inc.php");
echo("<form method='get' action=''>
<input type='hidden' value='edituser' name='page'>
<select name='user_id'>");
while ($user_entry = mysql_fetch_array($user_list))
while ($user_entry = mysql_fetch_assoc($user_list))
{
echo("<option value='" . $user_entry['user_id'] . "'>" . $user_entry['username'] . "</option>");
}

View File

@@ -13,7 +13,7 @@ $data = mysql_query($query);
echo('<table cellspacing="0" cellpadding="1" width="100%">');
while ($entry = mysql_fetch_array($data))
while ($entry = mysql_fetch_assoc($data))
{
include("includes/print-event.inc.php");
}

View File

@@ -15,7 +15,7 @@ $sql = mysql_query("SELECT * FROM `devices` WHERE `status` = '0' AND `ignore` =
} else {
$sql = mysql_query("SELECT * FROM `devices` AS D, devices_perms AS P WHERE D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' AND D.status = '0' AND D.ignore = '0'");
}
while ($device = mysql_fetch_array($sql)){
while ($device = mysql_fetch_assoc($sql)){
generate_front_box("#ffaaaa", "<center><strong>".generate_device_link($device, shorthost($device['hostname']))."</strong><br />
<span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>Device Down</span> <br />
@@ -33,7 +33,7 @@ $sql = mysql_query("SELECT * FROM `ports` AS I, `devices` AS D, devices_perms AS
### These things need to become more generic, and more manageable across different frontpages... rewrite inc :>
while ($interface = mysql_fetch_array($sql))
while ($interface = mysql_fetch_assoc($sql))
{
if (!$interface['deleted'])
{
@@ -49,7 +49,7 @@ while ($interface = mysql_fetch_array($sql))
/* FIXME service permissions? seem nonexisting now.. */
$sql = mysql_query("SELECT * FROM `services` AS S, `devices` AS D WHERE S.device_id = D.device_id AND service_status = 'down' AND D.ignore = '0' AND S.service_ignore = '0'");
while ($service = mysql_fetch_array($sql))
while ($service = mysql_fetch_assoc($sql))
{
generate_front_box("#ffaaaa", "<center><strong>".generate_device_link($service, shorthost($service['hostname']))."</strong><br />
<span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>Service Down</span>
@@ -66,7 +66,7 @@ if (isset($config['enable_bgp']) && $config['enable_bgp'])
} else {
$sql = mysql_query("SELECT * FROM `devices` AS D, bgpPeers AS B, devices_perms AS P WHERE D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' AND bgpPeerState != 'established' AND bgpPeerState != '' AND B.device_id = D.device_id AND D.ignore = 0");
}
while ($peer = mysql_fetch_array($sql))
while ($peer = mysql_fetch_assoc($sql))
{
generate_front_box("#ffaaaa", "<center><strong>".generate_device_link($peer, shorthost($peer['hostname']))."</strong><br />
<span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>BGP Down</span>
@@ -82,7 +82,9 @@ $sql = mysql_query("SELECT * FROM `devices` AS D WHERE D.status = '1' AND D.upti
} else {
$sql = mysql_query("SELECT * FROM `devices` AS D, devices_perms AS P WHERE D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' AND D.status = '1' AND D.uptime < '84600' AND D.ignore = 0");
}
while ($device = mysql_fetch_array($sql)){
while ($device = mysql_fetch_assoc($sql))
{
generate_front_box("#aaffaa", "<center><strong>".generate_device_link($device, shorthost($device['hostname']))."</strong><br />
<span style='font-size: 14px; font-weight: bold; margin: 5px; color: #009;'>Device<br />Rebooted</span><br />
<span class=body-date-1>".formatUptime($device['uptime'], 'short')."</span>
@@ -100,7 +102,8 @@ if ($config['enable_syslog'])
$sql = "SELECT *, DATE_FORMAT(timestamp, '%D %b %T') AS date from syslog ORDER BY timestamp DESC LIMIT 20";
$query = mysql_query($sql);
echo("<table cellspacing=0 cellpadding=2 width=100%>");
while ($entry = mysql_fetch_array($query)) {
while ($entry = mysql_fetch_assoc($query))
{
$entry = array_merge($entry, device_by_id_cache($entry['device_id']));
include("includes/print-syslog.inc.php");
}
@@ -115,23 +118,23 @@ if ($config['enable_syslog'])
<h3>Recent Eventlog Entries</h3>
");
if ($_SESSION['userlevel'] == '10')
{
$query = "SELECT *,DATE_FORMAT(datetime, '%D %b %T') as humandate FROM `eventlog` ORDER BY `datetime` DESC LIMIT 0,15";
} else {
$query = "SELECT *,DATE_FORMAT(datetime, '%D %b %T') as humandate FROM `eventlog` AS E, devices_perms AS P WHERE E.host =
P.device_id AND P.user_id = " . $_SESSION['user_id'] . " ORDER BY `datetime` DESC LIMIT 0,15";
}
if ($_SESSION['userlevel'] == '10')
{
$query = "SELECT *,DATE_FORMAT(datetime, '%D %b %T') as humandate FROM `eventlog` ORDER BY `datetime` DESC LIMIT 0,15";
} else {
$query = "SELECT *,DATE_FORMAT(datetime, '%D %b %T') as humandate FROM `eventlog` AS E, devices_perms AS P WHERE E.host =
P.device_id AND P.user_id = " . $_SESSION['user_id'] . " ORDER BY `datetime` DESC LIMIT 0,15";
}
$data = mysql_query($query);
$data = mysql_query($query);
echo("<table cellspacing=0 cellpadding=1 width=100%>");
echo('<table cellspacing="0" cellpadding="1" width="100%">');
while ($entry = mysql_fetch_array($data)) {
include("includes/print-event.inc.php");
}
while ($entry = mysql_fetch_assoc($data)) {
include("includes/print-event.inc.php");
}
echo("</table>");
echo("</table>");
echo("</div>"); ## Close Syslog Div
}

View File

@@ -33,64 +33,68 @@ while ($device = mysql_fetch_array($sql)){
}
}
if ($config['warn']['ifdown']) {
$sql = mysql_query("SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0'");
while ($interface = mysql_fetch_array($sql)){
if (port_permitted($interface['interface_id'])) {
echo("<div style='text-align: center; margin: 2px; border: solid 2px #D0D0D0; float: left; margin-right: 2px; padding: 3px; width: 118px; height: 85px; background: #ffddaa;'>
if ($config['warn']['ifdown'])
{
$sql = mysql_query("SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0'");
while ($interface = mysql_fetch_array($sql))
{
if (port_permitted($interface['interface_id']))
{
echo("<div style='text-align: center; margin: 2px; border: solid 2px #D0D0D0; float: left; margin-right: 2px; padding: 3px; width: 118px; height: 85px; background: #ffddaa;'>
<strong>".generate_device_link($interface, shorthost($interface['hostname']))."</strong><br />
<span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>Port Down</span><br />
<strong>".generate_port_link($interface, makeshortif($interface['ifDescr']))."</strong><br />
<span class=body-date-1>".truncate($interface['ifAlias'], 15)."</span>
</div>");
}
}
}
}
}
$sql = mysql_query("SELECT * FROM `services` AS S, `devices` AS D WHERE S.device_id = D.device_id AND service_status = 'down' AND D.ignore = '0' AND S.service_ignore = '0'");
while ($service = mysql_fetch_array($sql)){
if (device_permitted($service['device_id'])) {
echo("<div style='text-align: center; margin: 2px; border: solid 2px #D0D0D0; float: left; margin-right: 2px; padding: 3px; width: 118px; height: 85px; background: #ffddaa;'>
while ($service = mysql_fetch_array($sql))
{
if (device_permitted($service['device_id']))
{
echo("<div style='text-align: center; margin: 2px; border: solid 2px #D0D0D0; float: left; margin-right: 2px; padding: 3px; width: 118px; height: 85px; background: #ffddaa;'>
<strong>".generate_device_link($service, shorthost($service['hostname']))."</strong><br />
<span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>Service Down</span><br />
<strong>".$service['service_type']."</strong><br />
<span class=body-date-1>".truncate($interface['ifAlias'], 15)."</span>
</center></div>");
}
}
}
$sql = mysql_query("SELECT * FROM `devices` AS D, bgpPeers AS B WHERE bgpPeerAdminStatus = 'start' AND bgpPeerState != 'established' AND B.device_id = D.device_id");
while ($peer = mysql_fetch_array($sql)){
if (device_permitted($peer['device_id'])) {
echo("<div style='text-align: center; margin: 2px; border: solid 2px #D0D0D0; float: left; margin-right: 2px; padding: 3px; width: 118px; height: 85px; background: #ffddaa;'>
while ($peer = mysql_fetch_array($sql))
{
if (device_permitted($peer['device_id']))
{
echo("<div style='text-align: center; margin: 2px; border: solid 2px #D0D0D0; float: left; margin-right: 2px; padding: 3px; width: 118px; height: 85px; background: #ffddaa;'>
<strong>".generate_device_link($peer, shorthost($peer['hostname']))."</strong><br />
<span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>BGP Down</span><br />
<strong>".$peer['bgpPeerIdentifier']."</strong><br />
<span class=body-date-1>AS".$peer['bgpPeerRemoteAs']." ".truncate($peer['astext'], 10)."</span>
</div>");
}
}
}
$sql = mysql_query("SELECT * FROM devices_attribs AS A, `devices` AS D WHERE A.attrib_value < '84600' AND A.attrib_type = 'uptime' AND A.device_id = D.device_id AND ignore = '0' AND disabled = '0'");
while ($device = mysql_fetch_array($sql)){
if (device_permitted($device['device_id']) && $device['attrib_value'] < "84600" && $device['attrib_type'] == "uptime") {
echo("<div style='text-align: center; margin: 2px; border: solid 2px #D0D0D0; float: left; margin-right: 2px; padding: 3px; width: 118px; height: 85px; background: #ddffdd;'>
while ($device = mysql_fetch_array($sql))
{
if (device_permitted($device['device_id']) && $device['attrib_value'] < "84600" && $device['attrib_type'] == "uptime")
{
echo("<div style='text-align: center; margin: 2px; border: solid 2px #D0D0D0; float: left; margin-right: 2px; padding: 3px; width: 118px; height: 85px; background: #ddffdd;'>
<strong>".generate_device_link($device, shorthost($device['hostname']))."</strong><br />
<span style='font-size: 14px; font-weight: bold; margin: 5px; color: #090;'>Device<br />Rebooted</span><br />
<span class=body-date-1>".formatUptime($device['attrib_value'])."</span>
</div>");
}
}
}
echo("
<div style='clear: both;'>$errorboxes</div> <div style='margin: 0px; clear: both;'>
<h3>Recent Syslog Messages</h3>
");
$sql = "SELECT *, DATE_FORMAT(timestamp, '%D %b %T') AS date from `syslog` ORDER BY seq DESC LIMIT 20";
@@ -101,50 +105,45 @@ while ($entry = mysql_fetch_array($query))
$entry = array_merge($entry, device_by_id_cache($entry['device_id']));
include("includes/print-syslog.inc.php");
}
echo("</table>");
echo("</div>
</td>
<td bgcolor=#e5e5e5 width=470 valign=top>");
/// this stuff can be customised to show whatever you want....
$ports['fileserver'] = "78";
$ports['broadband'] = "228,251,182";
$ports['homeserver'] = "256,245,74";
echo("<div style=' margin-bottom: 5px;'>");
echo("<div style=' margin-bottom: 5px;'>");
if ($ports['fileserver']) {
if ($ports['fileserver'])
{
echo("<div style='width: 470px;'>");
echo("<div style='font-size: 16px; font-weight: bold; color: #555555;'>Central Fileserver</div>");
echo("<div style='width: 470px;'>");
echo("<div style='font-size: 16px; font-weight: bold; color: #555555;'>Central Fileserver</div>");
$graph_array['height'] = "100";
$graph_array['width'] = "385";
$graph_array['to'] = $now;
$graph_array['id'] = $ports['fileserver'];
$graph_array['type'] = "port_bits";
$graph_array['from'] = $day;
$graph_array['legend'] = "no";
$graph_array['height'] = "100";
$graph_array['width'] = "385";
$graph_array['to'] = $now;
$graph_array['id'] = $ports['fileserver'];
$graph_array['type'] = "port_bits";
$graph_array['from'] = $day;
$graph_array['legend'] = "no";
$graph_array['popup_title'] = "Central Fileserver";
$graph_array['popup_title'] = "Central Fileserver";
print_graph_popup($graph_array);
echo("</div>");
}
print_graph_popup($graph_array);
echo("</div>");
}
echo("<div style=' margin-bottom: 5px;'>");
echo("</div>");
echo("<div style='width: 235px; float: left;'>
echo("<div style=' margin-bottom: 5px;'>");
echo("<div style='width: 235px; float: left;'>
<a onmouseover=\"return overlib('\
<img src=\'graph.php?type=port_bits&amp;id=182&amp;from=".$day."&amp;to=".$now."&amp;width=400&amp;height=150&amp;inverse=0&amp;legend=1\'>\
<img src=\'graph.php?type=port_bits&amp;id=182&amp;from=".$week."&amp;to=".$now."&amp;width=400&amp;height=150&amp;inverse=0&amp;legend=1\'>\
@@ -152,7 +151,7 @@ echo("</div>
<div style='font-size: 16px; font-weight: bold; color: #555555;'>NE61 Broadband</div>".
"<img src='graph.php?type=port_bits&amp;id=182&amp;from=".$day."&amp;to=".$now."&amp;width=155&amp;height=100&amp;inverse=0&amp;legend=no'></a></div>");
echo("<div style='width: 235px; float: right;'>
echo("<div style='width: 235px; float: right;'>
<a onmouseover=\"return overlib('\
<img src=\'graph.php?type=port_bits&amp;id=28&amp;from=".$day."&amp;to=".$now."&amp;width=400&amp;height=150&amp;inverse=0&amp;legend=1\'>\
<img src=\'graph.php?type=port_bits&amp;id=28&amp;from=".$week."&amp;to=".$now."&amp;width=400&amp;height=150&amp;inverse=0&amp;legend=1\'>\
@@ -160,11 +159,11 @@ echo("</div>
<div style='font-size: 16px; font-weight: bold; color: #555555;'>NE61 Server</div>".
"<img src='graph.php?type=port_bits&amp;id=28&amp;from=".$day."&amp;to=".$now."&amp;width=155&amp;height=100&amp;inverse=0&amp;legend=no'></a></div>");
echo("</div>");
echo("</div>");
echo("<div style=' margin-bottom: 5px;'>");
echo("<div style=' margin-bottom: 5px;'>");
echo("<div style='width: 235px; float: left;'>
echo("<div style='width: 235px; float: left;'>
<a onmouseover=\"return overlib('\
<img src=\'graph.php?type=port_bits&amp;id=251&amp;from=".$day."&amp;to=".$now."&amp;width=400&amp;height=150&amp;inverse=0&amp;legend=1\'>\
<img src=\'graph.php?type=port_bits&amp;id=251&amp;from=".$week."&amp;to=".$now."&amp;width=400&amp;height=150&amp;inverse=0&amp;legend=1\'>\
@@ -172,7 +171,7 @@ echo("</div>
<div style='font-size: 16px; font-weight: bold; color: #555555;'>DE56 Broadband</div>".
"<img src='graph.php?type=port_bits&amp;id=251&amp;from=".$day."&amp;to=".$now."&amp;width=155&amp;height=100&amp;inverse=0&amp;legend=no'></a></div>");
echo("<div style='width: 235px; float: right;'>
echo("<div style='width: 235px; float: right;'>
<a onmouseover=\"return overlib('\
<img src=\'graph.php?type=port_bits&amp;id=256&amp;from=".$day."&amp;to=".$now."&amp;width=400&amp;height=150&amp;inverse=0&amp;legend=1\'>\
<img src=\'graph.php?type=port_bits&amp;id=256&amp;from=".$week."&amp;to=".$now."&amp;width=400&amp;height=150&amp;inverse=0&amp;legend=1\'>\
@@ -180,11 +179,11 @@ echo("</div>
<div style='font-size: 16px; font-weight: bold; color: #555555;'>DE56 Server</div>".
"<img src='graph.php?type=port_bits&amp;id=256&amp;from=".$day."&amp;to=".$now."&amp;width=155&amp;height=100&amp;inverse=0&amp;legend=no'></a></div>");
echo("</div>");
echo("</div>");
echo("<div style=' margin-bottom: 5px;'>");
echo("<div style=' margin-bottom: 5px;'>");
echo("<div style='width: 235px; float: left;'>
echo("<div style='width: 235px; float: left;'>
<a onmouseover=\"return overlib('\
<img src=\'graph.php?type=port_bits&amp;id=228&amp;from=".$day."&amp;to=".$now."&amp;width=400&amp;height=150&amp;inverse=0&amp;legend=1\'>\
<img src=\'graph.php?type=port_bits&amp;id=228&amp;from=".$week."&amp;to=".$now."&amp;width=400&amp;height=150&amp;inverse=0&amp;legend=1\'>\
@@ -192,7 +191,7 @@ echo("</div>
<div style='font-size: 16px; font-weight: bold; color: #555555;'>DE24 Broadband</div>".
"<img src='graph.php?type=port_bits&amp;id=228&amp;from=".$day."&amp;to=".$now."&amp;width=155&amp;height=100&amp;inverse=0&amp;legend=no'></a></div>");
echo("<div style='width: 235px; float: right;'>
echo("<div style='width: 235px; float: right;'>
<a onmouseover=\"return overlib('\
<img src=\'graph.php?type=port_bits&amp;id=245&amp;from=".$day."&amp;to=".$now."&amp;width=400&amp;height=150&amp;inverse=0&amp;legend=1\'>\
<img src=\'graph.php?type=port_bits&amp;id=245&amp;from=".$week."&amp;to=".$now."&amp;width=400&amp;height=150&amp;inverse=0&amp;legend=1\'>\
@@ -200,9 +199,7 @@ echo("</div>
<div style='font-size: 16px; font-weight: bold; color: #555555;'>DE24 Server</div>".
"<img src='graph.php?type=port_bits&amp;id=245&amp;from=".$day."&amp;to=".$now."&amp;width=155&amp;height=100&amp;inverse=0&amp;legend=no'></a></div>");
echo("</div>");
echo("</div>");
?>
</td>

View File

@@ -11,7 +11,7 @@ $nodes = array();
$sql = mysql_query("SELECT * FROM `devices` AS D, `devices_attribs` AS A WHERE D.status = '1' AND A.device_id = D.device_id AND A.attrib_type = 'uptime' AND A.attrib_value > '0' AND A.attrib_value < '86400'");
while ($device = mysql_fetch_array($sql))
while ($device = mysql_fetch_assoc($sql))
{
unset($already);
$i = 0;
@@ -28,7 +28,7 @@ while ($device = mysql_fetch_array($sql))
}
$sql = mysql_query("SELECT * FROM `devices` WHERE `status` = '0' AND `ignore` = '0'");
while ($device = mysql_fetch_array($sql)){
while ($device = mysql_fetch_assoc($sql)){
echo("<div style='border: solid 2px #d0D0D0; float: left; padding: 5px; width: 120px; height: 90px; background: #ffbbbb; margin: 4px;'>
<center><strong>".generate_device_link($device, shorthost($device['hostname']))."</strong><br />
@@ -39,7 +39,7 @@ while ($device = mysql_fetch_array($sql)){
}
$sql = mysql_query("SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0'");
while ($interface = mysql_fetch_array($sql)){
while ($interface = mysql_fetch_assoc($sql)){
echo("<div style='border: solid 2px #D0D0D0; float: left; padding: 5px; width: 120px; height: 90px; background: #ffddaa; margin: 4px;'>
<center><strong>".generate_device_link($interface, shorthost($interface['hostname']))."</strong><br />
@@ -51,7 +51,7 @@ while ($interface = mysql_fetch_array($sql)){
}
$sql = mysql_query("SELECT * FROM `services` AS S, `devices` AS D WHERE S.device_id = D.device_id AND service_status = 'down' AND D.ignore = '0' AND S.service_ignore = '0'");
while ($service = mysql_fetch_array($sql)){
while ($service = mysql_fetch_assoc($sql)){
echo("<div style='border: solid 2px #D0D0D0; float: left; padding: 5px; width: 120px; height: 90px; background: #ffddaa; margin: 4px;'>
<center><strong>".generate_device_link($service, shorthost($service['hostname']))."</strong><br />
@@ -63,7 +63,7 @@ while ($service = mysql_fetch_array($sql)){
}
$sql = mysql_query("SELECT * FROM `devices` AS D, bgpPeers AS B WHERE bgpPeerState != 'established' AND B.device_id = D.device_id");
while ($peer = mysql_fetch_array($sql)){
while ($peer = mysql_fetch_assoc($sql)){
echo("<div style='border: solid 2px #d0D0D0; float: left; padding: 5px; width: 120px; height: 90px; background: #ffddaa; margin: 4px;'>
<center><strong>".generate_device_link($peer, shorthost($peer['hostname']))."</strong><br />
@@ -75,7 +75,7 @@ while ($peer = mysql_fetch_array($sql)){
}
$sql = mysql_query("SELECT * FROM `devices` AS D, devices_attribs AS A WHERE A.device_id = D.device_id AND A.attrib_type = 'uptime' AND A.attrib_value < '84600'");
while ($device = mysql_fetch_array($sql)){
while ($device = mysql_fetch_assoc($sql)){
echo("<div style='border: solid 2px #d0D0D0; float: left; padding: 5px; width: 120px; height: 90px; background: #ddffdd; margin: 4px;'>
<center><strong>".generate_device_link($device, shorthost($device['hostname']))."</strong><br />
@@ -96,7 +96,7 @@ echo("
$sql = "SELECT *, DATE_FORMAT(timestamp, '%D %b %T') AS date from syslog ORDER BY timestamp DESC LIMIT 20";
$query = mysql_query($sql);
echo("<table cellspacing=0 cellpadding=2 width=100%>");
while ($entry = mysql_fetch_array($query)) { include("includes/print-syslog.inc.php"); }
while ($entry = mysql_fetch_assoc($query)) { include("includes/print-syslog.inc.php"); }
echo("</table>");
@@ -108,13 +108,14 @@ echo("</div>
/// this stuff can be customised to show whatever you want....
if ($_SESSION['userlevel'] >= '5') {
if ($_SESSION['userlevel'] >= '5')
{
$sql = "select * from ports as I, devices as D WHERE `ifAlias` like 'L2TP: %' AND I.device_id = D.device_id AND D.hostname LIKE '%";
$sql .= $config['mydomain'] . "' ORDER BY I.ifAlias";
$query = mysql_query($sql);
unset ($seperator);
while ($interface = mysql_fetch_array($query)) {
while ($interface = mysql_fetch_assoc($query))
{
$ports['l2tp'] .= $seperator . $interface['interface_id'];
$seperator = ",";
}
@@ -123,7 +124,8 @@ if ($_SESSION['userlevel'] >= '5') {
$sql .= $config['mydomain'] . "' ORDER BY I.ifAlias";
$query = mysql_query($sql);
unset ($seperator);
while ($interface = mysql_fetch_array($query)) {
while ($interface = mysql_fetch_assoc($query))
{
$ports['transit'] .= $seperator . $interface['interface_id'];
$seperator = ",";
}
@@ -132,12 +134,14 @@ if ($_SESSION['userlevel'] >= '5') {
$sql .= $config['mydomain'] . "' ORDER BY I.ifAlias";
$query = mysql_query($sql);
unset ($seperator);
while ($interface = mysql_fetch_array($query)) {
while ($interface = mysql_fetch_assoc($query))
{
$ports['voip'] .= $seperator . $interface['interface_id'];
$seperator = ",";
}
if ($ports['transit']) {
if ($ports['transit'])
{
echo("<a onmouseover=\"return overlib('<img src=\'graph.php?type=multi_bits&amp;ports=".$ports['transit'].
"&amp;from=".$day."&amp;to=".$now."&amp;width=400&amp;height=150\'>', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 250);\" onmouseout=\"return nd();\" >".
"<div style='font-size: 18px; font-weight: bold;'>Internet Transit</div>".
@@ -145,7 +149,8 @@ if ($_SESSION['userlevel'] >= '5') {
"&amp;from=".$day."&amp;to=".$now."&amp;width=200&amp;height=100'></a>");
}
if ($ports['l2tp']) {
if ($ports['l2tp'])
{
echo("<a onmouseover=\"return overlib('<img src=\'graph.php?type=multi_bits&amp;ports=".$ports['l2tp'].
"&amp;from=".$day."&amp;to=".$now."&amp;width=400&amp;height=150\'>', LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 250);\" onmouseout=\"return nd();\" >".
"<div style='font-size: 18px; font-weight: bold;'>L2TP ADSL</div>".
@@ -153,7 +158,8 @@ if ($_SESSION['userlevel'] >= '5') {
"&amp;from=".$day."&amp;to=".$now."&amp;width=200&amp;height=100'></a>");
}
if ($ports['voip']) {
if ($ports['voip'])
{
echo("<a onmouseover=\"return overlib('<img src=\'graph.php?type=multi_bits&amp;ports=".$ports['voip'].
"&amp;from=".$day."&amp;to=".$now."&amp;width=400&amp;height=150\'>', LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 250);\" onmouseout=\"return nd();\" >".
"<div style='font-size: 18px; font-weight: bold;'>VoIP to PSTN</div>".

View File

@@ -8,7 +8,7 @@ $nodes = array();
$sql = mysql_query("SELECT * FROM `devices` AS D, `devices_attribs` AS A WHERE D.status = '1' AND A.device_id = D.device_id AND A.attrib_type = 'uptime' AND A.attrib_value > '0' AND A.attrib_value < '86400'");
while ($device = mysql_fetch_array($sql)){
while ($device = mysql_fetch_assoc($sql)){
unset($already);
$i = 0;
while ($i <= count($nodes)) {
@@ -23,7 +23,7 @@ while ($device = mysql_fetch_array($sql)){
$sql = mysql_query("SELECT * FROM `devices` WHERE `status` = '0' AND `ignore` = '0'");
while ($device = mysql_fetch_array($sql)){
while ($device = mysql_fetch_assoc($sql)){
if (device_permitted($device['device_id'])) {
echo("<div style='text-align: center; margin: 2px; border: solid 2px #d0D0D0; float: left; margin-right: 2px; padding: 3px; width: 118px; height: 85px; background: #ffbbbb;'>
<strong>".generate_device_link($device, shorthost($device['hostname']))."</strong><br />
@@ -36,7 +36,7 @@ while ($device = mysql_fetch_array($sql)){
if ($config['warn']['ifdown']) {
$sql = mysql_query("SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0'");
while ($interface = mysql_fetch_array($sql)){
while ($interface = mysql_fetch_assoc($sql)){
if (port_permitted($interface['interface_id'])) {
echo("<div style='text-align: center; margin: 2px; border: solid 2px #D0D0D0; float: left; margin-right: 2px; padding: 3px; width: 118px; height: 85px; background: #ffddaa;'>
<strong>".generate_device_link($interface, shorthost($interface['hostname']))."</strong><br />
@@ -50,7 +50,7 @@ while ($interface = mysql_fetch_array($sql)){
}
$sql = mysql_query("SELECT * FROM `services` AS S, `devices` AS D WHERE S.device_id = D.device_id AND service_status = 'down' AND D.ignore = '0' AND S.service_ignore = '0'");
while ($service = mysql_fetch_array($sql)){
while ($service = mysql_fetch_assoc($sql)){
if (device_permitted($service['device_id'])) {
echo("<div style='text-align: center; margin: 2px; border: solid 2px #D0D0D0; float: left; margin-right: 2px; padding: 3px; width: 118px; height: 85px; background: #ffddaa;'>
<strong>".generate_device_link($service, shorthost($service['hostname']))."</strong><br />
@@ -62,7 +62,7 @@ while ($service = mysql_fetch_array($sql)){
}
$sql = mysql_query("SELECT * FROM `devices` AS D, bgpPeers AS B WHERE bgpPeerAdminStatus = 'start' AND bgpPeerState != 'established' AND B.device_id = D.device_id");
while ($peer = mysql_fetch_array($sql)){
while ($peer = mysql_fetch_assoc($sql)){
if (device_permitted($peer['device_id'])) {
echo("<div style='text-align: center; margin: 2px; border: solid 2px #D0D0D0; float: left; margin-right: 2px; padding: 3px; width: 118px; height: 85px; background: #ffddaa;'>
<strong>".generate_device_link($peer, shorthost($peer['hostname']))."</strong><br />
@@ -74,7 +74,7 @@ while ($peer = mysql_fetch_array($sql)){
}
$sql = mysql_query("SELECT * FROM devices_attribs AS A, `devices` AS D WHERE A.attrib_value < '84600' AND A.attrib_type = 'uptime' AND A.device_id = D.device_id AND ignore = '0' AND disabled = '0'");
while ($device = mysql_fetch_array($sql)){
while ($device = mysql_fetch_assoc($sql)){
if (device_permitted($device['device_id']) && $device['attrib_value'] < "84600" && $device['attrib_type'] == "uptime") {
echo("<div style='text-align: center; margin: 2px; border: solid 2px #D0D0D0; float: left; margin-right: 2px; padding: 3px; width: 118px; height: 85px; background: #ddffdd;'>
<strong>".generate_device_link($device, shorthost($device['hostname']))."</strong><br />
@@ -96,7 +96,7 @@ echo("
$sql = "SELECT *, DATE_FORMAT(timestamp, '%D %b %T') AS date from syslog,devices WHERE syslog.device_id = devices.device_id ORDER BY seq DESC LIMIT 20";
$query = mysql_query($sql);
echo("<table cellspacing=0 cellpadding=2 width=100%>");
while ($entry = mysql_fetch_array($query)) { include("includes/print-syslog.inc.php"); }
while ($entry = mysql_fetch_assoc($query)) { include("includes/print-syslog.inc.php"); }
echo("</table>");
@@ -114,7 +114,7 @@ if ($_SESSION['userlevel'] >= '5')
$sql = "select * from ports as I, devices as D WHERE `ifAlias` like 'Transit: %' AND I.device_id = D.device_id ORDER BY I.ifAlias";
$query = mysql_query($sql);
unset ($seperator);
while ($interface = mysql_fetch_array($query)) {
while ($interface = mysql_fetch_assoc($query)) {
$ports['transit'] .= $seperator . $interface['interface_id'];
$seperator = ",";
}
@@ -122,7 +122,7 @@ if ($_SESSION['userlevel'] >= '5')
$sql = "select * from ports as I, devices as D WHERE `ifAlias` like 'Peering: %' AND I.device_id = D.device_id ORDER BY I.ifAlias";
$query = mysql_query($sql);
unset ($seperator);
while ($interface = mysql_fetch_array($query)) {
while ($interface = mysql_fetch_assoc($query)) {
$ports['peering'] .= $seperator . $interface['interface_id'];
$seperator = ",";
}

View File

@@ -27,7 +27,7 @@ echo('<tr class=tablehead>
$row = 1;
while ($sensor = mysql_fetch_array($query))
while ($sensor = mysql_fetch_assoc($query))
{
if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }

View File

@@ -26,7 +26,7 @@ echo('<tr class=tablehead>
$row = 1;
while ($sensor = mysql_fetch_array($query))
while ($sensor = mysql_fetch_assoc($query))
{
if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }

View File

@@ -26,7 +26,7 @@ echo('<tr class=tablehead>
$row = 1;
while ($sensor = mysql_fetch_array($query))
while ($sensor = mysql_fetch_assoc($query))
{
if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }

View File

@@ -26,7 +26,7 @@ echo('<tr class=tablehead>
$row = 1;
while ($sensor = mysql_fetch_array($query))
while ($sensor = mysql_fetch_assoc($query))
{
if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }

View File

@@ -6,7 +6,7 @@ echo("<div style='margin-top: 5px; padding: 0px;'>");
echo("<table width=100% cellpadding=6 cellspacing=0>");
$i = '1';
$mempools = mysql_query("SELECT * FROM `mempools` AS M, `devices` as D WHERE D.device_id = M.device_id ORDER BY D.hostname");
while ($mempool = mysql_fetch_array($mempools))
while ($mempool = mysql_fetch_assoc($mempools))
{
if (device_permitted($mempool['device_id']))
{

View File

@@ -6,7 +6,7 @@ echo("<div style='margin-top: 5px; padding: 0px;'>");
echo(" <table width=100% cellpadding=6 cellspacing=0>");
$i = '1';
$procs = mysql_query("SELECT * FROM `processors` AS P, `devices` AS D WHERE D.device_id = P.device_id ORDER BY D.hostname");
while ($proc = mysql_fetch_array($procs))
while ($proc = mysql_fetch_assoc($procs))
{
if (device_permitted($proc['device_id']))
{
@@ -14,6 +14,7 @@ while ($proc = mysql_fetch_array($procs))
$device = $proc;
# FIXME should that really be done here? :-)
$text_descr = $proc['processor_descr'];
$text_descr = str_replace("Routing Processor", "RP", $text_descr);
$text_descr = str_replace("Switching Processor", "SP", $text_descr);

View File

@@ -19,7 +19,7 @@ echo("<tr class=tablehead>
$row = 1;
while ($drive = mysql_fetch_array($query))
while ($drive = mysql_fetch_assoc($query))
{
if (device_permitted($drive['device_id']))
{

View File

@@ -26,7 +26,7 @@ echo('<tr class=tablehead>
$row = 1;
while ($sensor = mysql_fetch_array($query))
while ($sensor = mysql_fetch_assoc($query))
{
if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }

View File

@@ -26,7 +26,7 @@ echo('<tr class=tablehead>
$row = 1;
while ($sensor = mysql_fetch_array($query))
while ($sensor = mysql_fetch_assoc($query))
{
if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }

View File

@@ -16,7 +16,7 @@ $type_where .= ") ";
$sql = "SELECT * FROM `ports` as I, `devices` AS D WHERE $type_where AND I.device_id = D.device_id ORDER BY I.ifAlias";
$query = mysql_query($sql);
while ($interface = mysql_fetch_array($query))
while ($interface = mysql_fetch_assoc($query))
{
$if_list .= $seperator . $interface['interface_id'];
$seperator = ",";
@@ -40,7 +40,7 @@ if ($if_list)
$sql = "select * from ports as I, devices as D WHERE $type_where AND I.device_id = D.device_id ORDER BY I.ifAlias";
$query = mysql_query($sql);
while ($interface = mysql_fetch_array($query))
while ($interface = mysql_fetch_assoc($query))
{
$done = "yes";
unset($class);

View File

@@ -11,7 +11,7 @@
<option value="">All Parts</option>
<?php
$query = mysql_query("SELECT `entPhysicalModelName` FROM `entPhysical` GROUP BY `entPhysicalModelName` ORDER BY `entPhysicalModelName`");
while ($data = mysql_fetch_array($query))
while ($data = mysql_fetch_assoc($query))
{
echo("<option value='".$data['entPhysicalModelName']."'");
if ($data['entPhysicalModelName'] == $_POST['part']) { echo("selected"); }
@@ -29,7 +29,7 @@
<option value="">All Devices</option>
<?php
$query = mysql_query("SELECT * FROM `devices` ORDER BY `hostname`");
while ($data = mysql_fetch_array($query))
while ($data = mysql_fetch_assoc($query))
{
echo("<option value='".$data['device_id']."'");
@@ -85,7 +85,7 @@ echo("<table cellspacing=0 cellpadding=2 width=100%>");
echo("<tr><th>Hostname</th><th>Description</th><th>Name</th><th>Part No</th><th>Serial No</th></tr>");
while ($entry = mysql_fetch_array($query))
while ($entry = mysql_fetch_assoc($query))
{
if ($bg == $list_colour_a) { $bg = $list_colour_b; } else { $bg=$list_colour_a; }
echo("<tr style=\"background-color: $bg\"><td>" . generate_device_link($entry, shortHost($entry['hostname'])) . "</td><td>" . $entry['entPhysicalDescr'] .

View File

@@ -8,7 +8,7 @@
<option value="">All Devices</option>
<?php
$query = mysql_query("SELECT `device_id`,`hostname` FROM `devices` GROUP BY `hostname` ORDER BY `hostname`");
while ($data = mysql_fetch_array($query))
while ($data = mysql_fetch_assoc($query))
{
echo('<option value="'.$data['device_id'].'"');
if ($data['device_id'] == $_POST['device_id']) { echo("selected"); }
@@ -51,7 +51,7 @@ echo('<tr class="tablehead"><th>Device</a></th><th>Interface</th><th>Address</th
$row = 1;
while ($interface = mysql_fetch_array($query))
while ($interface = mysql_fetch_assoc($query))
{
if ($_POST['address'])
{

View File

@@ -8,7 +8,7 @@
<option value="">All Devices</option>
<?php
$query = mysql_query("SELECT `device_id`,`hostname` FROM `devices` GROUP BY `hostname` ORDER BY `hostname`");
while ($data = mysql_fetch_array($query))
while ($data = mysql_fetch_assoc($query))
{
echo('<option value="'.$data['device_id'].'"');
if ($data['device_id'] == $_POST['device_id']) { echo("selected"); }
@@ -51,7 +51,7 @@ echo('<tr class="tablehead"><th>Device</a></th><th>Interface</th><th>Address</th
$row = 1;
while ($interface = mysql_fetch_array($query))
while ($interface = mysql_fetch_assoc($query))
{
if ($_POST['address'])
{

Some files were not shown because too many files have changed in this diff Show More