You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
103 lines
3.7 KiB
103 lines
3.7 KiB
2 years ago
|
<?php
|
||
|
include("header.php");
|
||
|
|
||
|
// get string that was searched for
|
||
|
if (empty($search)) {
|
||
|
echo 'Nothing to search for...';
|
||
|
exit;
|
||
|
}
|
||
|
$needle = '%' . $search . '%';
|
||
|
|
||
|
// set resultcounter to zero
|
||
|
$resultcounter = 0;
|
||
|
|
||
|
echo '<table border="0">';
|
||
|
|
||
|
// look for asset
|
||
|
$result = mysql_query("SELECT asset_id, asset_name FROM asset WHERE asset_name LIKE '$needle' OR asset_info LIKE '%$needle%' ORDER BY asset_name");
|
||
|
if (mysql_num_rows($result)>0) {
|
||
|
echo '<tr><td><b>Asset(s):</b></td></tr>';
|
||
|
}
|
||
|
while ($row = mysql_fetch_object($result)) {
|
||
|
echo '<tr><td><a href="assetview.php?asset_id=' . $row->asset_id . '">' . $row->asset_name . '</a></td></tr>';
|
||
|
$resultcounter++;
|
||
|
}
|
||
|
|
||
|
// look for location
|
||
|
$result = mysql_query("SELECT location_id, location_name FROM location WHERE location_name LIKE '$needle' OR location_info LIKE '%$needle%' ORDER BY location_name");
|
||
|
if (mysql_num_rows($result)>0) {
|
||
|
echo '<tr><td><b>Location(s):</b></td></tr>';
|
||
|
}
|
||
|
while ($row = mysql_fetch_object($result)) {
|
||
|
echo '<tr><td><a href="locationview.php?location_id=' . $row->location_id . '">' . $row->location_name . '</a></td></tr>';
|
||
|
$resultcounter++;
|
||
|
}
|
||
|
|
||
|
// look for ip
|
||
|
$result = mysql_query("SELECT node_id, ip FROM node WHERE ip LIKE '$needle' ORDER BY ip");
|
||
|
if (mysql_num_rows($result)>0) {
|
||
|
echo '<tr><td><b>Registered IP(s):</b></td></tr>';
|
||
|
}
|
||
|
while ($row = mysql_fetch_object($result)) {
|
||
|
echo '<tr><td><a href="nodeview.php?node_id=' . $row->node_id . '">' . $row->ip . '</a></td></tr>';
|
||
|
$resultcounter++;
|
||
|
}
|
||
|
|
||
|
// look for mac
|
||
|
$mac = strip_mac($needle);
|
||
|
$result = mysql_query("SELECT node_id, mac FROM node WHERE mac LIKE '$mac' ORDER BY mac");
|
||
|
if (mysql_num_rows($result)>0) {
|
||
|
echo '<tr><td><b>MAC(s):</b></td></tr>';
|
||
|
}
|
||
|
while ($row = mysql_fetch_object($result)) {
|
||
|
echo '<tr><td><a href="nodeview.php?node_id=' . $row->node_id . '">' . write_mac($row->mac) . '</a></td></tr>';
|
||
|
$resultcounter++;
|
||
|
}
|
||
|
|
||
|
// look for dns1
|
||
|
$result = mysql_query("SELECT node_id, dns1 FROM node WHERE dns1 LIKE '$needle' ORDER BY dns1");
|
||
|
if (mysql_num_rows($result)>0) {
|
||
|
echo '<tr><td><b>DNS name(s):</b></td></tr>';
|
||
|
}
|
||
|
while ($row = mysql_fetch_object($result)) {
|
||
|
echo '<tr><td><a href="nodeview.php?node_id=' . $row->node_id . '">' . $row->dns1 . '</a></td></tr>';
|
||
|
$resultcounter++;
|
||
|
}
|
||
|
|
||
|
// look for dns2
|
||
|
$result = mysql_query("SELECT node_id, dns2 FROM node WHERE dns2 LIKE '$needle' ORDER BY dns2");
|
||
|
if (mysql_num_rows($result)>0) {
|
||
|
echo '<tr><td><b>DNS alias(es):</b></td></tr>';
|
||
|
}
|
||
|
while ($row = mysql_fetch_object($result)) {
|
||
|
echo '<tr><td><a href="nodeview.php?node_id=' . $row->node_id . '">' . $row->dns2 . '</a></td></tr>';
|
||
|
$resultcounter++;
|
||
|
}
|
||
|
|
||
|
// look for subnet
|
||
|
$result = mysql_query("SELECT subnet_id, subnet_address FROM subnet WHERE subnet_address LIKE '$needle' OR subnet_info LIKE '%$needle%' ORDER BY subnet_address");
|
||
|
if (mysql_num_rows($result)>0) {
|
||
|
echo '<tr><td><b>Subnet(s):</b></td></tr>';
|
||
|
}
|
||
|
while ($row = mysql_fetch_object($result)) {
|
||
|
echo '<tr><td><a href="subnetview.php?subnet_id=' . $row->subnet_id . '">' . $row->subnet_address . '</a></td></tr>';
|
||
|
$resultcounter++;
|
||
|
}
|
||
|
|
||
|
// look for vlan
|
||
|
$result = mysql_query("SELECT vlan_id, vlan_name FROM vlan WHERE vlan_name LIKE '$needle' OR vlan_info LIKE '%$needle%' ORDER BY vlan_name");
|
||
|
if (mysql_num_rows($result)>0) {
|
||
|
echo '<tr><td><b>VLAN(s):</b></td></tr>';
|
||
|
}
|
||
|
while ($row = mysql_fetch_object($result)) {
|
||
|
echo '<tr><td><a href="vlanview.php?vlan_id=' . $row->vlan_id . '">' . $row->vlan_name . '</a></td></tr>';
|
||
|
$resultcounter++;
|
||
|
}
|
||
|
|
||
|
echo '<tr><td> </td></tr>';
|
||
|
echo '<tr><td>Results found: ' . $resultcounter . '</td></tr>';
|
||
|
|
||
|
echo '</table>';
|
||
|
|
||
|
include("footer.php");
|
||
|
?>
|