diff --git a/html/includes/print-interface.inc b/html/includes/print-interface.inc index c47653d58..e1a735273 100644 --- a/html/includes/print-interface.inc +++ b/html/includes/print-interface.inc @@ -60,9 +60,9 @@ echo(""); $adj_query = mysql_query("$adj_sql"); while($adjs = mysql_fetch_array($adj_query)) { $network_id = $adjs['network_id']; - $newsql = "SELECT *, I.interface_id AS iid, D.id AS did FROM adjacencies AS A, networks as N, interfaces as I, devices as D "; - $newsql = $newsql . "WHERE N.id = '$network_id' AND A.network_id = N.id AND I.interface_id = A.interface_id AND D.id = I.device_id "; - $newsql = $newsql . "AND D.id != '$device[id]' AND I.ifDescr NOT LIKE '%loopback%' GROUP BY D.id ORDER BY D.hostname"; + $newsql = "SELECT * FROM adjacencies AS A, networks as N, interfaces as I, devices as D "; + $newsql = $newsql . "WHERE N.id = '$network_id' AND A.network_id = N.id AND I.interface_id = A.interface_id AND D.device_id = I.device_id "; + $newsql = $newsql . "AND D.device_id != '$device[id]' AND I.ifDescr NOT LIKE '%loopback%' GROUP BY D.device_id ORDER BY D.hostname"; $new_query = mysql_query($newsql); while($new = mysql_fetch_array($new_query)) { if ($new['status'] == '0') { $class = "red"; } else { $class = "blue"; } @@ -70,8 +70,8 @@ echo(""); $class = "grey"; if ($new['status'] == '1') { $class = "green"; } } - $this_ifid = $new['iid']; - $this_hostid = $new['did']; + $this_ifid = $new['interface_id']; + $this_hostid = $new['device_id']; $this_hostname = $new['hostname']; $this_ifname = fixifName($new['ifDescr']); $wq = mysql_query("select count(*) FROM links WHERE dst_if = '$this_ifid' AND src_if = $if_id;"); diff --git a/test.php b/test.php index e798b841b..7ae17766a 100755 --- a/test.php +++ b/test.php @@ -4,15 +4,11 @@ include("config.php"); -$srvdir = $installdir . "/includes/services/"; +$data = `snmptable -Ov -v2c -c v05tr0n82 sotsci-sw01 ifTable`; + +$data = trim(preg_replace("/(\ +)/", " ", $data)); + +echo("$data"); -if ($handle = opendir($srvdir)) { - while (false !== ($file = readdir($handle))) { - if ($file != "." && $file != "..") { - echo "$file\n"; - } - } - closedir($handle); -} ?>