2009-08-07 16:10:52 +00:00
< div style = 'margin:auto; text-align: center; margin-top: 10px;' >
< b class = 'rounded' >
2010-01-09 00:17:02 +00:00
< b class = 'rounded1' ></ b >
< b class = 'rounded2' ></ b >
2009-08-07 16:10:52 +00:00
< b class = 'rounded3' ></ b >
< b class = 'rounded4' ></ b >
< b class = 'rounded5' ></ b ></ b >
< div class = 'roundedfg' style = 'padding: 0px 5px;' >
< div style = 'margin: auto; padding:5px;' >
< table style = "text-align: left;" cellpadding = 0 cellspacing = 5 class = devicetable width = 100 %>
< tr style = 'padding: 0px;' >
2009-03-27 09:04:21 +00:00
< form method = 'post' action = '' >
2009-08-07 16:10:52 +00:00
< td width = '200' >
2009-03-27 09:04:21 +00:00
< 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_array ( $query )) {
echo ( "<option value='" . $data [ 'device_id' ] . "'" );
if ( $data [ 'device_id' ] == $_POST [ 'device_id' ]) { echo ( "selected" ); }
echo ( ">" . $data [ 'hostname' ] . "</option>" );
}
?>
</select>
</td>
2009-08-07 16:10:52 +00:00
<td width='150'>
2009-03-27 09:04:21 +00:00
<select name='state' id='state'>
<option value=''>All States</option>
<option value='up' <?php if($_POST['state'] == "up") { echo("selected"); } ?>>Up</option>
<option value='down'<?php if($_POST['state'] == "down") { echo("selected"); } ?>>Down</option>
<option value='admindown' <?php if($_POST['state'] == "admindown") { echo("selected"); } ?>>Shutdown</option>
<option value='errors' <?php if($_POST['state'] == "errors") { echo("selected"); } ?>>Errors</option>
2009-08-07 16:10:52 +00:00
<option value='ethernet' <?php if($_POST['state'] == "ethernet") { echo("selected"); } ?>>Ethernet</option>
<option value='l2vlan' <?php if($_POST['state'] == "l2vlan") { echo("selected"); } ?>>L2 VLAN</option>
<option value='sonet' <?php if($_POST['state'] == "sonet") { echo("selected"); } ?>>SONET</option>
<option value='propvirtual' <?php if($_POST['state'] == "propvirtual") { echo("selected"); } ?>>Virtual</option>
<option value='ppp' <?php if($_POST['state'] == "ppp") { echo("selected"); } ?>>PPP</option>
<option value='loopback' <?php if($_POST['state'] == "loopback") { echo("selected"); } ?>>Loopback</option>
2009-03-27 09:04:21 +00:00
</select>
</td>
2009-08-07 16:10:52 +00:00
<td width=110>
2009-03-27 09:04:21 +00:00
<select name='ifSpeed' id='ifSpeed'>
<option value=''>All Speeds</option>
<?php
$query = mysql_query("SELECT `ifSpeed` FROM `interfaces` GROUP BY `ifSpeed` ORDER BY `ifSpeed`");
while($data = mysql_fetch_array($query)) {
echo("<option value='".$data['ifSpeed']."'");
if($data['ifSpeed'] == $_POST['ifSpeed']) { echo("selected"); }
echo(">".humanspeed($data['ifSpeed'])."</option>");
}
?>
</select>
</td>
2009-08-07 16:10:52 +00:00
<td width=200>
2009-03-27 09:04:21 +00:00
<select name='ifType' id='ifType'>
<option value=''>All Media</option>
<?php
$query = mysql_query("SELECT `ifType` FROM `interfaces` GROUP BY `ifType` ORDER BY `ifType`");
while($data = mysql_fetch_array($query)) {
echo("<option value='".$data['ifType']."'");
if($data['ifType'] == $_POST['ifType']) { echo("selected"); }
echo(">".$data['ifType']."</option>");
}
?>
</select>
</td>
<td>
<input type="text" name="ifAlias" id="ifAlias" size=40 value="<?php echo($_POST['ifAlias']); ?>" />
2009-04-03 08:11:41 +00:00
Deleted <input type=checkbox id="deleted" name="deleted" value=1 <?php if($_POST['deleted']) { echo("checked"); } ?> ></input>
2009-08-07 16:10:52 +00:00
</td>
<td style="text-align: right;">
2009-03-27 09:04:21 +00:00
<input style="align:right;" type=submit value=Search></div>
</td>
</form>
</tr>
2009-08-07 16:10:52 +00:00
</table>
</div>
</div>
<b class='rounded'>
<b class='rounded5'></b>
<b class='rounded4'></b>
<b class='rounded3'></b>
2010-01-09 00:17:02 +00:00
<b class='rounded2'></b>
<b class='rounded1'></b></b>
2009-08-07 16:10:52 +00:00
</div>
<table cellpadding=3 cellspacing=0 class=devicetable width=100%>
2009-03-27 09:04:21 +00:00
2007-04-03 14:10:23 +00:00
<?php
2008-04-03 19:04:24 +00:00
#if ($_SESSION['userlevel'] >= '5') {
2009-03-27 09:04:21 +00:00
# $sql = "SELECT * FROM `interfaces` AS I, `devices` AS D WHERE I.device_id = D.device_id ORDER BY D.hostname, I.ifDescr";
2008-04-03 19:04:24 +00:00
#} else {
# $sql = "SELECT * FROM `interfaces` 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";
#}
2009-03-27 09:04:21 +00:00
if($_GET['type'] == "down" || $_POST['state'] == "down") {
$where .= "AND I.ifAdminStatus = 'up' AND I.ifOperStatus = 'down'";
} elseif ($_GET['type'] == "admindown" || $_POST['state'] == "admindown") {
$where .= "AND I.ifAdminStatus = 'down'";
} elseif ($_GET['type'] == "errors" || $_POST['state'] == "errors") {
2009-10-28 13:49:37 +00:00
$where .= "AND ( I.`ifInErrors_delta` > '0' OR I.`ifOutErrors_delta` > '0' )";
2009-03-27 09:04:21 +00:00
} elseif ($_GET['type'] == "up" || $_POST['state'] == "up") {
$where .= "AND I.ifOperStatus = 'up'";
2009-08-07 16:10:52 +00:00
} elseif ($_GET['type'] == "l2vlan" || $_POST['state'] == "l2vlan") {
$where .= " AND I.ifType = 'l2vlan'";
} elseif ($_GET['type'] == "ethernet" || $_POST['state'] == "ethernet") {
$where .= " AND I.ifType = 'ethernetCsmacd'";
} elseif ($_GET['type'] == "loopback" || $_POST['state'] == "loopback") {
$where .= " AND I.ifType = 'softwareLoopback'";
} elseif ($_GET['typee'] == "sonet" || $_POST['state'] == "sonet") {
$where .= " AND I.ifType = 'sonet'";
} elseif ($_POST['state'] == "propvirtual") {
$where .= " AND I.ifType = 'propVirtual'";
} elseif ($_POST['state'] == "ppp") {
$where .= " AND I.ifType = 'ppp'";
2007-06-24 14:56:47 +00:00
}
2009-08-07 16:10:52 +00:00
2009-03-27 09:04:21 +00:00
if($_POST['device_id']) { $where .= " AND I.device_id = '".$_POST['device_id']."'"; }
if($_POST['ifType']) { $where .= " AND I.ifType = '".$_POST['ifType']."'"; }
if($_POST['ifSpeed']) { $where .= " AND I.ifSpeed = '".$_POST['ifSpeed']."'"; }
if($_POST['ifAlias']) { $where .= " AND I.ifAlias LIKE '%".$_POST['ifAlias']."%'"; }
2009-04-03 08:11:41 +00:00
if($_POST['deleted'] || $_GET['type'] == "deleted") { $where .= " AND I.deleted = '1'"; }
2008-04-03 19:04:24 +00:00
2009-03-27 09:04:21 +00:00
$sql = "SELECT * FROM `interfaces` AS I, `devices` AS D WHERE I.device_id = D.device_id $where ORDER BY D.hostname, I.ifIndex";
$query = mysql_query($sql);
2007-04-03 14:10:23 +00:00
2009-08-07 16:10:52 +00:00
echo("<tr class=tablehead><td></td><th>Device</a></th><th>Interface</th><th>Speed</th><th>Media</th><th>Description</th></tr>");
2007-04-03 14:10:23 +00:00
$row = 1;
2007-04-07 21:15:23 +00:00
while($interface = mysql_fetch_array($query)) {
2007-04-03 14:10:23 +00:00
if(is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
2007-04-07 21:15:23 +00:00
$speed = humanspeed($interface['ifSpeed']);
$type = humanmedia($interface['ifType']);
2007-04-03 14:10:23 +00:00
2007-06-24 14:56:47 +00:00
if($interface['in_errors'] > 0 || $interface['out_errors'] > 0) {
2008-03-12 19:50:05 +00:00
$error_img = generateiflink($interface,"<img src='images/16/chart_curve_error.png' alt='Interface Errors' border=0>",errors);
2007-06-24 14:56:47 +00:00
} else { $error_img = ""; }
2008-11-05 16:09:47 +00:00
if( interfacepermitted($interface['interface_id']) )
{
echo("<tr bgcolor=$row_colour>
2009-08-07 16:10:52 +00:00
<td width=5></td>
<td width=200 class=list-bold>" . generatedevicelink($interface) . "</td>
<td width=150 class=list-bold>" . generateiflink($interface, makeshortif(fixifname($interface['ifDescr']))) . " $error_img</td>
<td width=110 >$speed</td>
<td width=200>$type</td>
2009-03-27 09:04:21 +00:00
<td>" . $interface['ifAlias'] . "</td>
2007-04-08 21:54:28 +00:00
</tr>\n");
2007-04-03 14:10:23 +00:00
2008-11-05 16:09:47 +00:00
$row++;
2007-04-03 14:10:23 +00:00
2008-04-03 19:04:24 +00:00
}
2007-04-03 14:10:23 +00:00
}
echo("</table>");
?>