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
+1 -1
View File
@@ -6,7 +6,7 @@ include("config.php");
include("includes/functions.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'"); $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']; $id = $alert['id'];
$host = $alert['hostname']; $host = $alert['hostname'];
+1 -1
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"); $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']; $errors = $interface['ifInErrors_delta'] + $interface['ifOutErrors_delta'];
if ($errors > '1') if ($errors > '1')
+1 -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"; $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); $query = mysql_query($sql);
while ($service = mysql_fetch_array($query)) while ($service = mysql_fetch_assoc($query))
{ {
if ($service['status'] = "1") if ($service['status'] = "1")
{ {
+7 -7
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); $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']); $addr = Net_IPv4::parseAddress($row['ipv4_address']."/".$row['ipv4_prefixlen']);
$mask = $addr->netmask; $mask = $addr->netmask;
@@ -31,7 +31,7 @@ while ($row = mysql_fetch_array($data))
$sql = "SELECT * FROM devices WHERE status = '1'"; $sql = "SELECT * FROM devices WHERE status = '1'";
$query = mysql_query($sql); $query = mysql_query($sql);
while ($device = mysql_fetch_array($query)) while ($device = mysql_fetch_assoc($query))
{ {
echo($device['hostname'] . " \n\n"); 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']."'"; $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); $data = mysql_query($sql);
while ($row = mysql_fetch_array($data)) while ($row = mysql_fetch_assoc($data))
{ {
echo($row['ipv6_address'] . "\n"); echo($row['ipv6_address'] . "\n");
unset($valid); 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'"; $query = "SELECT * FROM ports AS I, devices as D WHERE I.device_id = D.device_id AND D.status = '1'";
$data = mysql_query($query); $data = mysql_query($query);
while ($row = mysql_fetch_array($data)) while ($row = mysql_fetch_assoc($data))
{ {
$index = $row['ifIndex']; $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"); 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`"); $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']; $device_id = $interface['device_id'];
$interface_id = $interface['interface_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"); 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`"); $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']; $id = $link['id'];
$src = $link['local_interface_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"); 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"); $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']; $id = $link['adj_id'];
$netid = $link['network_id']; $netid = $link['network_id'];
+3 -3
View File
@@ -93,7 +93,7 @@ if (file_exists('.svn'))
list(,$dbu_rev) = preg_split('/: /',@shell_exec('svn info database-update.sql|grep ^Revision')); list(,$dbu_rev) = preg_split('/: /',@shell_exec('svn info database-update.sql|grep ^Revision'));
$device_query = mysql_query("SELECT revision FROM `dbSchema`"); $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']; $db_rev = $rev['revision'];
} }
@@ -146,7 +146,7 @@ if (file_exists('.svn'))
$discovered_devices = 0; $discovered_devices = 0;
$device_query = mysql_query("SELECT * FROM `devices` WHERE status = 1 AND disabled = 0 $where ORDER BY device_id DESC"); $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 $device_start = utime(); // Start counting device poll time
@@ -167,7 +167,7 @@ while ($device = mysql_fetch_array($device_query))
#include("includes/discovery/os.inc.php"); #include("includes/discovery/os.inc.php");
if($options['m']) if($options['m'])
{ {
if(is_file("includes/discovery/".$options['m'].".inc.php")) if(is_file("includes/discovery/".$options['m'].".inc.php"))
{ {
+1 -1
View File
@@ -8,7 +8,7 @@ include("includes/functions.php");
$handle = fopen("ips.txt", "w"); $handle = fopen("ips.txt", "w");
$query = mysql_query("SELECT * FROM `ipv4_networks`"); $query = mysql_query("SELECT * FROM `ipv4_networks`");
while ($data = mysql_fetch_array($query)) while ($data = mysql_fetch_assoc($query))
{ {
$cidr = $data['ipv4_network']; $cidr = $data['ipv4_network'];
list ($network, $bits) = explode("/", $cidr); list ($network, $bits) = explode("/", $cidr);
+1 -1
View File
@@ -21,7 +21,7 @@ if (!$_SESSION['authenticated']) { echo("unauthenticated"); exit; }
if (is_numeric($_GET['device_id'])) if (is_numeric($_GET['device_id']))
{ {
$ports = mysql_query("SELECT * FROM ports WHERE device_id = '".$_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"); echo("obj.options[obj.options.length] = new Option('".$interface['ifDescr']." - ".$interface['ifAlias']."','".$interface['interface_id']."');\n");
} }
+2 -2
View File
@@ -58,7 +58,7 @@ $rate_95th = $rate_data['rate_95th'] * 1000;
$rate_average = $rate_data['rate_average'] * 1000; $rate_average = $rate_data['rate_average'] * 1000;
$bi_q = mysql_query("SELECT * FROM bills WHERE bill_id = $bill_id"); $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']; $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'"); $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"; $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); $data = mysql_query($sql);
while ($row = mysql_fetch_array($data)) while ($row = mysql_fetch_assoc($data))
{ {
@$timestamp = $row['formatted_date']; @$timestamp = $row['formatted_date'];
if (!$first) { $first = $timestamp; } if (!$first) { $first = $timestamp; }
+2 -2
View File
@@ -1,7 +1,7 @@
/* Put this inside a @media qualifier so Netscape 4 ignores it */ /* Put this inside a @media qualifier so Netscape 4 ignores it */
@media screen, print { @media screen, print {
/* Turn off list bullets */ /* Turn off list bullets */
ul.mktree li { list-style: none; } ul.mktree li { list-style: none; }
/* Control how "spaced out" the tree is */ /* Control how "spaced out" the tree is */
ul.mktree, ul.mktree ul , ul.mktree li { margin-left:10px; padding:0px; } ul.mktree, ul.mktree ul , ul.mktree li { margin-left:10px; padding:0px; }
/* Provide space for our own "bullet" inside the LI */ /* Provide space for our own "bullet" inside the LI */
@@ -10,7 +10,7 @@ function authenticate($username,$password)
$sql = "SELECT username FROM `users` WHERE `username`='".$_SESSION['username'] . "'";; $sql = "SELECT username FROM `users` WHERE `username`='".$_SESSION['username'] . "'";;
$query = mysql_query($sql); $query = mysql_query($sql);
$row = @mysql_fetch_array($query); $row = @mysql_fetch_assoc($query);
if ($row['username'] && $row['username'] == $_SESSION['username']) if ($row['username'] && $row['username'] == $_SESSION['username'])
{ {
return 1; return 1;
@@ -54,14 +54,14 @@ function user_exists($username)
function get_userlevel($username) function get_userlevel($username)
{ {
$sql = "SELECT level FROM `users` WHERE `username`='".mres($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']; return $row['level'];
} }
function get_userid($username) function get_userid($username)
{ {
$sql = "SELECT user_id FROM `users` WHERE `username`='".mres($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']; return $row['user_id'];
} }
+2 -2
View File
@@ -68,7 +68,7 @@ function get_userlevel($username)
{ {
# FIXME should come from LDAP # FIXME should come from LDAP
$sql = "SELECT level FROM `users` WHERE `username`='".mres($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']; return $row['level'];
} }
@@ -76,7 +76,7 @@ function get_userid($username)
{ {
# FIXME should come from LDAP # FIXME should come from LDAP
$sql = "SELECT user_id FROM `users` WHERE `username`='".mres($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']; return $row['user_id'];
} }
+2 -2
View File
@@ -84,14 +84,14 @@ function user_exists($username)
function get_userlevel($username) function get_userlevel($username)
{ {
$sql = "SELECT level FROM `users` WHERE `username`='".mres($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']; return $row['level'];
} }
function get_userid($username) function get_userid($username)
{ {
$sql = "SELECT user_id FROM `users` WHERE `username`='".mres($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']; return $row['user_id'];
} }
+4 -6
View File
@@ -1,16 +1,15 @@
<?php <?php
if ($_GET['id'] && is_numeric($_GET['id'])) { $atm_vp_id = $_GET['id']; } 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 = "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"; $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); $query = mysql_query($sql);
$vp = mysql_fetch_array($query); $vp = mysql_fetch_assoc($query);
if ($config['allow_unauth_graphs'] || port_permitted($vp['interface_id'])) {
if ($config['allow_unauth_graphs'] || port_permitted($vp['interface_id']))
{
$port = $vp; $port = $vp;
$device = device_by_id_cache($port['device_id']); $device = device_by_id_cache($port['device_id']);
$title = generate_device_link($device); $title = generate_device_link($device);
@@ -18,7 +17,6 @@ if ($config['allow_unauth_graphs'] || port_permitted($vp['interface_id'])) {
$title .= " :: VP ".$vp['vp_id']; $title .= " :: VP ".$vp['vp_id'];
$auth = TRUE; $auth = TRUE;
$rrd_filename = $config['rrd_dir'] . "/" . $vp['hostname'] . "/" . safename("vp-" . $vp['ifIndex'] . "-".$vp['vp_id'].".rrd"); $rrd_filename = $config['rrd_dir'] . "/" . $vp['hostname'] . "/" . safename("vp-" . $vp['ifIndex'] . "-".$vp['vp_id'].".rrd");
} }
?> ?>
+1 -1
View File
@@ -4,7 +4,7 @@
$i = 0; $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"))) if (is_file($config['rrd_dir'] . "/" . $port['hostname'] . "/port-" . safename($port['ifIndex'] . ".rrd")))
{ {
@@ -1,6 +1,6 @@
<?php <?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']) switch ($sensor['entSensorType'])
{ {
+1 -1
View File
@@ -3,7 +3,7 @@
## Generate a list of ports and then call the multi_bits grapher to generate from the list ## 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"); $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"))) if (is_file($config['rrd_dir'] . "/" . $int['hostname'] . "/port-" . safename($int['ifIndex'] . ".rrd")))
{ {
+1 -1
View File
@@ -8,7 +8,7 @@ $rrd_options .= " -l 0 -E ";
$iter = "1"; $iter = "1";
$sql = mysql_query("SELECT * FROM sensors WHERE sensor_class='current' AND device_id = '$id'"); $sql = mysql_query("SELECT * FROM sensors WHERE sensor_class='current' AND device_id = '$id'");
$rrd_options .= " COMMENT:' Cur Min Max\\n'"; $rrd_options .= " COMMENT:' Cur Min Max\\n'";
while ($current = mysql_fetch_array($sql)) while ($current = mysql_fetch_assoc($sql))
{ {
switch ($iter) switch ($iter)
{ {
@@ -6,7 +6,7 @@ if ($_GET['device']) { $id = mres($_GET['device']); }
$i = 1; $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"); $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"); $rrd_filename = $config['rrd_dir'] . "/" . $disk['hostname'] . "/ucd_diskio-" . safename($disk['diskio_descr'] . ".rrd");
if (is_file($rrd_filename)) if (is_file($rrd_filename))
@@ -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"); $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"); $rrd_filename = $config['rrd_dir'] . "/" . $disk['hostname'] . "/ucd_diskio-" . safename($disk['diskio_descr'] . ".rrd");
if (is_file($rrd_filename)) if (is_file($rrd_filename))
@@ -10,7 +10,8 @@ $iter = "1";
$sql = mysql_query("SELECT * FROM sensors WHERE sensor_class='fanspeed' AND device_id = '$id'"); $sql = mysql_query("SELECT * FROM sensors WHERE sensor_class='fanspeed' AND device_id = '$id'");
$rrd_options .= " COMMENT:'RPM Cur Min Max\\n'"; $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) switch ($iter)
{ {
@@ -8,8 +8,10 @@ $rrd_options .= " -l 0 -E ";
$iter = "1"; $iter = "1";
$sql = mysql_query("SELECT * FROM sensors WHERE sensor_class='freq' AND device_id = '$id'"); $sql = mysql_query("SELECT * FROM sensors WHERE sensor_class='freq' AND device_id = '$id'");
$rrd_options .= " COMMENT:' Cur Min Max\\n'"; $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) switch ($iter)
{ {
case "1": case "1":
+2 -1
View File
@@ -8,8 +8,9 @@ $rrd_options .= " -l 0 -E ";
$iter = "1"; $iter = "1";
$sql = mysql_query("SELECT * FROM sensors WHERE sensor_class='humidity' AND device_id = '$id' ORDER BY sensor_index"); $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'"; $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) switch ($iter)
{ {
case "1": case "1":
+2 -1
View File
@@ -10,8 +10,9 @@ $rrd_options .= " -u 100 -l 0 -E -b 1024 ";
$iter = "1"; $i=1; $iter = "1"; $i=1;
$rrd_options .= " COMMENT:' Min Cur Max\\n'"; $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"; } 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=="4") { $colour="73880A"; } elseif ($iter=="5") { $colour="D01F3C"; } elseif ($iter=="6") { $colour="36393D"; }
elseif ($iter=="7") { $colour="FF0084"; unset($iter); } elseif ($iter=="7") { $colour="FF0084"; unset($iter); }
@@ -5,7 +5,7 @@ $query = mysql_query("SELECT * FROM `processors` where `device_id` = '".$id."'")
$i = 0; $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"); $rrd_filename = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("processor-" . $proc['processor_type'] . "-" . $proc['processor_index'] . ".rrd");
+2 -1
View File
@@ -11,8 +11,9 @@ $iter = "1";
$sql = mysql_query("SELECT * FROM storage where device_id = '$id'"); $sql = mysql_query("SELECT * FROM storage where device_id = '$id'");
$rrd_options .= " COMMENT:' Size Used %age\\l'"; $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"; } 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=="4") { $colour="73880A"; } elseif ($iter=="5") { $colour="D01F3C"; } elseif ($iter=="6") { $colour="36393D"; }
elseif ($iter=="7") { $colour="FF0084"; $iter = "0"; } elseif ($iter=="7") { $colour="FF0084"; $iter = "0"; }
@@ -9,8 +9,9 @@ $rrd_options .= " -l 0 -E ";
$iter = "1"; $iter = "1";
$sql = mysql_query("SELECT * FROM sensors WHERE sensor_class='temperature' AND device_id = '$id' ORDER BY sensor_index"); $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'"; $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) switch ($iter)
{ {
case "1": case "1":
+2 -1
View File
@@ -8,8 +8,9 @@ $rrd_options .= " -l 0 -E ";
$iter = "1"; $iter = "1";
$sql = mysql_query("SELECT * FROM toner where device_id = '$id'"); $sql = mysql_query("SELECT * FROM toner where device_id = '$id'");
$rrd_options .= " COMMENT:'Toner level Cur Min Max\\n'"; $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) switch ($iter)
{ {
case "1": case "1":
+2 -1
View File
@@ -10,8 +10,9 @@ $rrd_options .= " COMMENT:'".str_pad('',$descr_len)." Cur Min Max\\
$iter = "1"; $iter = "1";
$sql = mysql_query("SELECT * FROM sensors WHERE sensor_class='voltage' AND device_id = '$id'"); $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) switch ($iter)
{ {
case "1": case "1":
+1 -1
View File
@@ -3,7 +3,7 @@
if (is_numeric($id)) 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"); $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']))) if (is_numeric($disk['device_id']) && ($config['allow_unauth_graphs'] || device_permitted($disk['device_id'])))
{ {
+1 -1
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"); $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"))) if (is_file($config['rrd_dir'] . "/" . $disk['hostname'] . "/ucd_diskio-" . safename($disk['diskio_descr'] . ".rrd")))
{ {
+1 -3
View File
@@ -35,10 +35,8 @@ $vertical = mres($_GET['vertical']);
$legend = mres($_GET['legend']); $legend = mres($_GET['legend']);
$id = mres($_GET['id']); $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; } if (!$_SESSION['authenticated']) { graph_error("Not authenticated"); exit; }
} }
@@ -5,7 +5,7 @@ $i = 0;
foreach (explode(",", $id) as $ifid) 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"); $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"))) 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"); $rrd_list[$i]['filename'] = $config['rrd_dir'] . "/" . $port['hostname'] . "/port-" . safename($port['ifIndex'] . ".rrd");
+1 -1
View File
@@ -6,7 +6,7 @@ include("includes/graphs/common.inc.php");
$rrd_options .= " COMMENT:' Last Max\\n'"; $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); $hostname = mysql_result(mysql_query("SELECT hostname FROM devices WHERE device_id = '" . $fanspeed['device_id'] . "'"),0);
@@ -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'])."' $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"); 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"))) 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"); $rrd_filename = $config['rrd_dir'] . "/" . $acc['hostname'] . "/". safename("cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd");
@@ -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'])."' $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"); 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"))) 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"); $rrd_filename = $config['rrd_dir'] . "/" . $acc['hostname'] . "/" . safename("cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd");
@@ -43,19 +43,19 @@ $query = mysql_query($sql);
$pluses = ""; $iter = '0'; $pluses = ""; $iter = '0';
$rrd_options .= " COMMENT:' In\: Current Maximum Total Out\: Current Maximum Total\\\\n'"; $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"); $this_rrd = $config['rrd_dir'] . "/" . $acc['hostname'] . "/" . safename("cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd");
if (is_file($this_rrd)) if (is_file($this_rrd))
{ {
$mac = formatmac($acc['mac']); $mac = formatmac($acc['mac']);
$name = $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) if ($addy)
{ {
$name = $addy['ipv4_address'] . " (".$mac.")"; $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']."' WHERE A.ipv4_address = '".$addy['ipv4_address']."'
AND I.interface_id = A.interface_id AND D.device_id = I.device_id")); AND I.interface_id = A.interface_id AND D.device_id = I.device_id"));
if ($peer) if ($peer)
@@ -67,7 +67,7 @@ while ($acc = mysql_fetch_array($query))
$addy['ipv4_address']."'"),0)) $addy['ipv4_address']."'"),0))
{ {
$peer_query = mysql_query("SELECT * FROM bgpPeers WHERE device_id = '".$acc['device_id']."' AND bgpPeerIdentifier = '".$addy['ipv4_address']."'"); $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']; $name .= " - AS".$peer_info['bgpPeerRemoteAs'];
} }
+1 -1
View File
@@ -5,7 +5,7 @@
$query = mysql_query("SELECT * FROM `ports` WHERE `device_id` = '".$port['device_id']."' AND `pagpGroupIfIndex` = '".$port['ifIndex']."'"); $query = mysql_query("SELECT * FROM `ports` WHERE `device_id` = '".$port['device_id']."' AND `pagpGroupIfIndex` = '".$port['ifIndex']."'");
$i=0; $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"))) if (is_file($config['rrd_dir'] . "/" . $hostname . "/port-" . safename($int['ifIndex'] . ".rrd")))
{ {
+12 -12
View File
@@ -89,7 +89,7 @@ if ($device['os'] == "ios" || $device['os'] == "iosxe")
} elseif ($interface['ifVlan']) { } elseif ($interface['ifVlan']) {
echo("<span class=box-desc><span class=blue>VLAN " . $interface['ifVlan'] . "</span></span>"); echo("<span class=box-desc><span class=blue>VLAN " . $interface['ifVlan'] . "</span></span>");
} elseif ($interface['ifVrf']) { } 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>"); 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) 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"); $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 />"); # 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 />"; # $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 { ## 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.%'"; $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); $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']; $ipv4_network_id = $net['ipv4_network_id'];
$sql = "SELECT I.interface_id FROM ipv4_addresses AS A, ports AS I, devices AS D $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 A.ipv4_network_id = '".$net['ipv4_network_id']."' AND D.device_id = I.device_id
AND D.device_id != '".$device['device_id']."'"; AND D.device_id != '".$device['device_id']."'";
$new_query = mysql_query($sql); $new_query = mysql_query($sql);
while ($new = mysql_fetch_array($new_query)) while ($new = mysql_fetch_assoc($new_query))
{ {
echo($new['ipv4_network_id']); echo($new['ipv4_network_id']);
$this_ifid = $new['interface_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']."'"; $sql = "SELECT ipv6_network_id FROM ipv6_addresses WHERE interface_id = '".$interface['interface_id']."'";
$nets_query = mysql_query($sql); $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']; $ipv6_network_id = $net['ipv6_network_id'];
$sql = "SELECT I.interface_id FROM ipv6_addresses AS A, ports AS I, devices AS D $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 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'"; AND D.device_id != '".$device['device_id']."' AND A.ipv6_origin != 'linklayer' AND A.ipv6_origin != 'wellknown'";
$new_query = mysql_query($sql); $new_query = mysql_query($sql);
while ($new = mysql_fetch_array($new_query)) while ($new = mysql_fetch_assoc($new_query))
{ {
echo($new['ipv6_network_id']); echo($new['ipv6_network_id']);
$this_ifid = $new['interface_id']; $this_ifid = $new['interface_id'];
@@ -181,7 +181,7 @@ if (strpos($interface['label'], "oopback") === false && !$graph_type)
foreach ($int_links as $int_link) 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"); 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'] . "'"); $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` #`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_dev = mysql_fetch_assoc(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_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.cpwVcID = '".$pseudowire['cpwVcID']."' AND
P.interface_id = I.interface_id")); P.interface_id = I.interface_id"));
$pw_peer_int = ifNameDescr($pw_peer_int); $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']."'"); $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>"); echo("$br<img src='images/16/brick_link.png' align=absmiddle> <strong>" . generate_port_link($member) . " (PAgP)</strong>");
$br = "<br />"; $br = "<br />";
@@ -219,7 +219,7 @@ while ($member = mysql_fetch_array($members))
if ($interface['pagpGroupIfIndex'] && $interface['pagpGroupIfIndex'] != $interface['ifIndex']) 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>"); echo("$br<img src='images/16/bricks.png' align=absmiddle> <strong>" . generate_port_link($parent) . " (PAgP)</strong>");
$br = "<br />"; $br = "<br />";
} }
+1 -1
View File
@@ -11,7 +11,7 @@ if (isset($config['enable_bgp']) && $config['enable_bgp'])
} }
$query_a = mysql_query("SELECT * FROM `devices`"); $query_a = mysql_query("SELECT * FROM `devices`");
while ($device = mysql_fetch_array($query_a)) while ($device = mysql_fetch_assoc($query_a))
{ {
$this_alert = 0; $this_alert = 0;
if ($device['status'] == 0 && $device['ignore'] == '0') { $this_alert = "1"; } elseif ($device['ignore'] == '0') if ($device['status'] == 0 && $device['ignore'] == '0') { $this_alert = "1"; } elseif ($device['ignore'] == '0')
+1 -1
View File
@@ -9,7 +9,7 @@ echo("<td width=200 class=box-desc>" . $vlan['vlan_descr'] . "</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 `ifVlan` = '" . $vlan['vlan_vlan'] . "' "); $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']) if ($_GET['opta'])
{ {
+9 -7
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=150 class=box-desc>" . $vrf['mplsVpnVrfDescription'] . "</td>");
echo("<td width=100 class=box-desc>" . $vrf['mplsVpnVrfRouteDistinguisher'] . "</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'] . "' "); $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)) { while ($port = mysql_fetch_assoc($ports_query))
if ($_GET['opta']) { {
$graph_type = "port_" . $_GET['opta']; if ($_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;'> {
$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> <div style='font-weight: bold;'>".makeshortif($port['ifDescr'])."</div>
<a href='device/".$device['device_id']."/interface/".$port['interface_id']."/' onmouseover=\"return overlib('\ <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>\ <div style=\'font-size: 16px; padding:5px; font-weight: bold; color: #e5e5e5;\'>".$device['hostname']." - ".$port['ifDescr']."</div>\
@@ -30,7 +31,8 @@ while ($port = mysql_fetch_array($ports_query)) {
$vrf['port_sep'] = ", "; $vrf['port_sep'] = ", ";
} }
} }
echo("</td>"); echo("</td>");
echo("</tr>"); echo("</tr>");
?> ?>
+4 -4
View File
@@ -42,7 +42,7 @@ if (isset($_GET['format']) && preg_match("/^[a-z]*$/", $_GET['format']))
} }
else else
{ {
while ($device = mysql_fetch_array($deviceresult)) while ($device = mysql_fetch_assoc($deviceresult))
{ {
if ($device) 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"; $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']; $local_interface_id = $link['local_interface_id'];
$remote_interface_id = $link['remote_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']; $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) 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 { } else {
$dif['label'] = $link['remote_port']; $dif['label'] = $link['remote_port'];
$dif['interface_id'] = $link['remote_hostname'] . $link['remote_port']; $dif['interface_id'] = $link['remote_hostname'] . $link['remote_port'];
+1 -1
View File
@@ -27,7 +27,7 @@ else
} }
$query = mysql_query("SELECT * FROM `devices` ORDER BY `hostname`"); $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>"; $devicesform .= "<option value='" . $device['device_id'] . "'>" . $device['hostname'] . "</option>";
} }
+1 -1
View File
@@ -7,7 +7,7 @@ if ($_SESSION['userlevel'] == '10')
echo("<table cellspacing=0 cellpadding=1 width=100%>"); 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; } if ($bg == $list_colour_a) { $bg = $list_colour_b; } else { $bg=$list_colour_a; }
+2 -2
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"); $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); unset($bg_image);
@@ -34,7 +34,7 @@ else
if ($peer['bgpPeerRemoteAS'] >= '64512' && $peer['bgpPeerRemoteAS'] <= '65535') { $peer_type = "<span style='color: #f00;'>Priv eBGP</span>"; } 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); } if ($peerhost) { $peername = generate_device_link($peerhost, shorthost($peerhost['hostname'])); } else { unset($peername); }
+3 -3
View File
@@ -10,7 +10,7 @@ if ($_SESSION['userlevel'] == "10")
if (bill_permitted($bill_id)) if (bill_permitted($bill_id))
{ {
$bi_q = mysql_query("SELECT * FROM bills WHERE bill_id = $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)); $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)); $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 WHERE B.bill_id = '".$bill_id."' AND P.interface_id = B.port_id
AND D.device_id = P.device_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 />"); echo(generate_port_link($port) . " on " . generate_device_link($port) . "<br />");
} }
@@ -258,4 +258,4 @@ else
include("includes/error-no-perm.inc.php"); include("includes/error-no-perm.inc.php");
} }
?> ?>
+8 -9
View File
@@ -1,9 +1,10 @@
<?php <?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'"); $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_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'])."'"); 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("<div class=infobox>Bill Deleted. Redirecting to Bills list.</div>");
echo("<meta http-equiv='Refresh' content=\"2; url='bills/'\">"); 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'] == "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'] == "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'])."', mysql_query("UPDATE `bills` SET `bill_name` = '".mres($_POST['bill_name'])."',
`bill_day` = '".mres($_POST['bill_day'])."', `bill_day` = '".mres($_POST['bill_day'])."',
`bill_gb` = '".mres($_POST['bill_gb'])."', `bill_gb` = '".mres($_POST['bill_gb'])."',
@@ -32,9 +32,8 @@ if ($_POST['action'] == "update_bill") {
if (mysql_affected_rows()) if (mysql_affected_rows())
{ {
echo("<div class=infobox>Bill Properties Updated</div>"); print_message("Bill Properties Updated");
} }
} }
?> ?>
+11 -11
View File
@@ -69,11 +69,10 @@ $ports_array = mysql_query("SELECT * FROM `bill_ports` AS B, `ports` AS P, `devi
if (mysql_affected_rows()) if (mysql_affected_rows())
{ {
echo("<h3>Billed Ports</h3>"); echo("<h3>Billed Ports</h3>");
echo("<table cellpadding=5 cellspacing=0>"); 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; } if ($bg == $list_colour_a) { $bg = $list_colour_b; } else { $bg=$list_colour_a; }
echo("<tr style=\"background-color: $bg\">"); echo("<tr style=\"background-color: $bg\">");
@@ -89,9 +88,9 @@ if (mysql_affected_rows())
echo("</table>"); 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='action' value='add_bill_port'>
<input type='hidden' name='bill_id' value='".$bill_id."'> <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)'> <td><select id='device' class='selector' name='device' onchange='getInterfaceList(this)'>
<option value=''>Select a device</option>"); <option value=''>Select a device</option>");
$device_list = mysql_query("SELECT * FROM `devices` ORDER BY hostname"); $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; } } unset($done);
if (!$done) { echo("<option value='" . $device['device_id'] . "'>" . $device['hostname'] . "</option>"); } 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'> <td>Interface: </td><td><select class=selector id='interface_id' name='interface_id'>
</select></td> </select></td>
</tr><tr></table><input type='submit' name='Submit' value=' Add '></form>"); </tr><tr></table><input type='submit' name='Submit' value=' Add '></form>");
+1 -1
View File
@@ -123,7 +123,7 @@ if ($_GET['opta'] == "add")
$query = mysql_query($sql); $query = mysql_query($sql);
echo("<table border=0 cellspacing=0 cellpadding=5 class=devicetable width=100%>"); echo("<table border=0 cellspacing=0 cellpadding=5 class=devicetable width=100%>");
$i=1; $i=1;
while ($bill = mysql_fetch_array($query)) while ($bill = mysql_fetch_assoc($query))
{ {
#echo("<pre>"); #echo("<pre>");
#print_r($permissions); #print_r($permissions);
+2 -2
View File
@@ -19,7 +19,7 @@ echo("
$i = 1; $i = 1;
while ($customer = mysql_fetch_array($cust_query)) while ($customer = mysql_fetch_assoc($cust_query))
{ {
$i++; $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; } 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']); $device = device_by_id_cache($port['device_id']);
+1 -1
View File
@@ -22,7 +22,7 @@ if ($_REQUEST['id'])
$query = mysql_query("SELECT * FROM `devices` ORDER BY `hostname`"); $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>"); echo("<option value='".$data['device_id']."'>".$data['hostname']."</option>");
} }
+1 -1
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"); $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>"; $servicesform .= "<option value='" . $device['service_id'] . "'>" . $device['service_id'] . "." . $device['hostname'] . " - " . $device['service_type'] . "</option>";
} }
+1 -1
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 # FIXME v mysql query should be replaced by authmodule
$userlist = mysql_query("SELECT * FROM `users`"); $userlist = mysql_query("SELECT * FROM `users`");
while ($userentry = mysql_fetch_array($userlist)) while ($userentry = mysql_fetch_assoc($userlist))
{ {
$i++; $i++;
echo($i . ". " . $userentry['username'] . " echo($i . ". " . $userentry['username'] . "
+2 -2
View File
@@ -6,7 +6,7 @@ print_optionbar_start();
unset($sep); unset($sep);
while ($app = mysql_fetch_array($query)) while ($app = mysql_fetch_assoc($query))
{ {
echo($sep); echo($sep);
@@ -26,7 +26,7 @@ while ($app = mysql_fetch_array($query))
print_optionbar_end(); 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")) if (is_file("pages/device/apps/".mres($_GET['opta']).".inc.php"))
{ {
+2 -2
View File
@@ -7,11 +7,11 @@ echo('<table border="0" cellspacing="0" cellpadding="5" width="100%">');
$i = "1"; $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; } 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_name = generate_device_link($arp_host); } else { unset($arp_name); }
if ($arp_host) { $arp_if = generate_port_link($arp_host); } else { unset($arp_if); } if ($arp_host) { $arp_if = generate_port_link($arp_host); } else { unset($arp_if); }
+3 -3
View File
@@ -4,7 +4,7 @@ print_optionbar_start();
unset ($sep); 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`"); $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']; $type = $data['entSensorType'];
if (!$_GET['opta']) { $_GET['opta'] = $type; } if (!$_GET['opta']) { $_GET['opta'] = $type; }
@@ -20,11 +20,11 @@ unset ($sep);
print_optionbar_end(); print_optionbar_end();
$query = mysql_query("SELECT * FROM `entPhysical` WHERE device_id = '".$device['device_id']."' and entSensorType = '".$_GET['opta']."' ORDER BY `entPhysicalName`"); $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']) 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>"); echo("<div><h3>".$measured['entPhysicalName']." ".$data['entPhysicalName']."</h3>");
+1 -1
View File
@@ -17,7 +17,7 @@ if ($_POST['editing'])
} }
else else
{ {
include("includes/error-no-perm.inc.php"); include("includes/error-no-perm.inc.php");
} }
} }
+1 -1
View File
@@ -44,7 +44,7 @@ if ($_POST['editing'])
} }
else else
{ {
include("includes/error-no-perm.inc.php"); include("includes/error-no-perm.inc.php");
} }
} }
+1 -1
View File
@@ -17,7 +17,7 @@ if ($_POST['editing'])
} }
else else
{ {
include("includes/error-no-perm.inc.php"); include("includes/error-no-perm.inc.php");
} }
} }
+3 -6
View File
@@ -106,9 +106,8 @@ $(document).ready(function(){
$row=1; $row=1;
$query = mysql_query("SELECT * FROM `ports` WHERE device_id='".$device['device_id']."' ORDER BY `ifIndex` "); $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); $port = ifLabel($port);
if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
@@ -137,15 +136,13 @@ while ($port = mysql_fetch_array($query))
echo("</td>"); echo("</td>");
echo("<td align=left>".$port['ifAlias'] . "</td>"); echo("<td align=left>".$port['ifAlias'] . "</td>");
echo("</tr> echo("</tr>\n");
");
$row++; $row++;
} }
echo('</table>'); echo('</table>');
echo('</form>'); echo('</form>');
echo('</div>'); echo('</div>');
?> ?>
+2 -2
View File
@@ -28,7 +28,7 @@ if ($handle = opendir($config['install_dir'] . "/includes/services/"))
} }
$query = mysql_query("SELECT * FROM `devices` ORDER BY `hostname`"); $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>"; $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"; $i = "1";
$service_query = mysql_query("select * from services WHERE device_id = '".$device['device_id']."' ORDER BY service_type"); $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>"; $existform .= "<option value='" . $service['service_id'] . "'>" . $service['service_type'] . "</option>";
} }
+2 -2
View File
@@ -5,7 +5,7 @@ function printEntPhysical($ent, $level, $class)
global $device; global $device;
$query = mysql_query("SELECT * FROM `entPhysical` WHERE device_id = '".$device['device_id']."' AND entPhysicalContainedIn = '".$ent."' ORDER BY entPhysicalContainedIn,entPhysicalIndex"); $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(" echo("
<li class='$class'>"); <li class='$class'>");
@@ -27,7 +27,7 @@ function printEntPhysical($ent, $level, $class)
if ($ent['ifIndex']) 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); $ent['entPhysicalName'] = generate_port_link($interface);
} }
+1 -1
View File
@@ -4,7 +4,7 @@ $query = "SELECT *,DATE_FORMAT(datetime, '%D %b %Y %T') as humandate FROM `even
$data = mysql_query($query); $data = mysql_query($query);
echo('<table cellspacing="0" cellpadding="2" width="100%">'); 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"); include("includes/print-event.inc.php");
} }
+1 -1
View File
@@ -14,7 +14,7 @@ echo('<table cellspacing="0" cellpadding="5" width="100%">');
$row = 1; $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; } if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
+1 -1
View File
@@ -8,7 +8,7 @@ echo("<table width=100% cellpadding=6 cellspacing=0>");
$i = '1'; $i = '1';
$mempools = mysql_query("SELECT * FROM `mempools` WHERE device_id = '" . $device['device_id'] . "'"); $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; } if (!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
+1 -1
View File
@@ -7,7 +7,7 @@ echo("<table width=100% cellpadding=6 cellspacing=0>");
$i = '1'; $i = '1';
$procs = mysql_query("SELECT * FROM `processors` WHERE device_id = '" . $device['device_id'] . "'"); $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/"; $proc_url = "device/".$device['device_id']."/health/processors/";
+1 -1
View File
@@ -7,7 +7,7 @@ echo("<table cellspacing=0 cellpadding=5 width=100%>");
$row = 1; $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; } if (!is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
+1 -1
View File
@@ -16,7 +16,7 @@ echo("<tr class=tablehead>
$row = 1; $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; } if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
+4 -3
View File
@@ -3,7 +3,7 @@
echo("<table width=100%>"); echo("<table width=100%>");
$hrdevices = mysql_query("SELECT * FROM `hrDevice` WHERE `device_id` = '".$device['device_id']."' ORDER BY `hrDeviceIndex`"); $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>"); echo("<tr><td>".$hrdevice['hrDeviceIndex']."</td>");
@@ -30,8 +30,9 @@ while ($hrdevice = mysql_fetch_array($hrdevices))
echo('<td>'.$mini_graph.'</td>'); echo('<td>'.$mini_graph.'</td>');
} elseif ($hrdevice['hrDeviceType'] == "hrDeviceNetwork") { } elseif ($hrdevice['hrDeviceType'] == "hrDeviceNetwork") {
$int = str_replace("network interface ", "", $hrdevice['hrDeviceDescr']); $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."'")); $interface = mysql_fetch_assoc(mysql_query("SELECT * FROM ports WHERE device_id = '".$device['device_id']."' AND ifDescr = '".$int."'"));
if ($interface['ifIndex']) { if ($interface['ifIndex'])
{
echo("<td>".generate_port_link($interface)."</td>"); echo("<td>".generate_port_link($interface)."</td>");
$graph_array['height'] = "20"; $graph_array['height'] = "20";
+3 -3
View File
@@ -45,7 +45,7 @@ if ($services['total'])
$sql = "SELECT * FROM services WHERE device_id = '" . $device['device_id'] . "' ORDER BY service_type"; $sql = "SELECT * FROM services WHERE device_id = '" . $device['device_id'] . "' ORDER BY service_type";
$query = mysql_query($sql); $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] == "0" && $data[service_ignore] == "1") { $status = "grey"; }
if ($data[service_status] == "1" && $data[service_ignore] == "1") { $status = "green"; } 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("<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("<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%>"); 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("</table>");
echo("</div>"); echo("</div>");
} }
@@ -101,7 +101,7 @@ $data = mysql_query($query);
echo("<table cellspacing=0 cellpadding=2 width=100%>"); 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"); include("includes/print-event-short.inc.php");
} }
@@ -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>'); 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'; $i = '1';
echo('<table width="100%" valign="top">'); 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; } if (is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
+1 -1
View File
@@ -12,7 +12,7 @@ if (mysql_result(mysql_query("SELECT count(*) from mempools WHERE device_id = '"
$mempool_rows = '1'; $mempool_rows = '1';
$mempools = mysql_query("SELECT * FROM `mempools` WHERE device_id = '" . $device['device_id'] . "'"); $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; } 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); $perc = round($mempool['mempool_used'] / ($mempool['mempool_total']) * 100,2);
+1 -1
View File
@@ -48,7 +48,7 @@ if ($ports['total'])
$query = mysql_query($sql); $query = mysql_query($sql);
$ifsep = ""; $ifsep = "";
while ($data = mysql_fetch_array($query)) while ($data = mysql_fetch_assoc($query))
{ {
$data = ifNameDescr($data); $data = ifNameDescr($data);
$data = array_merge($data, $device); $data = array_merge($data, $device);
@@ -12,7 +12,7 @@ if (mysql_result(mysql_query("SELECT count(*) from processors WHERE device_id =
echo("<table width=100% cellspacing=0 cellpadding=5>"); echo("<table width=100% cellspacing=0 cellpadding=5>");
$i = '1'; $i = '1';
$procs = mysql_query("SELECT * FROM `processors` WHERE device_id = '" . $device['device_id'] . "' ORDER BY processor_descr ASC"); $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; } if (is_integer($processor_rows/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
+1 -1
View File
@@ -12,7 +12,7 @@ if (mysql_result(mysql_query("SELECT count(storage_id) from storage WHERE device
$drive_rows = '0'; $drive_rows = '0';
$drives = mysql_query("SELECT * FROM `storage` WHERE device_id = '" . $device['device_id'] . "' ORDER BY storage_descr ASC"); $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; $skipdrive = 0;
+4 -3
View File
@@ -6,9 +6,10 @@ $query = mysql_query($sql);
echo('<table border="0" cellspacing="0" cellpadding="5" width="100%">'); echo('<table border="0" cellspacing="0" cellpadding="5" width="100%">');
$i = "1"; $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; } 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_name = generate_device_link($arp_host); } else { unset($arp_name); }
if ($arp_host) { $arp_if = generate_port_link($arp_host); } else { unset($arp_if); } if ($arp_host) { $arp_if = generate_port_link($arp_host); } else { unset($arp_if); }
@@ -28,4 +29,4 @@ while ($arp = mysql_fetch_array($query)) {
echo('</table>'); echo('</table>');
?> ?>
+1 -1
View File
@@ -8,7 +8,7 @@ if (!$graph_type) { $graph_type = "atmvp_bits"; }
echo('<table cellspacing="0" cellpadding="5" border="0">'); echo('<table cellspacing="0" cellpadding="5" border="0">');
$vps = mysql_query("SELECT * FROM juniAtmVp WHERE interface_id = '".$interface['interface_id']."'"); $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; } if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
echo('<tr bgcolor="'.$row_colour.'">'); echo('<tr bgcolor="'.$row_colour.'">');
+4 -4
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 `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"); 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; } 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']); $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 ($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 ($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)) 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_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); } } else { unset ($peer_info); }
if ($peer_info) if ($peer_info)
+1 -1
View File
@@ -26,7 +26,7 @@ echo("<a href='/device/".$device['device_id']."/interface/".$interface['interfac
<img src='$yearly_traffic' border=0></a>"); <img src='$yearly_traffic' border=0></a>");
$members = mysql_query("SELECT * FROM `ports` WHERE `pagpGroupIfIndex` = '".$interface['ifIndex']."' and `device_id` = '".$device['device_id']."'"); $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>"); echo("$br<img src='images/16/brick_link.png' align=absmiddle> <strong>" . generate_port_link($member) . " (PAgP)</strong>");
$br = "<br />"; $br = "<br />";
+1 -1
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%>"); echo("<div style='margin: 5px;'><table cellpadding=7 border=0 cellspacing=0 width=100%>");
$i = "1"; $i = "1";
$service_query = mysql_query("select * from services WHERE device_id = '".$device['device_id']."' ORDER BY service_type"); $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"); include("includes/print-service.inc.php");
} }
+2 -2
View File
@@ -14,7 +14,7 @@ print_optionbar_start('25');
<option value="">All Programs</option> <option value="">All Programs</option>
<?php <?php
$query = mysql_query("SELECT `program` FROM `syslog` WHERE device_id = '" . $device['device_id'] . "' GROUP BY `program` ORDER BY `program`"); $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']."'"); echo("<option value='".$data['program']."'");
if ($data['program'] == $_POST['program']) { echo("selected"); } if ($data['program'] == $_POST['program']) { echo("selected"); }
echo(">".$data['program']."</option>"); 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"; $sql .= " ORDER BY timestamp DESC LIMIT 1000";
$query = mysql_query($sql); $query = mysql_query($sql);
echo("<table cellspacing=0 cellpadding=2 width=100%>"); 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("</table>");
?> ?>
+1 -1
View File
@@ -16,7 +16,7 @@ echo('<table border="0" cellspacing="0" cellpadding="5" width="100%">');
$i = "1"; $i = "1";
$vlan_query = mysql_query("select * from vlans WHERE device_id = '".$device['device_id']."' ORDER BY 'vlan_vlan'"); $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"); include("includes/print-vlan.inc.php");
$i++; $i++;
+1 -1
View File
@@ -5,7 +5,7 @@ echo('<table border="0" cellspacing="0" cellpadding="5" width="100%" class="sort
$i = "1"; $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"); $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"); include("includes/print-vm.inc.php");
$i++; $i++;
+1 -1
View File
@@ -14,7 +14,7 @@ print_optionbar_end();
echo("<div style='margin: 5px;'><table border=0 cellspacing=0 cellpadding=5 width=100%>"); echo("<div style='margin: 5px;'><table border=0 cellspacing=0 cellpadding=5 width=100%>");
$i = "0"; $i = "0";
$vrf_query = mysql_query("select * from vrfs WHERE device_id = '".$device['device_id']."' ORDER BY 'vrf_name'"); $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"); include("includes/print-vrf.inc.php");
$i++; $i++;
+4 -4
View File
@@ -28,7 +28,7 @@ print_optionbar_start(62);
<option value=''>All OSes</option> <option value=''>All OSes</option>
<?php <?php
$query = mysql_query("SELECT `os` FROM `devices` AS D WHERE 1 GROUP BY `os` ORDER BY `os`"); $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']) if ($data['os'])
{ {
@@ -44,7 +44,7 @@ while ($data = mysql_fetch_array($query))
<option value=''>All Versions</option> <option value=''>All Versions</option>
<?php <?php
$query = mysql_query("SELECT `version` FROM `devices` AS D WHERE 1 GROUP BY `version` ORDER BY `version`"); $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']) if ($data['version'])
{ {
@@ -61,7 +61,7 @@ while ($data = mysql_fetch_array($query))
<option value="">All Platforms</option> <option value="">All Platforms</option>
<?php <?php
$query = mysql_query("SELECT `hardware` FROM `devices` AS D WHERE 1 GROUP BY `hardware` ORDER BY `hardware`"); $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']) if ($data['hardware'])
{ {
@@ -77,7 +77,7 @@ while ($data = mysql_fetch_array($query))
<option value="">All Featuresets</option> <option value="">All Featuresets</option>
<?php <?php
$query = mysql_query("SELECT `features` FROM `devices` AS D WHERE 1 GROUP BY `features` ORDER BY `features`"); $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']) if ($data['features'])
{ {
+8 -8
View File
@@ -8,7 +8,7 @@ if ($_SESSION['userlevel'] != '10') { include("includes/error-no-perm.inc.php");
{ {
if ($_GET['user_id']) 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>"); echo("<p><h2>" . $user_data['realname'] . "</h2><a href='?page=edituser'>Change...</a></p>");
// Perform actions if requested // Perform actions if requested
@@ -61,7 +61,7 @@ if ($_SESSION['userlevel'] != '10') { include("includes/error-no-perm.inc.php");
echo("<h3>Device Access</h3>"); 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"); $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 />"); 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']; $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>"); <select name='device_id' class=selector>");
$device_list = mysql_query("SELECT * FROM `devices` ORDER BY hostname"); $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); unset($done);
foreach ($access_list as $ac) { if ($ac == $device['device_id']) { $done = 1; } } 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'] . $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"); "' 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 />". 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'] . "" . $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>"); <option value=''>Select a device</option>");
$device_list = mysql_query("SELECT * FROM `devices` ORDER BY hostname"); $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); unset($done);
foreach ($access_list as $ac) { if ($ac == $device['device_id']) { $done = 1; } } 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'] . $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"); "' 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=" . 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>"); $_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>"); <select name='bill_id' class=selector>");
$bills = mysql_query("SELECT * FROM `bills` ORDER BY `bill_name`"); $bills = mysql_query("SELECT * FROM `bills` ORDER BY `bill_name`");
while ($bill = mysql_fetch_array($bills)) while ($bill = mysql_fetch_assoc($bills))
{ {
unset($done); unset($done);
foreach ($bill_access_list as $ac) { if ($ac == $bill['bill_id']) { $done = 1; } } 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=''> echo("<form method='get' action=''>
<input type='hidden' value='edituser' name='page'> <input type='hidden' value='edituser' name='page'>
<select name='user_id'>"); <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>"); echo("<option value='" . $user_entry['user_id'] . "'>" . $user_entry['username'] . "</option>");
} }
+1 -1
View File
@@ -13,7 +13,7 @@ $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)) while ($entry = mysql_fetch_assoc($data))
{ {
include("includes/print-event.inc.php"); include("includes/print-event.inc.php");
} }
+22 -19
View File
@@ -15,7 +15,7 @@ $sql = mysql_query("SELECT * FROM `devices` WHERE `status` = '0' AND `ignore` =
} else { } 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'"); $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 /> 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 /> <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 :> ### 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']) if (!$interface['deleted'])
{ {
@@ -49,7 +49,7 @@ while ($interface = mysql_fetch_array($sql))
/* FIXME service permissions? seem nonexisting now.. */ /* 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'"); $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 /> 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> <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 { } 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"); $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 /> 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> <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 { } 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"); $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 /> 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 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> <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"; $sql = "SELECT *, DATE_FORMAT(timestamp, '%D %b %T') AS date from syslog ORDER BY timestamp DESC LIMIT 20";
$query = mysql_query($sql); $query = mysql_query($sql);
echo("<table cellspacing=0 cellpadding=2 width=100%>"); 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'])); $entry = array_merge($entry, device_by_id_cache($entry['device_id']));
include("includes/print-syslog.inc.php"); include("includes/print-syslog.inc.php");
} }
@@ -115,23 +118,23 @@ if ($config['enable_syslog'])
<h3>Recent Eventlog Entries</h3> <h3>Recent Eventlog Entries</h3>
"); ");
if ($_SESSION['userlevel'] == '10') if ($_SESSION['userlevel'] == '10')
{ {
$query = "SELECT *,DATE_FORMAT(datetime, '%D %b %T') as humandate FROM `eventlog` ORDER BY `datetime` DESC LIMIT 0,15"; $query = "SELECT *,DATE_FORMAT(datetime, '%D %b %T') as humandate FROM `eventlog` ORDER BY `datetime` DESC LIMIT 0,15";
} else { } else {
$query = "SELECT *,DATE_FORMAT(datetime, '%D %b %T') as humandate FROM `eventlog` AS E, devices_perms AS P WHERE E.host = $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"; 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)) { while ($entry = mysql_fetch_assoc($data)) {
include("includes/print-event.inc.php"); include("includes/print-event.inc.php");
} }
echo("</table>"); echo("</table>");
echo("</div>"); ## Close Syslog Div echo("</div>"); ## Close Syslog Div
} }
+57 -60
View File
@@ -33,64 +33,68 @@ while ($device = mysql_fetch_array($sql)){
} }
} }
if ($config['warn']['ifdown']) { 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'"); $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_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 (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 /> <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 /> <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 /> <strong>".generate_port_link($interface, makeshortif($interface['ifDescr']))."</strong><br />
<span class=body-date-1>".truncate($interface['ifAlias'], 15)."</span> <span class=body-date-1>".truncate($interface['ifAlias'], 15)."</span>
</div>"); </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'"); $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_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;'> 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 /> <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 /> <span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>Service Down</span><br />
<strong>".$service['service_type']."</strong><br /> <strong>".$service['service_type']."</strong><br />
<span class=body-date-1>".truncate($interface['ifAlias'], 15)."</span> <span class=body-date-1>".truncate($interface['ifAlias'], 15)."</span>
</center></div>"); </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"); $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_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;'> 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 /> <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 /> <span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>BGP Down</span><br />
<strong>".$peer['bgpPeerIdentifier']."</strong><br /> <strong>".$peer['bgpPeerIdentifier']."</strong><br />
<span class=body-date-1>AS".$peer['bgpPeerRemoteAs']." ".truncate($peer['astext'], 10)."</span> <span class=body-date-1>AS".$peer['bgpPeerRemoteAs']." ".truncate($peer['astext'], 10)."</span>
</div>"); </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'"); $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_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;'> 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 /> <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 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> <span class=body-date-1>".formatUptime($device['attrib_value'])."</span>
</div>"); </div>");
} }
} }
echo(" echo("
<div style='clear: both;'>$errorboxes</div> <div style='margin: 0px; clear: both;'> <div style='clear: both;'>$errorboxes</div> <div style='margin: 0px; clear: both;'>
<h3>Recent Syslog Messages</h3> <h3>Recent Syslog Messages</h3>
"); ");
$sql = "SELECT *, DATE_FORMAT(timestamp, '%D %b %T') AS date from `syslog` ORDER BY seq DESC LIMIT 20"; $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'])); $entry = array_merge($entry, device_by_id_cache($entry['device_id']));
include("includes/print-syslog.inc.php"); include("includes/print-syslog.inc.php");
} }
echo("</table>"); echo("</table>");
echo("</div> echo("</div>
</td> </td>
<td bgcolor=#e5e5e5 width=470 valign=top>"); <td bgcolor=#e5e5e5 width=470 valign=top>");
/// this stuff can be customised to show whatever you want.... /// this stuff can be customised to show whatever you want....
$ports['fileserver'] = "78"; $ports['fileserver'] = "78";
$ports['broadband'] = "228,251,182"; $ports['broadband'] = "228,251,182";
$ports['homeserver'] = "256,245,74"; $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;'>"); $graph_array['height'] = "100";
echo("<div style='font-size: 16px; font-weight: bold; color: #555555;'>Central Fileserver</div>"); $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['popup_title'] = "Central Fileserver";
$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"; print_graph_popup($graph_array);
print_graph_popup($graph_array);
echo("</div>");
}
echo("</div>"); 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('\ <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=".$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\'>\ <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>". <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>"); "<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('\ <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=".$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\'>\ <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>". <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>"); "<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('\ <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=".$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\'>\ <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>". <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>"); "<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('\ <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=".$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\'>\ <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>". <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>"); "<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('\ <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=".$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\'>\ <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>". <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>"); "<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('\ <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=".$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\'>\ <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>". <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>"); "<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> </td>
+21 -15
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'"); $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); unset($already);
$i = 0; $i = 0;
@@ -28,7 +28,7 @@ while ($device = mysql_fetch_array($sql))
} }
$sql = mysql_query("SELECT * FROM `devices` WHERE `status` = '0' AND `ignore` = '0'"); $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;'> 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 /> <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'"); $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;'> 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 /> <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'"); $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;'> 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 /> <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"); $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;'> 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 /> <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'"); $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;'> 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 /> <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"; $sql = "SELECT *, DATE_FORMAT(timestamp, '%D %b %T') AS date from syslog ORDER BY timestamp DESC LIMIT 20";
$query = mysql_query($sql); $query = mysql_query($sql);
echo("<table cellspacing=0 cellpadding=2 width=100%>"); 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("</table>");
@@ -108,13 +108,14 @@ echo("</div>
/// this stuff can be customised to show whatever you want.... /// 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 = "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"; $sql .= $config['mydomain'] . "' ORDER BY I.ifAlias";
$query = mysql_query($sql); $query = mysql_query($sql);
unset ($seperator); unset ($seperator);
while ($interface = mysql_fetch_array($query)) { while ($interface = mysql_fetch_assoc($query))
{
$ports['l2tp'] .= $seperator . $interface['interface_id']; $ports['l2tp'] .= $seperator . $interface['interface_id'];
$seperator = ","; $seperator = ",";
} }
@@ -123,7 +124,8 @@ if ($_SESSION['userlevel'] >= '5') {
$sql .= $config['mydomain'] . "' ORDER BY I.ifAlias"; $sql .= $config['mydomain'] . "' ORDER BY I.ifAlias";
$query = mysql_query($sql); $query = mysql_query($sql);
unset ($seperator); unset ($seperator);
while ($interface = mysql_fetch_array($query)) { while ($interface = mysql_fetch_assoc($query))
{
$ports['transit'] .= $seperator . $interface['interface_id']; $ports['transit'] .= $seperator . $interface['interface_id'];
$seperator = ","; $seperator = ",";
} }
@@ -132,12 +134,14 @@ if ($_SESSION['userlevel'] >= '5') {
$sql .= $config['mydomain'] . "' ORDER BY I.ifAlias"; $sql .= $config['mydomain'] . "' ORDER BY I.ifAlias";
$query = mysql_query($sql); $query = mysql_query($sql);
unset ($seperator); unset ($seperator);
while ($interface = mysql_fetch_array($query)) { while ($interface = mysql_fetch_assoc($query))
{
$ports['voip'] .= $seperator . $interface['interface_id']; $ports['voip'] .= $seperator . $interface['interface_id'];
$seperator = ","; $seperator = ",";
} }
if ($ports['transit']) { if ($ports['transit'])
{
echo("<a onmouseover=\"return overlib('<img src=\'graph.php?type=multi_bits&amp;ports=".$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();\" >". "&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>". "<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>"); "&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']. 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();\" >". "&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>". "<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>"); "&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']. 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();\" >". "&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>". "<div style='font-size: 18px; font-weight: bold;'>VoIP to PSTN</div>".
+9 -9
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'"); $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); unset($already);
$i = 0; $i = 0;
while ($i <= count($nodes)) { 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'"); $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'])) { 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;'> 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 /> <strong>".generate_device_link($device, shorthost($device['hostname']))."</strong><br />
@@ -36,7 +36,7 @@ while ($device = mysql_fetch_array($sql)){
if ($config['warn']['ifdown']) { 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'"); $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'])) { 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;'> 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 /> <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'"); $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'])) { 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;'> 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 /> <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"); $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'])) { 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;'> 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 /> <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'"); $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") { 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;'> 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 /> <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"; $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); $query = mysql_query($sql);
echo("<table cellspacing=0 cellpadding=2 width=100%>"); 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("</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"; $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); $query = mysql_query($sql);
unset ($seperator); unset ($seperator);
while ($interface = mysql_fetch_array($query)) { while ($interface = mysql_fetch_assoc($query)) {
$ports['transit'] .= $seperator . $interface['interface_id']; $ports['transit'] .= $seperator . $interface['interface_id'];
$seperator = ","; $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"; $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); $query = mysql_query($sql);
unset ($seperator); unset ($seperator);
while ($interface = mysql_fetch_array($query)) { while ($interface = mysql_fetch_assoc($query)) {
$ports['peering'] .= $seperator . $interface['interface_id']; $ports['peering'] .= $seperator . $interface['interface_id'];
$seperator = ","; $seperator = ",";
} }
+1 -1
View File
@@ -27,7 +27,7 @@ echo('<tr class=tablehead>
$row = 1; $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; } if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
+1 -1
View File
@@ -26,7 +26,7 @@ echo('<tr class=tablehead>
$row = 1; $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; } if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
+1 -1
View File
@@ -26,7 +26,7 @@ echo('<tr class=tablehead>
$row = 1; $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; } if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
+1 -1
View File
@@ -26,7 +26,7 @@ echo('<tr class=tablehead>
$row = 1; $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; } if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
+1 -1
View File
@@ -6,7 +6,7 @@ echo("<div style='margin-top: 5px; padding: 0px;'>");
echo("<table width=100% cellpadding=6 cellspacing=0>"); echo("<table width=100% cellpadding=6 cellspacing=0>");
$i = '1'; $i = '1';
$mempools = mysql_query("SELECT * FROM `mempools` AS M, `devices` as D WHERE D.device_id = M.device_id ORDER BY D.hostname"); $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'])) if (device_permitted($mempool['device_id']))
{ {
+2 -1
View File
@@ -6,7 +6,7 @@ echo("<div style='margin-top: 5px; padding: 0px;'>");
echo(" <table width=100% cellpadding=6 cellspacing=0>"); echo(" <table width=100% cellpadding=6 cellspacing=0>");
$i = '1'; $i = '1';
$procs = mysql_query("SELECT * FROM `processors` AS P, `devices` AS D WHERE D.device_id = P.device_id ORDER BY D.hostname"); $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'])) if (device_permitted($proc['device_id']))
{ {
@@ -14,6 +14,7 @@ while ($proc = mysql_fetch_array($procs))
$device = $proc; $device = $proc;
# FIXME should that really be done here? :-)
$text_descr = $proc['processor_descr']; $text_descr = $proc['processor_descr'];
$text_descr = str_replace("Routing Processor", "RP", $text_descr); $text_descr = str_replace("Routing Processor", "RP", $text_descr);
$text_descr = str_replace("Switching Processor", "SP", $text_descr); $text_descr = str_replace("Switching Processor", "SP", $text_descr);
+1 -1
View File
@@ -19,7 +19,7 @@ echo("<tr class=tablehead>
$row = 1; $row = 1;
while ($drive = mysql_fetch_array($query)) while ($drive = mysql_fetch_assoc($query))
{ {
if (device_permitted($drive['device_id'])) if (device_permitted($drive['device_id']))
{ {
+1 -1
View File
@@ -26,7 +26,7 @@ echo('<tr class=tablehead>
$row = 1; $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; } if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
+1 -1
View File
@@ -26,7 +26,7 @@ echo('<tr class=tablehead>
$row = 1; $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; } if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }

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