ports -> db*

git-svn-id: http://www.observium.org/svn/observer/trunk@2334 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2011-05-16 10:56:50 +00:00
parent 7577b9fa14
commit 69fc727785
3 changed files with 5 additions and 12 deletions

View File

@@ -4,9 +4,8 @@
echo("<tr><th>Port</th><th>Traffic</th><th>Sync Speed</th><th>Attainable Speed</th><th>Attenuation</th><th>SNR Margin</th><th>Output Powers</th></tr>");
$i = "0";
$interface_query = mysql_query("select * from `ports` AS P, `ports_adsl` AS A WHERE P.device_id = '".$device['device_id']."'".
" AND A.interface_id = P.interface_id AND P.deleted = '0' ORDER BY `ifIndex` ASC");
while ($interface = mysql_fetch_assoc($interface_query))
$ports = dbFetchRows("select * from `ports` AS P, `ports_adsl` AS A WHERE P.device_id = ? AND A.interface_id = P.interface_id AND P.deleted = '0' ORDER BY `ifIndex` ASC", array($device['device_id']));
foreach ($ports as $interface)
{
include("includes/print-interface-adsl.inc.php");
$i++;

View File

@@ -1,18 +1,15 @@
<?php
$sql = "SELECT * FROM ipv4_mac AS M, ports AS I WHERE I.interface_id = M.interface_id AND I.device_id = '".$device['device_id']."'";
$query = mysql_query($sql);
echo('<table border="0" cellspacing="0" cellpadding="5" width="100%">');
echo('<tr><th>Port</th><th>MAC address</th><th>IPv4 address</th><th>Remote device</th><th>Remote port</th></tr>');
$i = "1";
while ($arp = mysql_fetch_assoc($query))
foreach (dbFetchRows("SELECT * FROM ipv4_mac AS M, ports AS I WHERE I.interface_id = M.interface_id AND I.device_id = ?", array($device['device_id'])) as $arp)
{
if (!is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; }
$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"));
$arp_host = dbFetchRow("SELECT * FROM ipv4_addresses AS A, ports AS I, devices AS D WHERE A.ipv4_address = ? AND I.interface_id = A.interface_id AND D.device_id = I.device_id", array($arp['ipv4_address']));
if ($arp_host) { $arp_name = generate_device_link($arp_host); } else { unset($arp_name); }
if ($arp_host) { $arp_if = generate_port_link($arp_host); } else { unset($arp_if); }

View File

@@ -1,8 +1,5 @@
<?php
$sql = "SELECT * FROM links AS L, ports AS I WHERE I.device_id = '".$device['device_id']."' AND I.interface_id = L.local_interface_id";
$query = mysql_query($sql);
echo('<table border="0" cellspacing="0" cellpadding="5" width="100%">');
$i = "1";
@@ -13,7 +10,7 @@ echo('<tr><th>Local Port</th>
<th>Protocol</th>
</tr>');
while($neighbour = mysql_fetch_assoc($query))
foreach(dbFetchRows("SELECT * FROM links AS L, ports AS I WHERE I.device_id = ? AND I.interface_id = L.local_interface_id", array($device['device_id'])) as $neighbour)
{
if ($bg_colour == $list_colour_b) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; }