diff --git a/html/pages/device/ports/adsl.inc.php b/html/pages/device/ports/adsl.inc.php index 13b0641ea..a63caf65b 100644 --- a/html/pages/device/ports/adsl.inc.php +++ b/html/pages/device/ports/adsl.inc.php @@ -4,9 +4,8 @@ echo("PortTrafficSync SpeedAttainable SpeedAttenuationSNR MarginOutput Powers"); $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++; diff --git a/html/pages/device/ports/arp.inc.php b/html/pages/device/ports/arp.inc.php index 0491c4ba8..c484a5db7 100644 --- a/html/pages/device/ports/arp.inc.php +++ b/html/pages/device/ports/arp.inc.php @@ -1,18 +1,15 @@ '); echo('PortMAC addressIPv4 addressRemote deviceRemote port'); $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); } diff --git a/html/pages/device/ports/neighbours.inc.php b/html/pages/device/ports/neighbours.inc.php index 2b455bcaf..ebcee1189 100644 --- a/html/pages/device/ports/neighbours.inc.php +++ b/html/pages/device/ports/neighbours.inc.php @@ -1,8 +1,5 @@ '); $i = "1"; @@ -13,7 +10,7 @@ echo('Local Port Protocol '); -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; }