git-svn-id: http://www.observium.org/svn/observer/trunk@2329 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2011-05-16 09:38:44 +00:00
parent 8052ca36b2
commit 6c0d7a9c9a
10 changed files with 104 additions and 78 deletions

View File

@@ -30,7 +30,7 @@ if ($_POST['action'] == "update_bill")
{
if (dbUpdate(array('bill_name' => $_POST['bill_name'], 'bill_day' => $_POST['bill_day'], 'bill_gb' => $_POST['bill_gb'],
'bill_cdr' => $_POST['bill_cdr'], 'bill_type' => $_POST['bill_type']), 'bills', '`bill_id` = ?' array($bill_id)))
'bill_cdr' => $_POST['bill_cdr'], 'bill_type' => $_POST['bill_type']), 'bills', '`bill_id` = ?', array($bill_id)))
{
print_message("Bill Properties Updated");
}

View File

@@ -63,16 +63,16 @@ echo('
echo("<hr />");
$ports_array = mysql_query("SELECT * FROM `bill_ports` AS B, `ports` AS P, `devices` AS D
WHERE B.bill_id = '".$bill_data['bill_id']."' AND P.interface_id = B.port_id
AND D.device_id = P.device_id");
$ports = dbFetchRows("SELECT * FROM `bill_ports` AS B, `ports` AS P, `devices` AS D
WHERE B.bill_id = ? AND P.interface_id = B.port_id
AND D.device_id = P.device_id", array($bill_data['bill_id']));
if (mysql_affected_rows())
if (is_array($ports))
{
echo("<h3>Billed Ports</h3>");
echo("<table cellpadding=5 cellspacing=0>");
while ($port = mysql_fetch_assoc($ports_array))
foreach ($ports as $port)
{
if ($bg == $list_colour_a) { $bg = $list_colour_b; } else { $bg=$list_colour_a; }
echo("<tr style=\"background-color: $bg\">");
@@ -98,8 +98,8 @@ echo("<form action='' method='post'>
<td><select id='device' class='selector' name='device' onchange='getInterfaceList(this)'>
<option value=''>Select a device</option>");
$device_list = mysql_query("SELECT * FROM `devices` ORDER BY hostname");
while ($device = mysql_fetch_assoc($device_list))
$devices = dbFetchRows("SELECT * FROM `devices` ORDER BY hostname");
foreach ($devices as $device)
{
unset($done);
foreach ($access_list as $ac) { if ($ac == $device['device_id']) { $done = 1; } }

View File

@@ -6,8 +6,7 @@
<select name='device_id' id='device_id'>
<option value=''>All Devices</option>
<?php
$query = mysql_query("SELECT `device_id`,`hostname` FROM `devices` GROUP BY `hostname` ORDER BY `hostname`");
while ($data = mysql_fetch_assoc($query))
foreach (dbFetchRows("SELECT `device_id`,`hostname` FROM `devices` GROUP BY `hostname` ORDER BY `hostname`") as $dat)
{
echo("<option value='".$data['device_id']."'");
if ($data['device_id'] == $_POST['device_id']) { echo("selected"); }
@@ -36,8 +35,7 @@ while ($data = mysql_fetch_assoc($query))
<select name='ifSpeed' id='ifSpeed'>
<option value=''>All Speeds</option>
<?php
$query = mysql_query("SELECT `ifSpeed` FROM `ports` GROUP BY `ifSpeed` ORDER BY `ifSpeed`");
while ($data = mysql_fetch_assoc($query))
foreach (dbFetchRows("SELECT `ifSpeed` FROM `ports` GROUP BY `ifSpeed` ORDER BY `ifSpeed`") as $data)
{
if ($data['ifSpeed'])
{
@@ -53,8 +51,7 @@ while ($data = mysql_fetch_assoc($query))
<select name='ifType' id='ifType'>
<option value=''>All Media</option>
<?php
$query = mysql_query("SELECT `ifType` FROM `ports` GROUP BY `ifType` ORDER BY `ifType`");
while ($data = mysql_fetch_assoc($query))
foreach (dbFetchRows("SELECT `ifType` FROM `ports` GROUP BY `ifType` ORDER BY `ifType`") as $data)
{
if ($data['ifType'])
{
@@ -88,6 +85,8 @@ while ($data = mysql_fetch_assoc($query))
# $sql = "SELECT * FROM `ports` AS I, `devices` AS D, `devices_perms` AS P WHERE I.device_id = D.device_id AND D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' ORDER BY D.hostname, I.ifDescr";
#}
$param = array();
# FIXME block below is not totally used, at least the iftype stuff is bogus?
if ($_GET['opta'] == "down" || $_GET['type'] == "down" || $_POST['state'] == "down")
{
@@ -114,20 +113,37 @@ if ($_GET['opta'] == "down" || $_GET['type'] == "down" || $_POST['state'] == "do
$where .= " AND I.ifType = 'ppp'";
}
if (is_numeric($_POST['device_id'])) { $where .= " AND I.device_id = '".$_POST['device_id']."'"; }
if ($_POST['ifType']) { $where .= " AND I.ifType = '".mres($_POST['ifType'])."'"; }
if (is_numeric($_POST['ifSpeed'])) { $where .= " AND I.ifSpeed = '".$_POST['ifSpeed']."'"; }
if ($_POST['ifAlias']) { $where .= " AND I.ifAlias LIKE '%".mres($_POST['ifAlias'])."%'"; }
if (is_numeric($_POST['device_id']))
{
$where .= " AND I.device_id = ?";
$param[] = $_POST['device_id'];
}
if ($_POST['ifType'])
{
$where .= " AND I.ifType = ?";
$param[] = $_POST['ifType'];
}
if (is_numeric($_POST['ifSpeed']))
{
$where .= " AND I.ifSpeed = ?";
$param[] = $_POST['ifSpeed'];
}
if ($_POST['ifAlias']) {
$where .= " AND I.ifAlias LIKE ?";
$param[] = "%".$_POST['ifAlias']."%";
}
if ($_POST['deleted'] || $_GET['type'] == "deleted") { $where .= " AND I.deleted = '1'"; }
$sql = "SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id $where ORDER BY D.hostname, I.ifIndex";
$query = mysql_query($sql);
$query = "SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id ".$where." ORDER BY D.hostname, I.ifIndex";
echo("<tr class=tablehead><td></td><th>Device</a></th><th>Interface</th><th>Speed</th><th>Media</th><th>Description</th></tr>");
$row = 1;
while ($interface = mysql_fetch_assoc($query))
foreach (dbFetchRows($query, $param) as $interface)
{
if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }

View File

@@ -2,9 +2,7 @@
if ($_GET['optb'] == "purge" && $_GET['optc'] == "all")
{
$sql = "SELECT * FROM `ports` AS P, `devices` as D WHERE P.`deleted` = '1' AND D.device_id = P.device_id";
$query = mysql_query($sql);
while ($interface = mysql_fetch_assoc($query))
foreach (dbFetchRows("SELECT * FROM `ports` AS P, `devices` as D WHERE P.`deleted` = '1' AND D.device_id = P.device_id") as $interface)
{
if (port_permitted($interface['interface_id'], $interface['device_id']))
{
@@ -13,7 +11,7 @@ if ($_GET['optb'] == "purge" && $_GET['optc'] == "all")
}
}
} elseif ($_GET['optb'] == "purge" && $_GET['optc']) {
$interface = mysql_fetch_assoc(mysql_query("SELECT * from `ports` AS P, `devices` AS D WHERE `interface_id` = '".mres($_GET['optc'])."' AND D.device_id = P.device_id"));
$interface = dbFetchRow("SELECT * from `ports` AS P, `devices` AS D WHERE `interface_id` = ? AND D.device_id = P.device_id", array($_GET['optc']));
if (port_permitted($interface['interface_id'], $interface['device_id']))
delete_port($interface['interface_id']);
echo("<div class=infobox>Deleted ".generate_device_link($interface)." - ".generate_port_link($interface)."</div>");
@@ -24,9 +22,7 @@ $i_deleted = 1;
echo("<table cellpadding=5 cellspacing=0 border=0 width=100%>");
echo("<tr><td></td><td></td><td></td><td><a href='".$config['base_url'] . "/ports/deleted/purge/all/'><img src='images/16/cross.png' align=absmiddle></img> Purge All</a></td></tr>");
$sql = "SELECT * FROM `ports` AS P, `devices` as D WHERE P.`deleted` = '1' AND D.device_id = P.device_id";
$query = mysql_query($sql);
while ($interface = mysql_fetch_assoc($query))
foreach (dbFetchRows("SELECT * FROM `ports` AS P, `devices` as D WHERE P.`deleted` = '1' AND D.device_id = P.device_id") as $interface)
{
$interface = ifLabel($interface, $interface);
if (port_permitted($interface['interface_id'], $interface['device_id']))
@@ -45,4 +41,4 @@ while ($interface = mysql_fetch_assoc($query))
echo("</table>");
?>
?>

View File

@@ -104,8 +104,8 @@ else
$where = "AND D.bgpLocalAs = B.bgpPeerRemoteAs";
}
$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_assoc($peer_query))
$peer_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";
foreach(dbFetchRows($peer_query) as $peer)
{
unset ($alert, $bg_image);
@@ -118,7 +118,7 @@ else
if ($peer['bgpPeerRemoteAS'] >= '64512' && $peer['bgpPeerRemoteAS'] <= '65535') { $peer_type = "<span style='color: #f00;'>Priv eBGP</span>"; }
}
$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"));
$peerhost = dbFetchRow("SELECT * FROM ipaddr AS A, ports AS I, devices AS D WHERE A.addr = ? AND I.interface_id = A.interface_id AND D.device_id = I.device_id", array($peer['bgpPeerIdentifier']));
if ($peerhost) { $peername = generate_device_link($peerhost, shorthost($peerhost['hostname'])); } else { unset($peername); }
@@ -134,10 +134,8 @@ else
echo('<tr bgcolor="'.$bg_colour.'"' . ($peer['alert'] ? ' bordercolor="#cc0000"' : '') . ($peer['disabled'] ? ' bordercolor="#cccccc"' : '') . ">");
$af_query = mysql_query("SELECT * FROM `bgpPeers_cbgp` WHERE `device_id` = '".$peer['device_id']."' AND bgpPeerIdentifier = '".$peer['bgpPeerIdentifier']."'");
unset($sep);
while ($afisafi = mysql_fetch_assoc($af_query))
foreach (dbFetchRows("SELECT * FROM `bgpPeers_cbgp` WHERE `device_id` = ? AND bgpPeerIdentifier = ?", array($peer['device_id'], $peer['bgpPeerIdentifier'])) as $afisafi)
{
$afi = $afisafi['afi'];
$safi = $afisafi['safi'];
@@ -181,7 +179,7 @@ else
{
case 'macaccounting_bits':
case 'macaccounting_pkts':
$acc = mysql_fetch_assoc(mysql_query("SELECT * FROM `ipv4_mac` AS I, `mac_accounting` AS M, `ports` AS P, `devices` AS D WHERE I.ipv4_address = '".$peer['bgpPeerIdentifier']."' AND M.mac = I.mac_address AND P.interface_id = M.interface_id AND D.device_id = P.device_id"));
$acc = dbFetchRow("SELECT * FROM `ipv4_mac` AS I, `mac_accounting` AS M, `ports` AS P, `devices` AS D WHERE I.ipv4_address = ? AND M.mac = I.mac_address AND P.interface_id = M.interface_id AND D.device_id = P.device_id", array($peer['bgpPeerIdentifier']));
$database = $config['rrd_dir'] . "/" . $device['hostname'] . "/cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd";
if (is_array($acc) && is_file($database))
{

View File

@@ -16,15 +16,16 @@ while ($instance = mysql_fetch_assoc($query))
$device = device_by_id_cache($instance['device_id']);
$area_count = mysql_result(mysql_query("SELECT COUNT(*) FROM `ospf_areas` WHERE `device_id` = '".$device['device_id']."'"),0);
$port_count = mysql_result(mysql_query("SELECT COUNT(*) FROM `ospf_ports` WHERE `device_id` = '".$device['device_id']."'"),0);
$port_count_enabled = mysql_result(mysql_query("SELECT COUNT(*) FROM `ospf_ports` WHERE `ospfIfAdminStat` = 'enabled' AND `device_id` = '".$device['device_id']."'"),0);
$neighbour_count = mysql_result(mysql_query("SELECT COUNT(*) FROM `ospf_nbrs` WHERE `device_id` = '".$device['device_id']."'"),0);
$area_count = dbFetchCell("SELECT COUNT(*) FROM `ospf_areas` WHERE `device_id` = '".$device['device_id']."'");
$port_count = dbFetchCell("SELECT COUNT(*) FROM `ospf_ports` WHERE `device_id` = '".$device['device_id']."'");
$port_count_enabled = dbFetchCell("SELECT COUNT(*) FROM `ospf_ports` WHERE `ospfIfAdminStat` = 'enabled' AND `device_id` = '".$device['device_id']."'");
$neighbour_count = dbFetchCell("SELECT COUNT(*) FROM `ospf_nbrs` WHERE `device_id` = '".$device['device_id']."'");
$ip_query = "SELECT * FROM ipv4_addresses AS A, ports AS I WHERE ";
$ip_query .= "(A.ipv4_address = '".$peer['bgpPeerIdentifier']."' AND I.interface_id = A.interface_id)";
$ip_query .= " AND I.device_id = '".$device['device_id']."'";
$ipv4_host = mysql_fetch_assoc(mysql_query($ip_query));
$ip_query .= "(A.ipv4_address = ? AND I.interface_id = A.interface_id)";
$ip_query .= " AND I.device_id = ?";
$ipv4_host = dbFetchArray($ip_query, array($peer['bgpPeerIdentifier'], $device['device_id']));
if ($instance['ospfAdminStat'] == "enabled") { $enabled = '<span style="color: #00aa00">enabled</span>'; } else { $enabled = '<span style="color: #aaaaaa">disabled</span>'; }
if ($instance['ospfAreaBdrRtrStatus'] == "true") { $abr = '<span style="color: #00aa00">yes</span>'; } else { $abr = '<span style="color: #aaaaaa">no</span>'; }

View File

@@ -45,8 +45,7 @@ if($_GET['optb'] == "all" ) {
echo("<div style='margin: 5px;'><table border=0 cellspacing=0 cellpadding=5 width=100%>");
$i = "1";
$vrf_query = mysql_query("SELECT * FROM `vrfs` GROUP BY `mplsVpnVrfRouteDistinguisher`");
while ($vrf = mysql_fetch_assoc($vrf_query))
foreach (dbFetchRows("SELECT * FROM `vrfs` GROUP BY `mplsVpnVrfRouteDistinguisher`") as $vrf)
{
if (!is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; }
echo("<tr valign=top bgcolor='$bg_colour'>");
@@ -68,10 +67,9 @@ if($_GET['optb'] == "all" ) {
if ($device['vrf_name'] != $vrf['vrf_name']) { echo("<a href='#' onmouseover=\" return overlib('Expected Name : ".$vrf['vrf_name']."<br />Configured : ".$device['vrf_name']."', CAPTION, '<span class=list-large>VRF Inconsistency</span>' ,FGCOLOR,'#e5e5e5', BGCOLOR, '#c0c0c0', BORDER, 5, CELLPAD, 4, CAPCOLOR, '#050505');\" onmouseout=\"return nd();\"> <img align=absmiddle src=images/16/exclamation.png></a>"); }
echo("</td><td>");
$ports = mysql_query("SELECT * FROM `ports` WHERE `ifVrf` = '".$device['vrf_id']."' and device_id = '".$device['device_id']."'");
unset($seperator);
while ($port = mysql_fetch_assoc($ports))
foreach(dbFetchRows("SELECT * FROM `ports` WHERE `ifVrf` = ? AND `device_id` = ?", array($device['vrf_id'], $device['device_id'])) as $port)
{
$port = array_merge ($device, $port);
@@ -114,29 +112,27 @@ if($_GET['optb'] == "all" ) {
} else {
echo("<div style='background: $list_colour_a; padding: 10px;'><table border=0 cellspacing=0 cellpadding=5 width=100%>");
$vrf_query = mysql_query("SELECT * FROM `vrfs` WHERE mplsVpnVrfRouteDistinguisher = '".$_GET['optb']."'");
$vrf = mysql_fetch_assoc($vrf_query);
$vrf = dbFetchRow("SELECT * FROM `vrfs` WHERE mplsVpnVrfRouteDistinguisher = ?", array($_GET['optb']));
echo("<tr valign=top bgcolor='$bg_colour'>");
echo("<td width=200 class=list-large><a href='routing/vrf/".$vrf['mplsVpnVrfRouteDistinguisher']."/".$_GET['optc']."/'>" . $vrf['vrf_name'] . "</a></td>");
echo("<td width=100 class=box-desc>" . $vrf['mplsVpnVrfRouteDistinguisher'] . "</td>");
echo("<td width=200 class=box-desc>" . $vrf['mplsVpnVrfDescription'] . "</td>");
echo("</table></div>");
$devices = mysql_query("SELECT * FROM `vrfs` AS V, `devices` AS D WHERE `mplsVpnVrfRouteDistinguisher` = '".$vrf['mplsVpnVrfRouteDistinguisher']."' AND D.device_id = V.device_id");
$x=0;
while ($device = mysql_fetch_assoc($devices))
$devices = dbFetchRows("SELECT * FROM `vrfs` AS V, `devices` AS D WHERE `mplsVpnVrfRouteDistinguisher` = ? AND D.device_id = V.device_id", array($vrf['mplsVpnVrfRouteDistinguisher']));
foreach ($devices as $device)
{
$hostname = $device['hostname'];
if (!is_integer($x/2)) { $device_colour = $list_colour_a; } else { $device_colour = $list_colour_b; }
echo("<table cellpadding=10 cellspacing=0 class=devicetable width=100%>");
include("includes/device-header.inc.php");
echo("</table>");
$ports = mysql_query("SELECT * FROM `ports` WHERE `ifVrf` = '".$device['vrf_id']."' and device_id = '".$device['device_id']."'");
unset($seperator);
echo('<div style="margin: 0 0 0 60px;"><table cellspacing=0 cellpadding=7>');
$i=1;
while ($interface = mysql_fetch_assoc($ports))
foreach (dbFetchRows("SELECT * FROM `ports` WHERE `ifVrf` = ? AND `device_id` = ?", array($device['vrf_id'], $device['device_id'])) as $interface)
{
if (!is_integer($x/2))
{

View File

@@ -7,8 +7,7 @@
<select name="device_id" id="device_id">
<option value="">All Devices</option>
<?php
$query = mysql_query("SELECT `device_id`,`hostname` FROM `devices` GROUP BY `hostname` ORDER BY `hostname`");
while ($data = mysql_fetch_assoc($query))
foreach (dbFetchRows("SELECT `device_id`,`hostname` FROM `devices` GROUP BY `hostname` ORDER BY `hostname`") as $data)
{
echo('<option value="'.$data['device_id'].'"');
if ($data['device_id'] == $_POST['device_id']) { echo("selected"); }
@@ -40,18 +39,25 @@ print_optionbar_end();
echo('<table width="100%" cellspacing="0" cellpadding="5">');
if (is_numeric($_POST['device_id'])) { $where .= " AND I.device_id = '".$_POST['device_id']."'"; }
if ($_POST['interface']) { $where .= " AND I.ifDescr LIKE '".mres($_POST['interface'])."'"; }
$query = "SELECT * FROM `ipv4_addresses` AS A, `ports` AS I, `devices` AS D, `ipv4_networks` AS N WHERE I.interface_id = A.interface_id AND I.device_id = D.device_id AND N.ipv4_network_id = A.ipv4_network_id ";
$sql = "SELECT * FROM `ipv4_addresses` AS A, `ports` AS I, `devices` AS D, `ipv4_networks` AS N WHERE I.interface_id = A.interface_id AND I.device_id = D.device_id AND N.ipv4_network_id = A.ipv4_network_id $where ORDER BY A.ipv4_address";
$query = mysql_query($sql);
if (is_numeric($_POST['device_id']))
{
$query .= " AND I.device_id = ?";
$param[] = $_POST['device_id'];
}
if ($_POST['interface'])
{
$query .= " AND I.ifDescr LIKE ?";
$param[] = $_POST['interface'];
}
$query .= " ORDER BY A.ipv4_address";
echo('<tr class="tablehead"><th>Device</a></th><th>Interface</th><th>Address</th><th>Description</th></tr>');
$row = 1;
while ($interface = mysql_fetch_assoc($query))
foreach (dbFetchRows($query, $param) as $interface)
{
if ($_POST['address'])
{

View File

@@ -7,8 +7,7 @@
<select name="device_id" id="device_id">
<option value="">All Devices</option>
<?php
$query = mysql_query("SELECT `device_id`,`hostname` FROM `devices` GROUP BY `hostname` ORDER BY `hostname`");
while ($data = mysql_fetch_assoc($query))
foreach (dbFetchRows("SELECT `device_id`,`hostname` FROM `devices` GROUP BY `hostname` ORDER BY `hostname`") as $data)
{
echo('<option value="'.$data['device_id'].'"');
if ($data['device_id'] == $_POST['device_id']) { echo("selected"); }
@@ -40,18 +39,25 @@ print_optionbar_end();
echo('<table width="100%" cellspacing="0" cellpadding="5">');
if (is_numeric($_POST['device_id'])) { $where .= " AND I.device_id = '".$_POST['device_id']."'"; }
if ($_POST['interface']) { $where .= " AND I.ifDescr LIKE '".mres($_POST['interface'])."'"; }
$query = "SELECT * FROM `ipv6_addresses` AS A, `ports` AS I, `devices` AS D, `ipv6_networks` AS N WHERE I.interface_id = A.interface_id AND I.device_id = D.device_id AND N.ipv6_network_id = A.ipv6_network_id ";
$sql = "SELECT * FROM `ipv6_addresses` AS A, `ports` AS I, `devices` AS D, `ipv6_networks` AS N WHERE I.interface_id = A.interface_id AND I.device_id = D.device_id AND N.ipv6_network_id = A.ipv6_network_id $where ORDER BY A.ipv6_address";
$query = mysql_query($sql);
if (is_numeric($_POST['device_id']))
{
$query .= " AND I.device_id = ?";
$param[] = $_POST['device_id'];
}
if ($_POST['interface'])
{
$query .= " AND I.ifDescr LIKE ?";
$param[] = $_POST['interface'];
}
$query .= " ORDER BY A.ipv6_address";
echo('<tr class="tablehead"><th>Device</a></th><th>Interface</th><th>Address</th><th>Description</th></tr>');
$row = 1;
while ($interface = mysql_fetch_assoc($query))
foreach (dbFetchRows($query, $param) as $interface)
{
if ($_POST['address'])
{

View File

@@ -7,8 +7,7 @@
<select name="device_id" id="device_id">
<option value="">All Devices</option>
<?php
$query = mysql_query("SELECT `device_id`,`hostname` FROM `devices` GROUP BY `hostname` ORDER BY `hostname`");
while ($data = mysql_fetch_assoc($query))
foreach (dbFetchRows("SELECT `device_id`,`hostname` FROM `devices` GROUP BY `hostname` ORDER BY `hostname`") as $data)
{
echo('<option value="'.$data['device_id'].'"');
if ($data['device_id'] == $_POST['device_id']) { echo("selected"); }
@@ -40,17 +39,25 @@ print_optionbar_end();
echo('<table width="100%" cellspacing="0" cellpadding="5">');
$where = "AND `ifPhysAddress` LIKE '%".str_replace(':','',mres($_POST['address']))."%'";
if (is_numeric($_POST['device_id'])) { $where .= " AND I.device_id = '".$_POST['device_id']."'"; }
if ($_POST['interface']) { $where .= " AND I.ifDescr LIKE '".mres($_POST['interface'])."'"; }
$query = "SELECT * FROM `ports` AS P, `devices` AS D WHERE P.device_id = D.device_id ";
$query .= "AND `ifPhysAddress` LIKE ?";
$param = array("%".str_replace(':','',mres($_POST['address']))."%");
$sql = "SELECT * FROM `ports` AS P, `devices` AS D WHERE P.device_id = D.device_id $where ORDER BY P.ifPhysAddress";
$query = mysql_query($sql);
if (is_numeric($_POST['device_id']))
{
$query .= " AND I.device_id = ?";
$param[] = $_POST['device_id'];
}
if ($_POST['interface'])
{
$query .= " AND I.ifDescr LIKE ?";
$param[] = $_POST['interface'];
}
$query .= " ORDER BY P.ifPhysAddress";
echo('<tr class="tablehead"><th>Device</a></th><th>Interface</th><th>MAC Address</th><th>Description</th></tr>');
$row = 1;
while ($entry = mysql_fetch_assoc($query))
foreach (dbFetchRows($query, $param) as $entry)
{
if (!$ignore)