Location: PHPKode > projects > OpenDataCenter Network Management System > include/search_page/mainpage.php
<?php
// ----------------------------------------------------------------------
// Copyright (C) 2007 by GREGORY LE BRAS
// ----------------------------------------------------------------------
// LICENSE
//
// This file is part of ODCNMS - Open DataCenter Network Management System
// 
// ODCNMS is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
// 
// Foobar is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with Foobar; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
// ----------------------------------------------------------------------
// Original Author of file: GREGORY LE BRAS - http://www.odcnms.org/
// ----------------------------------------------------------------------

if (!isset($what))
{
?>
<div class="title"><img src="images/search.gif" alt="search" align="bottom"> <?php echo TXT_SEARCH; ?></div>
<br>
<center>
<form method="get" action="index.php" name="search">
<input type="hidden" name="include" value="search">
<input type="hidden" name="page" value="mainpage">
<fieldset class="form" style="border:0px;">
<table width="100%" cellspacing="0" cellpadding="0" align="center">
	<tr align="center">
		<td width="40%" align="right"><label style="padding-right: 55px"><b><?php echo TXT_WHAT; ?></b></label>
		<select name="what" size="1">
			<option value="location"><?php echo TXT_LOCATION; ?></option>
			<option value="rack"><?php echo TXT_RACK; ?></option>
			<option value="patch_panel"><?php echo TXT_PATCH_PANEL; ?></option>
			<option value="port"><?php echo TXT_PORT; ?></option>
			<option value="customer"><?php echo TXT_CUSTOMER; ?></option>
			<option value="network"><?php echo TXT_NETWORK; ?></option>
			<option value="subnet"><?php echo TXT_SUBNET; ?></option>
			<option value="ip_address"><?php echo TXT_IP_ADDRESS; ?></option>
			<option value="vlan"><?php echo TXT_VLAN; ?></option>
			<option value="device"><?php echo TXT_DEVICE; ?></option>
			<option value="manufacturer"><?php echo TXT_MANUFACTURER; ?></option>
			<option value="category"><?php echo TXT_CATEGORY; ?></option>
			<option value="model"><?php echo TXT_MODEL; ?></option>
			<option value="slot"><?php echo TXT_SLOT; ?></option>
			<option value="interface"><?php echo TXT_INTERFACE; ?></option>
		</select></td>
		<td width="50%" align="left" style="padding-left: 5px"><label><b><?php echo TXT_KEYWORDS; ?></b></label>
		<input type="text" name="q" size="30"> <input type="submit" value="<?php echo TXT_SEARCH; ?>"></td>
	</tr>
</table>
</fieldset>
</form>
</center>
<?php
}
else if ($what=="location")
{

	$q=trim(htmlentities($q));
	$q=str_replace("'"," ",$q);
	$q=str_replace("%"," ",$q);
?>
<div class="title"><img src="images/search.gif" alt="search" align="bottom"> <?php echo TXT_SEARCH; ?></div>
<br>
<center>
<form method="get" action="index.php" name="search">
<input type="hidden" name="include" value="search">
<input type="hidden" name="page" value="mainpage">
<fieldset class="form" style="border:0px;">
<table width="100%" cellspacing="0" cellpadding="0" align="center">
	<tr align="center">
		<td width="40%" align="right"><label style="padding-right: 55px"><b><?php echo TXT_WHAT; ?></b></label>
		<select name="what" size="1">
			<option value="location"><?php echo TXT_LOCATION; ?></option>
			<option value="rack"><?php echo TXT_RACK; ?></option>
			<option value="patch_panel"><?php echo TXT_PATCH_PANEL; ?></option>
			<option value="port"><?php echo TXT_PORT; ?></option>
			<option value="customer"><?php echo TXT_CUSTOMER; ?></option>
			<option value="network"><?php echo TXT_NETWORK; ?></option>
			<option value="subnet"><?php echo TXT_SUBNET; ?></option>
			<option value="ip_address"><?php echo TXT_IP_ADDRESS; ?></option>
			<option value="vlan"><?php echo TXT_VLAN; ?></option>
			<option value="device"><?php echo TXT_DEVICE; ?></option>
			<option value="manufacturer"><?php echo TXT_MANUFACTURER; ?></option>
			<option value="category"><?php echo TXT_CATEGORY; ?></option>
			<option value="model"><?php echo TXT_MODEL; ?></option>
			<option value="slot"><?php echo TXT_SLOT; ?></option>
			<option value="interface"><?php echo TXT_INTERFACE; ?></option>
		</select></td>
		<td width="50%" align="left" style="padding-left: 5px"><label><b><?php echo TXT_KEYWORDS; ?></b></label>
		<input type="text" name="q" size="30" value="<?php echo "$q"; ?>"> <input type="submit" value="<?php echo TXT_SEARCH; ?>"></td>
	</tr>
</table>
</fieldset>
</form>
</center>
<div class="title"><img src="images/location.gif" alt="location" align="bottom"> <?php echo TXT_LOCATION; ?> "<?php echo "$q"; ?>"</div>
<?php

	$request = mysql_query("SELECT * FROM $name_table_location WHERE name LIKE \"%$q%\" OR description LIKE \"%$q%\"") or die("ERROR!");
	$nb_result=mysql_num_rows($request);
	if($nb_result=="0")
	{
		echo "<br>Your search - <b>$q</b> - did not match any locations.<br><br>

		<b>Suggestions:</b><br><br>

		<ul>
			<li>Make sure all words are spelled correctly.</li>
		    <li>Try different keywords.</li>
		    <li>Try more general keywords.</li>
		</ul>";
	}
	else
	{
	?>
	<table class="sortable list" id="sortable" width="100%" cellspacing="2" cellpadding="3">
	<tr class="list_title">
		<td width="28%" valign="top"><?php echo TXT_NAME; ?></td>
		<td width="60%" valign="top"><?php echo TXT_DESCRIPTION; ?></td>
		<td class="unsortable" width="12%" valign="top"><?php echo TXT_ACTION; ?></td>
	</tr>
	<?php
	while($tmp_request=mysql_fetch_array($request))
	{
			$list1 = "list1"; 
			$list2 = "list2"; 
			$line_count = 0; 
			$line_color = ($line_count % 2) ? $list1 : $list2;
			?>
				<tr class="<?php echo "$line_color"; ?>">
					<td width="28%" valign="top"><?php print("<a href=\"index.php?include=mainview&page=location&action=view&id=$tmp_request[id]\">$tmp_request[name]</a>"); ?></td>
					<td width="60%" valign="top"><?php echo $tmp_request['description']; ?></td>
					<td width="12%" valign="top">[ <?php print("<a href=\"index.php?include=mainview&page=location&action=edit&id=$tmp_request[id]\">".TXT_EDIT."</a>"); ?> ] [ <?php print("<a href=\"index.php?include=mainview&page=location&action=delete&id=$tmp_request[id]\">".TXT_DELETE."</a>"); ?> ]</td>	
				</tr>
			<?php	
			$line_count++;
	}
?>
	</table>
<?php
	}
}
else if ($what=="rack")
{

	$q=trim(htmlentities($q));
	$q=str_replace("'"," ",$q);
	$q=str_replace("%"," ",$q);
?>
<div class="title"><img src="images/search.gif" alt="search" align="bottom"> <?php echo TXT_SEARCH; ?></div>
<br>
<center>
<form method="get" action="index.php" name="search">
<input type="hidden" name="include" value="search">
<input type="hidden" name="page" value="mainpage">
<fieldset class="form" style="border:0px;">
<table width="100%" cellspacing="0" cellpadding="0" align="center">
	<tr align="center">
		<td width="40%" align="right"><label style="padding-right: 55px"><b><?php echo TXT_WHAT; ?></b></label>
		<select name="what" size="1">
			<option value="location"><?php echo TXT_LOCATION; ?></option>
			<option value="rack" selected><?php echo TXT_RACK; ?></option>
			<option value="patch_panel"><?php echo TXT_PATCH_PANEL; ?></option>
			<option value="port"><?php echo TXT_PORT; ?></option>
			<option value="customer"><?php echo TXT_CUSTOMER; ?></option>
			<option value="network"><?php echo TXT_NETWORK; ?></option>
			<option value="subnet"><?php echo TXT_SUBNET; ?></option>
			<option value="ip_address"><?php echo TXT_IP_ADDRESS; ?></option>
			<option value="vlan"><?php echo TXT_VLAN; ?></option>
			<option value="device"><?php echo TXT_DEVICE; ?></option>
			<option value="manufacturer"><?php echo TXT_MANUFACTURER; ?></option>
			<option value="category"><?php echo TXT_CATEGORY; ?></option>
			<option value="model"><?php echo TXT_MODEL; ?></option>
			<option value="slot"><?php echo TXT_SLOT; ?></option>
			<option value="interface"><?php echo TXT_INTERFACE; ?></option>
		</select></td>
		<td width="50%" align="left" style="padding-left: 5px"><label><b><?php echo TXT_KEYWORDS; ?></b></label>
		<input type="text" name="q" size="30" value="<?php echo "$q"; ?>"> <input type="submit" value="<?php echo TXT_SEARCH; ?>"></td>
	</tr>
</table>
</fieldset>
</form>
</center>
<div class="title"><img src="images/rack.gif" alt="rack" align="bottom"> <?php echo TXT_RACK; ?> "<?php echo "$q"; ?>"</div>
<?php

	$request = mysql_query("SELECT * FROM $name_table_rack WHERE name LIKE \"%$q%\" OR description LIKE \"%$q%\"") or die("ERROR!");
	$nb_result=mysql_num_rows($request);
	if($nb_result=="0")
	{
		echo "<br>Your search - <b>$q</b> - did not match any racks.<br><br>

		<b>Suggestions:</b><br><br>

		<ul>
			<li>Make sure all words are spelled correctly.</li>
		    <li>Try different keywords.</li>
		    <li>Try more general keywords.</li>
		</ul>";
	}
	else
	{
	?>
	<table class="sortable list" id="sortable" width="100%" cellspacing="2" cellpadding="3">
	<tr class="list_title">
		<td width="20%"><?php echo TXT_NAME; ?></td>
		<td width="28%"><?php echo TXT_LOCATION; ?></td>
		<td width="40%"><?php echo TXT_DESCRIPTION; ?></td>
		<td class="unsortable" width="12%"><?php echo TXT_ACTION; ?></td>
	</tr>
	<?php
	while($tmp_request=mysql_fetch_array($request))
	{
			$list1 = "list1"; 
			$list2 = "list2"; 
			$line_count = 0; 
			$line_color = ($line_count % 2) ? $list1 : $list2;
			
			$request2=mysql_query("SELECT name,id FROM $name_table_location WHERE id=\"$tmp_request[location_id]\"") or die ("ERROR!");

			while($tmp_request2=mysql_fetch_array($request2))
			{
				$id_location = $tmp_request2['id'];
				$name_location = $tmp_request2['name'];
			}
			?>
			<tr class="<?php echo "$line_color"; ?>">
				<td width="20%" valign="top"><?php print("<a href=\"index.php?include=mainview&page=rack&action=view&id=$tmp_request[id]\">$tmp_request[name]</a>"); ?></td>
				<td width="28%" valign="top"><?php print("<a href=\"index.php?include=mainview&page=location&action=view&id=$id_location\">$name_location</a>"); ?></td>
				<td width="40%" valign="top"><?php echo $tmp_request['description']; ?></td>
				<td width="12%" valign="top">[ <?php print("<a href=\"index.php?include=mainview&page=rack&action=edit&id=$tmp_request[id]\">".TXT_EDIT."</a>"); ?> ] [ <?php print("<a href=\"index.php?include=mainview&page=rack&action=delete&id=$tmp_request[id]\">".TXT_DELETE."</a>"); ?> ]</td>	
			</tr>
			<?php	
			$line_count++;
	}
?>
	</table>
<?php
	}
}
else if ($what=="patch_panel")
{

	$q=trim(htmlentities($q));
	$q=str_replace("'"," ",$q);
	$q=str_replace("%"," ",$q);
?>
<div class="title"><img src="images/search.gif" alt="search" align="bottom"> <?php echo TXT_SEARCH; ?></div>
<br>
<center>
<form method="get" action="index.php" name="search">
<input type="hidden" name="include" value="search">
<input type="hidden" name="page" value="mainpage">
<fieldset class="form" style="border:0px;">
<table width="100%" cellspacing="0" cellpadding="0" align="center">
	<tr align="center">
		<td width="40%" align="right"><label style="padding-right: 55px"><b><?php echo TXT_WHAT; ?></b></label>
		<select name="what" size="1">
			<option value="location"><?php echo TXT_LOCATION; ?></option>
			<option value="rack"><?php echo TXT_RACK; ?></option>
			<option value="patch_panel" selected><?php echo TXT_PATCH_PANEL; ?></option>
			<option value="port"><?php echo TXT_PORT; ?></option>
			<option value="customer"><?php echo TXT_CUSTOMER; ?></option>
			<option value="network"><?php echo TXT_NETWORK; ?></option>
			<option value="subnet"><?php echo TXT_SUBNET; ?></option>
			<option value="ip_address"><?php echo TXT_IP_ADDRESS; ?></option>
			<option value="vlan"><?php echo TXT_VLAN; ?></option>
			<option value="device"><?php echo TXT_DEVICE; ?></option>
			<option value="manufacturer"><?php echo TXT_MANUFACTURER; ?></option>
			<option value="category"><?php echo TXT_CATEGORY; ?></option>
			<option value="model"><?php echo TXT_MODEL; ?></option>
			<option value="slot"><?php echo TXT_SLOT; ?></option>
			<option value="interface"><?php echo TXT_INTERFACE; ?></option>
		</select></td>
		<td width="50%" align="left" style="padding-left: 5px"><label><b><?php echo TXT_KEYWORDS; ?></b></label>
		<input type="text" name="q" size="30" value="<?php echo "$q"; ?>"> <input type="submit" value="<?php echo TXT_SEARCH; ?>"></td>
	</tr>
</table>
</fieldset>
</form>
</center>
<div class="title"><img src="images/patch_panel.gif" alt="patch_panel" align="bottom"> <?php echo TXT_PATCH_PANEL; ?> "<?php echo "$q"; ?>"</div>
<?php

	$request = mysql_query("SELECT * FROM $name_table_patch_panel WHERE name LIKE \"%$q%\" OR description LIKE \"%$q%\" OR port_density LIKE \"%$q%\" OR height LIKE \"%$q%\"") or die("ERROR!");
	$nb_result=mysql_num_rows($request);
	if($nb_result=="0")
	{
		echo "<br>Your search - <b>$q</b> - did not match any patch panels.<br><br>

		<b>Suggestions:</b><br><br>

		<ul>
			<li>Make sure all words are spelled correctly.</li>
		    <li>Try different keywords.</li>
		    <li>Try more general keywords.</li>
		</ul>";
	}
	else
	{
	?>
	<table class="sortable list" id="sortable" width="100%" cellspacing="2" cellpadding="3">
	<tr class="list_title">
		<td width="20%"><?php echo TXT_NAME; ?></td>
		<td width="18%"><?php echo TXT_RACK; ?></td>
		<td width="11%"><?php echo TXT_PORT_DENSITY; ?></td>
		<td width="7%"><?php echo TXT_HEIGHT; ?></td>
		<td width="32%"><?php echo TXT_DESCRIPTION; ?></td>
		<td class="unsortable" width="12%"><?php echo TXT_ACTION; ?></td>
	</tr>
	<?php
	while($tmp_request=mysql_fetch_array($request))
	{
			$list1 = "list1"; 
			$list2 = "list2"; 
			$line_count = 0; 
			$line_color = ($line_count % 2) ? $list1 : $list2;
			
			$request2=mysql_query("SELECT name,id FROM $name_table_rack WHERE id=\"$tmp_request[rack_id]\"") or die ("ERROR!");

			while($tmp_request2=mysql_fetch_array($request2))
			{
				$id_rack = $tmp_request2['id'];
				$name_rack = $tmp_request2['name'];
			}
			?>
			<tr class="<?php echo "$line_color"; ?>">
			<td width="20%" valign="top"><?php print("<a href=\"index.php?include=mainview&page=patch_panel&action=view&id=$tmp_request[id]\">$tmp_request[name]</a>"); ?></td>
			<td width="20%" valign="top"><?php print("<a href=\"index.php?include=mainview&page=rack&action=view&id=$id_rack\">$name_rack</a>"); ?></td>
			<td width="10%" valign="top"><?php echo $tmp_request['port_density']; ?></td>
			<td width="6%" valign="top"><?php echo $tmp_request['height']; ?></td>
			<td width="32%" valign="top"><?php echo $tmp_request['description']; ?></td>
			<td width="12%" valign="top">[ <?php print("<a href=\"index.php?include=mainview&page=patch_panel&action=edit&id=$tmp_request[id]\">".TXT_EDIT."</a>"); ?> ] [ <?php print("<a href=\"index.php?include=mainview&page=patch_panel&action=delete&id=$tmp_request[id]\">".TXT_DELETE."</a>"); ?> ]</td>	
		</tr>
			<?php	
			$line_count++;
	}
?>
	</table>
<?php
	}
}
else if ($what=="port")
{

	$q=trim(htmlentities($q));
	$q=str_replace("'"," ",$q);
	$q=str_replace("%"," ",$q);
?>
<div class="title"><img src="images/search.gif" alt="search" align="bottom"> <?php echo TXT_SEARCH; ?></div>
<br>
<center>
<form method="get" action="index.php" name="search">
<input type="hidden" name="include" value="search">
<input type="hidden" name="page" value="mainpage">
<fieldset class="form" style="border:0px;">
<table width="100%" cellspacing="0" cellpadding="0" align="center">
	<tr align="center">
		<td width="40%" align="right"><label style="padding-right: 55px"><b><?php echo TXT_WHAT; ?></b></label>
		<select name="what" size="1">
			<option value="location"><?php echo TXT_LOCATION; ?></option>
			<option value="rack"><?php echo TXT_RACK; ?></option>
			<option value="patch_panel"><?php echo TXT_PATCH_PANEL; ?></option>
			<option value="port" selected><?php echo TXT_PORT; ?></option>
			<option value="customer"><?php echo TXT_CUSTOMER; ?></option>
			<option value="network"><?php echo TXT_NETWORK; ?></option>
			<option value="subnet"><?php echo TXT_SUBNET; ?></option>
			<option value="ip_address"><?php echo TXT_IP_ADDRESS; ?></option>
			<option value="vlan"><?php echo TXT_VLAN; ?></option>
			<option value="device"><?php echo TXT_DEVICE; ?></option>
			<option value="manufacturer"><?php echo TXT_MANUFACTURER; ?></option>
			<option value="category"><?php echo TXT_CATEGORY; ?></option>
			<option value="model"><?php echo TXT_MODEL; ?></option>
			<option value="slot"><?php echo TXT_SLOT; ?></option>
			<option value="interface"><?php echo TXT_INTERFACE; ?></option>
		</select></td>
		<td width="50%" align="left" style="padding-left: 5px"><label><b><?php echo TXT_KEYWORDS; ?></b></label>
		<input type="text" name="q" size="30" value="<?php echo "$q"; ?>"> <input type="submit" value="<?php echo TXT_SEARCH; ?>"></td>
	</tr>
</table>
</fieldset>
</form>
</center>
<div class="title"><img src="images/port.gif" alt="port" align="bottom"> <?php echo TXT_PORT; ?> "<?php echo "$q"; ?>"</div>
<?php

	$request = mysql_query("SELECT * FROM $name_table_port WHERE name LIKE \"%$q%\" OR description LIKE \"%$q%\"") or die("ERROR!");
	$nb_result=mysql_num_rows($request);
	if($nb_result=="0")
	{
		echo "<br>Your search - <b>$q</b> - did not match any ports.<br><br>

		<b>Suggestions:</b><br><br>

		<ul>
			<li>Make sure all words are spelled correctly.</li>
		    <li>Try different keywords.</li>
		    <li>Try more general keywords.</li>
		</ul>";
	}
	else
	{
	?>
	<table class="sortable list" id="sortable" width="100%" cellspacing="2" cellpadding="3">
	<tr class="list_title">
		<td width="20%"><?php echo TXT_PATCH_PANEL; ?></td>
		<td width="20%"><?php echo TXT_NAME; ?></td>
		<td width="32%"><?php echo TXT_DESCRIPTION; ?></td>
		<td class="unsortable" width="12%"><?php echo TXT_ACTION; ?></td>
	</tr>
	<?php
	while($tmp_request=mysql_fetch_array($request))
	{
		$list1 = "list1"; 
		$list2 = "list2"; 
		$line_count = 0; 
		$line_color = ($line_count % 2) ? $list1 : $list2;
		
		$request2=mysql_query("SELECT name,id FROM $name_table_patch_panel WHERE id=\"$tmp_request[patch_panel_id]\"") or die ("ERROR!");

		while($tmp_request2=mysql_fetch_array($request2))
		{
			$id_patch_panel = $tmp_request2['id'];
			$name_patch_panel = $tmp_request2['name'];
		}
		?>
		<tr class="<?php echo "$line_color"; ?>">
			<td width="20%" valign="top"><?php print("<a href=\"index.php?include=mainview&page=patch_panel&action=view&id=$id_patch_panel\">$name_patch_panel</a>"); ?></td>
			<td width="20%" valign="top"><?php print("<a href=\"index.php?include=mainview&page=port&action=view&id=$tmp_request[id]\">$tmp_request[name]</a>"); ?></td>
			<td width="32%" valign="top"><?php echo $tmp_request['description']; ?></td>
			<td width="12%" valign="top">[ <?php print("<a href=\"index.php?include=mainview&page=port&action=edit&id=$tmp_request[id]\">".TXT_EDIT."</a>"); ?> ] [ <?php print("<a href=\"index.php?include=mainview&page=port&action=view&id=$tmp_request[id]\"><?php echo TXT_VIEW; ?></a>"); ?> ]</td>	
		</tr>
		<?php	
		$line_count++;
	}
?>
	</table>
<?php
	}
}
else if ($what=="customer")
{

	$q=trim(htmlentities($q));
	$q=str_replace("'"," ",$q);
	$q=str_replace("%"," ",$q);
?>
<div class="title"><img src="images/search.gif" alt="search" align="bottom"> <?php echo TXT_SEARCH; ?></div>
<br>
<center>
<form method="get" action="index.php" name="search">
<input type="hidden" name="include" value="search">
<input type="hidden" name="page" value="mainpage">
<fieldset class="form" style="border:0px;">
<table width="100%" cellspacing="0" cellpadding="0" align="center">
	<tr align="center">
		<td width="40%" align="right"><label style="padding-right: 55px"><b><?php echo TXT_WHAT; ?></b></label>
		<select name="what" size="1">
			<option value="location"><?php echo TXT_LOCATION; ?></option>
			<option value="rack"><?php echo TXT_RACK; ?></option>
			<option value="patch_panel"><?php echo TXT_PATCH_PANEL; ?></option>
			<option value="port"><?php echo TXT_PORT; ?></option>
			<option value="customer" selected><?php echo TXT_CUSTOMER; ?></option>
			<option value="network"><?php echo TXT_NETWORK; ?></option>
			<option value="subnet"><?php echo TXT_SUBNET; ?></option>
			<option value="ip_address"><?php echo TXT_IP_ADDRESS; ?></option>
			<option value="vlan"><?php echo TXT_VLAN; ?></option>
			<option value="device"><?php echo TXT_DEVICE; ?></option>
			<option value="manufacturer"><?php echo TXT_MANUFACTURER; ?></option>
			<option value="category"><?php echo TXT_CATEGORY; ?></option>
			<option value="model"><?php echo TXT_MODEL; ?></option>
			<option value="slot"><?php echo TXT_SLOT; ?></option>
			<option value="interface"><?php echo TXT_INTERFACE; ?></option>
		</select></td>
		<td width="50%" align="left" style="padding-left: 5px"><label><b><?php echo TXT_KEYWORDS; ?></b></label>
		<input type="text" name="q" size="30" value="<?php echo "$q"; ?>"> <input type="submit" value="<?php echo TXT_SEARCH; ?>"></td>
	</tr>
</table>
</fieldset>
</form>
</center>
<div class="title"><img src="images/customer.gif" alt="customer" align="bottom"> <?php echo TXT_CUSTOMER; ?> "<?php echo "$q"; ?>"</div>
<?php

	$request = mysql_query("SELECT * FROM $name_table_customer WHERE name LIKE \"%$q%\" OR description LIKE \"%$q%\"") or die("ERROR!");
	$nb_result=mysql_num_rows($request);
	if($nb_result=="0")
	{
		echo "<br>Your search - <b>$q</b> - did not match any customers.<br><br>

		<b>Suggestions:</b><br><br>

		<ul>
			<li>Make sure all words are spelled correctly.</li>
		    <li>Try different keywords.</li>
		    <li>Try more general keywords.</li>
		</ul>";
	}
	else
	{
	?>
	<table class="sortable list" id="sortable" width="100%" cellspacing="2" cellpadding="3">
	<tr class="list_title">
		<td width="28%" valign="top"><?php echo TXT_NAME; ?></td>
		<td width="30%" valign="top"><?php echo TXT_DESCRIPTION; ?></td>
		<td class="unsortable" width="12%" valign="top"><?php echo TXT_ACTION; ?></td>
	</tr>
	<?php
	while($tmp_request=mysql_fetch_array($request))
	{
		$list1 = "list1"; 
		$list2 = "list2"; 
		$line_count = 0; 
		$line_color = ($line_count % 2) ? $list1 : $list2;
		
		?>
		<tr class="<?php echo "$line_color"; ?>">
			<td width="28%" valign="top"><?php print("<a href=\"index.php?include=mainview&page=customer&action=view&id=$tmp_request[id]\">$tmp_request[name]</a>"); ?></td>
			<td width="30%" valign="top"><?php echo $tmp_request['description']; ?></td>
			<td width="12%" valign="top">[ <?php print("<a href=\"index.php?include=mainview&page=customer&action=edit&id=$tmp_request[id]\">".TXT_EDIT."</a>"); ?> ] [ <?php print("<a href=\"index.php?include=mainview&page=customer&action=delete&id=$tmp_request[id]\">".TXT_DELETE."</a>"); ?> ]</td>	
		</tr>
		<?php	
		$line_count++;
	}
?>
	</table>
<?php
	}
}
else if ($what=="network")
{

	$q=trim(htmlentities($q));
	$q=str_replace("'"," ",$q);
	$q=str_replace("%"," ",$q);
?>
<div class="title"><img src="images/search.gif" alt="search" align="bottom"> <?php echo TXT_SEARCH; ?></div>
<br>
<center>
<form method="get" action="index.php" name="search">
<input type="hidden" name="include" value="search">
<input type="hidden" name="page" value="mainpage">
<fieldset class="form" style="border:0px;">
<table width="100%" cellspacing="0" cellpadding="0" align="center">
	<tr align="center">
		<td width="40%" align="right"><label style="padding-right: 55px"><b><?php echo TXT_WHAT; ?></b></label>
		<select name="what" size="1">
			<option value="location"><?php echo TXT_LOCATION; ?></option>
			<option value="rack"><?php echo TXT_RACK; ?></option>
			<option value="patch_panel"><?php echo TXT_PATCH_PANEL; ?></option>
			<option value="port"><?php echo TXT_PORT; ?></option>
			<option value="customer"><?php echo TXT_CUSTOMER; ?></option>
			<option value="network" selected><?php echo TXT_NETWORK; ?></option>
			<option value="subnet"><?php echo TXT_SUBNET; ?></option>
			<option value="ip_address"><?php echo TXT_IP_ADDRESS; ?></option>
			<option value="vlan"><?php echo TXT_VLAN; ?></option>
			<option value="device"><?php echo TXT_DEVICE; ?></option>
			<option value="manufacturer"><?php echo TXT_MANUFACTURER; ?></option>
			<option value="category"><?php echo TXT_CATEGORY; ?></option>
			<option value="model"><?php echo TXT_MODEL; ?></option>
			<option value="slot"><?php echo TXT_SLOT; ?></option>
			<option value="interface"><?php echo TXT_INTERFACE; ?></option>
		</select></td>
		<td width="50%" align="left" style="padding-left: 5px"><label><b><?php echo TXT_KEYWORDS; ?></b></label>
		<input type="text" name="q" size="30" value="<?php echo "$q"; ?>"> <input type="submit" value="<?php echo TXT_SEARCH; ?>"></td>
	</tr>
</table>
</fieldset>
</form>
</center>
<div class="title"><img src="images/network.gif" alt="network" align="bottom"> <?php echo TXT_NETWORK; ?> "<?php echo "$q"; ?>"</div>
<?php

	$request = mysql_query("SELECT * FROM $name_table_network WHERE name LIKE \"%$q%\" OR description LIKE \"%$q%\" OR address LIKE \"%$q%\" OR mask LIKE \"%$q%\"") or die("ERROR!");
	$nb_result=mysql_num_rows($request);
	if($nb_result=="0")
	{
		echo "<br>Your search - <b>$q</b> - did not match any networks.<br><br>

		<b>Suggestions:</b><br><br>

		<ul>
			<li>Make sure all words are spelled correctly.</li>
		    <li>Try different keywords.</li>
		    <li>Try more general keywords.</li>
		</ul>";
	}
	else
	{
	?>
	<table class="sortable list" id="sortable" width="100%" cellspacing="2" cellpadding="3">
	<tr class="list_title">
		<td class="unsortable" width="20%" valign="top"><?php echo TXT_NAME; ?></td>
		<td width="10%" valign="top"><?php echo TXT_IP_ADDRESS; ?></td>
		<td width="12%" valign="top"><?php echo TXT_MASK; ?></td>
		<td width="36%" valign="top"><?php echo TXT_DESCRIPTION; ?></td>
		<td class="unsortable" width="12%" valign="top"><?php echo TXT_ACTION; ?></td>
	</tr>
	<?php
	while($tmp_request=mysql_fetch_array($request))
	{
		$list1 = "list1"; 
		$list2 = "list2"; 
		$line_count = 0; 
		$line_color = ($line_count % 2) ? $list1 : $list2;
		$i = 0;
		
		$requestcount=mysql_query("SELECT count(status) FROM $name_table_subnet WHERE network_id=$tmp_request[id]") or die ("ERROR!");
		$all_subnet = mysql_fetch_array($requestcount);
		
		$requestcount_assigned=mysql_query("SELECT count(status) FROM $name_table_subnet WHERE network_id=$tmp_request[id] AND status='0'") or die ("ERROR!");
		$all_subnet_assigned = mysql_fetch_array($requestcount_assigned);
		
		$requestcount_unused=mysql_query("SELECT count(status) FROM $name_table_subnet WHERE network_id=$tmp_request[id] AND status='1'") or die ("ERROR!");
		$all_subnet_unused = mysql_fetch_array($requestcount_unused);	
		
		$requestcount_reserved=mysql_query("SELECT count(status) FROM $name_table_subnet WHERE network_id=$tmp_request[id] AND status='2'") or die ("ERROR!");
		$all_subnet_reserved = mysql_fetch_array($requestcount_reserved);		
		
		?>
		<table class="list" width="100%" cellspacing="2" cellpadding="3">
			<tr class="<?php echo "$line_color"; ?>">
				<td width="20%" valign="top"><?php print("<a href='#' onclick=\"displayelement('ajaxcontentarea_$i');urlredirectdiv('ajax_view.php?what=displaysubnet&id=$tmp_request[id]','ajaxcontentarea_$i');\"><img id='arrow_$i' src=\"images/arrow_up.gif\" border='0' align='top' onclick=\"changeimage('images/arrow_up.gif','images/arrow_down.gif','arrow_$i');\"></a><a href=\"index.php?include=mainview&page=network&action=view&id=$tmp_request[id]\">$tmp_request[name]</a> (<font style='background-color:#0000ff;color:#fff;'>$all_subnet_assigned[0]</font> | <font style='background-color:#00ff00;color:#fff;'>$all_subnet_unused[0]</font> | <font style='background-color:#ff0000;color:#fff;'>$all_subnet_reserved[0]</font> / $all_subnet[0])"); ?></td>
				<td width="10%" valign="top"><?php echo $tmp_request['address']; ?></td>
				<td width="12%" valign="top"><?php echo $tmp_request['mask']; $net = find_net($tmp_request['address'],$tmp_request['mask']); echo " (".$net['cidr'].")";?></td>
				<td width="36%" valign="top"><?php echo $tmp_request['description']; ?></td>
				<td width="12%" valign="top">[ <?php print("<a href=\"index.php?include=mainview&page=network&action=edit&id=$tmp_request[id]\">".TXT_EDIT."</a>"); ?> ] [ <?php print("<a href=\"index.php?include=mainview&page=network&action=delete&id=$tmp_request[id]\">".TXT_DELETE."</a>"); ?> ]</td>	
			</tr>
		</table>
		<?php	
		echo "<div style=\"display:none;position:relative;margin-left: 20px;background-color:#ededed;\" id=\"ajaxcontentarea_$i\"></div>";
		$line_count++;
		$i++;
	}
?>
	</table>
<?php
	}
}
else if ($what=="subnet")
{

	$q=trim(htmlentities($q));
	$q=str_replace("'"," ",$q);
	$q=str_replace("%"," ",$q);
?>
<div class="title"><img src="images/search.gif" alt="search" align="bottom"> <?php echo TXT_SEARCH; ?></div>
<br>
<center>
<form method="get" action="index.php" name="search">
<input type="hidden" name="include" value="search">
<input type="hidden" name="page" value="mainpage">
<fieldset class="form" style="border:0px;">
<table width="100%" cellspacing="0" cellpadding="0" align="center">
	<tr align="center">
		<td width="40%" align="right"><label style="padding-right: 55px"><b><?php echo TXT_WHAT; ?></b></label>
		<select name="what" size="1">
			<option value="location"><?php echo TXT_LOCATION; ?></option>
			<option value="rack"><?php echo TXT_RACK; ?></option>
			<option value="patch_panel"><?php echo TXT_PATCH_PANEL; ?></option>
			<option value="port"><?php echo TXT_PORT; ?></option>
			<option value="customer"><?php echo TXT_CUSTOMER; ?></option>
			<option value="network"><?php echo TXT_NETWORK; ?></option>
			<option value="subnet" selected><?php echo TXT_SUBNET; ?></option>
			<option value="ip_address"><?php echo TXT_IP_ADDRESS; ?></option>
			<option value="vlan"><?php echo TXT_VLAN; ?></option>
			<option value="device"><?php echo TXT_DEVICE; ?></option>
			<option value="manufacturer"><?php echo TXT_MANUFACTURER; ?></option>
			<option value="category"><?php echo TXT_CATEGORY; ?></option>
			<option value="model"><?php echo TXT_MODEL; ?></option>
			<option value="slot"><?php echo TXT_SLOT; ?></option>
			<option value="interface"><?php echo TXT_INTERFACE; ?></option>
		</select></td>
		<td width="50%" align="left" style="padding-left: 5px"><label><b><?php echo TXT_KEYWORDS; ?></b></label>
		<input type="text" name="q" size="30" value="<?php echo "$q"; ?>"> <input type="submit" value="<?php echo TXT_SEARCH; ?>"></td>
	</tr>
</table>
</fieldset>
</form>
</center>
<div class="title"><img src="images/subnetwork.gif" alt="subnet" align="bottom"> <?php echo TXT_SUBNET; ?> "<?php echo "$q"; ?>"</div>
<?php

	$request = mysql_query("SELECT * FROM $name_table_subnet WHERE name LIKE \"%$q%\" OR description LIKE \"%$q%\" OR address LIKE \"%$q%\" OR mask LIKE \"%$q%\" OR status LIKE \"%$q%\"") or die("ERROR!");
	$nb_result=mysql_num_rows($request);
	if($nb_result=="0")
	{
		echo "<br>Your search - <b>$q</b> - did not match any subnets.<br><br>

		<b>Suggestions:</b><br><br>

		<ul>
			<li>Make sure all words are spelled correctly.</li>
		    <li>Try different keywords.</li>
		    <li>Try more general keywords.</li>
		</ul>";
	}
	else
	{
	?>
	<table class="sortable list" id="sortable" width="100%" cellspacing="2" cellpadding="3">
	<tr class="list_title">
		<td width="15%" valign="top"><?php echo TXT_NAME; ?></td>
		<td width="25%" valign="top"><?php echo TXT_NETWORK; ?></td>
		<td width="10%" valign="top"><?php echo TXT_IP_ADDRESS; ?></td>
		<td width="10%" valign="top"><?php echo TXT_MASK; ?></td>
		<td width="8%" valign="top"><?php echo TXT_STATUS; ?></td>
		<td width="20%" valign="top"><?php echo TXT_DESCRIPTION; ?></td>
		<td class="unsortable" width="12%" valign="top"><?php echo TXT_ACTION; ?></td>
	</tr>
	<?php
	while($tmp_request=mysql_fetch_array($request))
	{
		$list1 = "list1"; 
		$list2 = "list2"; 
		$line_count = 0; 
		$line_color = ($line_count % 2) ? $list1 : $list2;	
		
		?>
		<tr class="<?php echo "$line_color"; ?>">
			<td width="15%" valign="top"><?php print("<a href=\"index.php?include=mainview&page=subnet&action=view&id=$tmp_request[id]\">$tmp_request[name]</a>"); ?></td>
			<td width="25%" valign="top"><?php 
			
			$request2=mysql_query("SELECT id,name,address,mask FROM $name_table_network WHERE id=$tmp_request[network_id]");
			
			while ($tmp_request2=mysql_fetch_array($request2))
			{
				$cidr = find_net($tmp_request2['address'],$tmp_request2['mask']);
				echo "<a href=\"index.php?include=mainview&page=network&action=view&id=$tmp_request2[id]\">$tmp_request2[name] ($tmp_request2[address]$cidr[cidr])</a>";
			}


			?></td>
			<td width="10%" valign="top"><?php echo $tmp_request['address']; ?></td>
			<td width="10%" valign="top"><?php echo $tmp_request['mask']; ?></td>
			<td width="8%" valign="top" align="center"><?php			
			switch ($tmp_request['status'])
			{
				case '0':
				echo "<p style='margin:0px;background:#0000ff;color:#fff'>".TXT_ASSIGNED."</p>";
				break;
				
				case '1':
				echo "<p style='margin:0px;background:#00ff00;color:#fff'>".TXT_UNUSED."</p>";
				break;

				case '2':
				echo "<p style='margin:0px;background:#ff0000;color:#fff'>".TXT_RESERVED."</p>";
				break;
				
			}
			?></td>
			<td width="20%" valign="top"><?php echo $tmp_request['description']; ?></td>
			<td width="12%" valign="top">[ <?php print("<a href=\"index.php?include=mainview&page=subnet&action=edit&id=$tmp_request[id]\">".TXT_EDIT."</a>"); ?> ] [ <?php print("<a href=\"index.php?include=mainview&page=subnet&action=delete&id=$tmp_request[id]\">".TXT_DELETE."</a>"); ?> ]</td>	
		</tr>
		<?php	
		$line_count++;
	}
?>
	</table>
<?php
	}
}
else if ($what=="ip_address")
{

	$q=trim(htmlentities($q));
	$q=str_replace("'"," ",$q);
	$q=str_replace("%"," ",$q);
?>
<div class="title"><img src="images/search.gif" alt="search" align="bottom"> <?php echo TXT_SEARCH; ?></div>
<br>
<center>
<form method="get" action="index.php" name="search">
<input type="hidden" name="include" value="search">
<input type="hidden" name="page" value="mainpage">
<fieldset class="form" style="border:0px;">
<table width="100%" cellspacing="0" cellpadding="0" align="center">
	<tr align="center">
		<td width="40%" align="right"><label style="padding-right: 55px"><b><?php echo TXT_WHAT; ?></b></label>
		<select name="what" size="1">
			<option value="location"><?php echo TXT_LOCATION; ?></option>
			<option value="rack"><?php echo TXT_RACK; ?></option>
			<option value="patch_panel"><?php echo TXT_PATCH_PANEL; ?></option>
			<option value="port"><?php echo TXT_PORT; ?></option>
			<option value="customer"><?php echo TXT_CUSTOMER; ?></option>
			<option value="network"><?php echo TXT_NETWORK; ?></option>
			<option value="subnet"><?php echo TXT_SUBNET; ?></option>
			<option value="ip_address" selected><?php echo TXT_IP_ADDRESS; ?></option>
			<option value="vlan"><?php echo TXT_VLAN; ?></option>
			<option value="device"><?php echo TXT_DEVICE; ?></option>
			<option value="manufacturer"><?php echo TXT_MANUFACTURER; ?></option>
			<option value="category"><?php echo TXT_CATEGORY; ?></option>
			<option value="model"><?php echo TXT_MODEL; ?></option>
			<option value="slot"><?php echo TXT_SLOT; ?></option>
			<option value="interface"><?php echo TXT_INTERFACE; ?></option>
		</select></td>
		<td width="50%" align="left" style="padding-left: 5px"><label><b><?php echo TXT_KEYWORDS; ?></b></label>
		<input type="text" name="q" size="30" value="<?php echo "$q"; ?>"> <input type="submit" value="<?php echo TXT_SEARCH; ?>"></td>
	</tr>
</table>
</fieldset>
</form>
</center>
<div class="title"><img src="images/ipaddress.gif" alt="ip_address" align="bottom"> <?php echo TXT_IP_ADDRESS; ?> "<?php echo "$q"; ?>"</div>
<?php

	$request = mysql_query("SELECT * FROM $name_table_ip_address WHERE name LIKE \"%$q%\" OR description LIKE \"%$q%\" OR mac_address LIKE \"%$q%\" OR ip LIKE \"%$q%\" OR status LIKE \"%$q%\"") or die("ERROR!");
	$nb_result=mysql_num_rows($request);
	if($nb_result=="0")
	{
		echo "<br>Your search - <b>$q</b> - did not match any ip addresses.<br><br>

		<b>Suggestions:</b><br><br>

		<ul>
			<li>Make sure all words are spelled correctly.</li>
		    <li>Try different keywords.</li>
		    <li>Try more general keywords.</li>
		</ul>";
	}
	else
	{
	?>
	<table class="sortable list" id="sortable" width="100%" cellspacing="2" cellpadding="3">
	<tr class="list_title">
		<td width="10%" valign="top"><?php echo TXT_IP_ADDRESS; ?></td>
		<td width="11%" valign="top"><?php echo TXT_MAC_ADDRESS; ?></td>
		<td width="14%" valign="top"><?php echo TXT_SUBNET; ?></td>
		<td width="15%" valign="top"><?php echo TXT_NAME; ?></td>
		<td width="28%" valign="top"><?php echo TXT_DESCRIPTION; ?></td>
		<td width="10%" valign="top"><?php echo TXT_STATUS; ?></td>
		<td class="unsortable" width="12%" valign="top"><?php echo TXT_ACTION; ?></td>
	</tr>
	<?php
	while($tmp_request=mysql_fetch_array($request))
	{
		$list1 = "list1"; 
		$list2 = "list2"; 
		$line_count = 0; 
		$line_color = ($line_count % 2) ? $list1 : $list2;	
		
		?>
		<tr class="<?php echo "$line_color"; ?>">
			<td width="10%" valign="top"><?php print("<a href=\"index.php?include=mainview&page=ip_address&action=view&id=$tmp_request[id]\">$tmp_request[ip]</a>"); ?></td>
			<td width="10%" valign="top"><?php print("$tmp_request[mac_address]"); ?></td>
			<td width="15%" valign="top"><?php 
			$request2=mysql_query("SELECT id,name FROM $name_table_subnet WHERE id=$tmp_request[subnet_id]") or die ("ERROR!");

			while($tmp_request2=mysql_fetch_array($request2))
			{
				echo "<a href=\"index.php?include=mainview&page=subnet&action=view&id=$tmp_request2[id]\">$tmp_request2[name]</a>";
			}
			?></td>
			<td width="15%" valign="top"><?php echo $tmp_request['name']; ?></td>
			<td width="28%" valign="top"><?php echo $tmp_request['description']; ?></td>
			<td width="10%" valign="top" align="center"><?php			
			switch ($tmp_request['status'])
			{
				case '0':
				echo "<p style='margin:0px;background:#0000ff;color:#fff'>".TXT_ASSIGNED."</p>";
				break;
				
				case '1':
				echo "<p style='margin:0px;background:#00ff00;color:#fff'>".TXT_UNUSED."</p>";
				break;

				case '2':
				echo "<p style='margin:0px;background:#ff0000;color:#fff'>".TXT_RESERVED."</p>";
				break;
				
			}
			?></td> 			
			<td width="12%" valign="top">[ <?php print("<a href=\"index.php?include=mainview&page=ip_address&action=edit&id=$tmp_request[id]\">".TXT_EDIT."</a>"); ?> ] [ <?php print("<a href=\"index.php?include=mainview&page=ip_address&action=delete&id=$tmp_request[id]\">".TXT_DELETE."</a>"); ?> ]</td>	
		</tr>
		<?php	
		$line_count++;
	}
?>
	</table>
<?php
	}
}
else if ($what=="vlan")
{

	$q=trim(htmlentities($q));
	$q=str_replace("'"," ",$q);
	$q=str_replace("%"," ",$q);
?>
<div class="title"><img src="images/search.gif" alt="search" align="bottom"> <?php echo TXT_SEARCH; ?></div>
<br>
<center>
<form method="get" action="index.php" name="search">
<input type="hidden" name="include" value="search">
<input type="hidden" name="page" value="mainpage">
<fieldset class="form" style="border:0px;">
<table width="100%" cellspacing="0" cellpadding="0" align="center">
	<tr align="center">
		<td width="40%" align="right"><label style="padding-right: 55px"><b><?php echo TXT_WHAT; ?></b></label>
		<select name="what" size="1">
			<option value="location"><?php echo TXT_LOCATION; ?></option>
			<option value="rack"><?php echo TXT_RACK; ?></option>
			<option value="patch_panel"><?php echo TXT_PATCH_PANEL; ?></option>
			<option value="port"><?php echo TXT_PORT; ?></option>
			<option value="customer"><?php echo TXT_CUSTOMER; ?></option>
			<option value="network"><?php echo TXT_NETWORK; ?></option>
			<option value="subnet"><?php echo TXT_SUBNET; ?></option>
			<option value="ip_address"><?php echo TXT_IP_ADDRESS; ?></option>
			<option value="vlan" selected><?php echo TXT_VLAN; ?></option>
			<option value="device"><?php echo TXT_DEVICE; ?></option>
			<option value="manufacturer"><?php echo TXT_MANUFACTURER; ?></option>
			<option value="category"><?php echo TXT_CATEGORY; ?></option>
			<option value="model"><?php echo TXT_MODEL; ?></option>
			<option value="slot"><?php echo TXT_SLOT; ?></option>
			<option value="interface"><?php echo TXT_INTERFACE; ?></option>
		</select></td>
		<td width="50%" align="left" style="padding-left: 5px"><label><b><?php echo TXT_KEYWORDS; ?></b></label>
		<input type="text" name="q" size="30" value="<?php echo "$q"; ?>"> <input type="submit" value="<?php echo TXT_SEARCH; ?>"></td>
	</tr>
</table>
</fieldset>
</form>
</center>
<div class="title"><img src="images/vlan.gif" alt="vlan" align="bottom"> <?php echo TXT_VLAN; ?> "<?php echo "$q"; ?>"</div>
<?php

	$request = mysql_query("SELECT * FROM $name_table_vlan WHERE name LIKE \"%$q%\" OR description LIKE \"%$q%\" OR number LIKE \"%$q%\"") or die("ERROR!");
	$nb_result=mysql_num_rows($request);
	if($nb_result=="0")
	{
		echo "<br>Your search - <b>$q</b> - did not match any vlans.<br><br>

		<b>Suggestions:</b><br><br>

		<ul>
			<li>Make sure all words are spelled correctly.</li>
		    <li>Try different keywords.</li>
		    <li>Try more general keywords.</li>
		</ul>";
	}
	else
	{
	?>
	<table class="sortable list" id="sortable" width="100%" cellspacing="2" cellpadding="3">
	<tr class="list_title">
		<td width="15%" valign="top"><?php echo TXT_NAME; ?></td>
		<td width="15%" valign="top"><?php echo TXT_NUMBER; ?></td>
		<td width="25%" valign="top"><?php echo TXT_SUBNET; ?></td>
		<td width="28%" valign="top"><?php echo TXT_DESCRIPTION; ?></td>
		<td class="unsortable" width="12%" valign="top"><?php echo TXT_ACTION; ?></td>
	</tr>
	<?php
	while($tmp_request=mysql_fetch_array($request))
	{
		$list1 = "list1"; 
		$list2 = "list2"; 
		$line_count = 0; 
		$line_color = ($line_count % 2) ? $list1 : $list2;	
		
		?>
		<tr class="<?php echo "$line_color"; ?>">
			<td width="15%" valign="top"><?php print("<a href=\"index.php?include=mainview&page=vlan&action=view&id=$tmp_request[id]\">$tmp_request[name]</a>"); ?></td>
			<td width="15%" valign="top"><?php echo $tmp_request['number']; ?></td>
			<td width="25%" valign="top"><?php 
			
			$request2=mysql_query("SELECT * FROM $name_table_link_subnet_vlan WHERE vlan_id=$tmp_request[id]") or die ("ERROR!");

			while($tmp_request2=mysql_fetch_array($request2))
			{
				echo "<a href=\"index.php?include=mainview&page=subnet&action=view&id=$tmp_request2[subnet_id]\">";
				
				$request3=mysql_query("SELECT * FROM $name_table_subnet WHERE id=$tmp_request2[subnet_id]") or die ("ERROR!");
				
				while ($tmp_request3=mysql_fetch_array($request3))
				{
					$cidr = find_net($tmp_request3['address'],$tmp_request3['mask']);
					echo "$tmp_request3[name] ($tmp_request3[address]$cidr[cidr])</a><br>";
				}
				
			}
			?></td>
			<td width="28%" valign="top"><?php echo $tmp_request['description']; ?></td>
			<td width="12%" valign="top">[ <?php print("<a href=\"index.php?include=mainview&page=vlan&action=edit&id=$tmp_request[id]\">".TXT_EDIT."</a>"); ?> ] [ <?php print("<a href=\"index.php?include=mainview&page=vlan&action=delete&id=$tmp_request[id]\">".TXT_DELETE."</a>"); ?> ]</td>	
		</tr>
		<?php	
		$line_count++;
	}
?>
	</table>
<?php
	}
}
else if ($what=="device")
{

	$q=trim(htmlentities($q));
	$q=str_replace("'"," ",$q);
	$q=str_replace("%"," ",$q);
?>
<div class="title"><img src="images/search.gif" alt="search" align="bottom"> <?php echo TXT_SEARCH; ?></div>
<br>
<center>
<form method="get" action="index.php" name="search">
<input type="hidden" name="include" value="search">
<input type="hidden" name="page" value="mainpage">
<fieldset class="form" style="border:0px;">
<table width="100%" cellspacing="0" cellpadding="0" align="center">
	<tr align="center">
		<td width="40%" align="right"><label style="padding-right: 55px"><b><?php echo TXT_WHAT; ?></b></label>
		<select name="what" size="1">
			<option value="location"><?php echo TXT_LOCATION; ?></option>
			<option value="rack"><?php echo TXT_RACK; ?></option>
			<option value="patch_panel"><?php echo TXT_PATCH_PANEL; ?></option>
			<option value="port"><?php echo TXT_PORT; ?></option>
			<option value="customer"><?php echo TXT_CUSTOMER; ?></option>
			<option value="network"><?php echo TXT_NETWORK; ?></option>
			<option value="subnet"><?php echo TXT_SUBNET; ?></option>
			<option value="ip_address"><?php echo TXT_IP_ADDRESS; ?></option>
			<option value="vlan"><?php echo TXT_VLAN; ?></option>
			<option value="device" selected><?php echo TXT_DEVICE; ?></option>
			<option value="manufacturer"><?php echo TXT_MANUFACTURER; ?></option>
			<option value="category"><?php echo TXT_CATEGORY; ?></option>
			<option value="model"><?php echo TXT_MODEL; ?></option>
			<option value="slot"><?php echo TXT_SLOT; ?></option>
			<option value="interface"><?php echo TXT_INTERFACE; ?></option>
		</select></td>
		<td width="50%" align="left" style="padding-left: 5px"><label><b><?php echo TXT_KEYWORDS; ?></b></label>
		<input type="text" name="q" size="30" value="<?php echo "$q"; ?>"> <input type="submit" value="<?php echo TXT_SEARCH; ?>"></td>
	</tr>
</table>
</fieldset>
</form>
</center>
<div class="title"><img src="images/device.gif" alt="device" align="bottom"> <?php echo TXT_DEVICE; ?> "<?php echo "$q"; ?>"</div>
<?php

	$request = mysql_query("SELECT * FROM $name_table_device WHERE name LIKE \"%$q%\" OR description LIKE \"%$q%\" OR snmp_read_community LIKE \"%$q%\" OR snmp_port LIKE \"%$q%\"") or die("ERROR!");
	$nb_result=mysql_num_rows($request);
	if($nb_result=="0")
	{
		echo "<br>Your search - <b>$q</b> - did not match any devices.<br><br>

		<b>Suggestions:</b><br><br>

		<ul>
			<li>Make sure all words are spelled correctly.</li>
		    <li>Try different keywords.</li>
		    <li>Try more general keywords.</li>
		</ul>";
	}
	else
	{
	?>
	<table class="sortable list" id="sortable" width="100%" cellspacing="2" cellpadding="3">
	<tr class="list_title">
		<td valign="top"><?php echo TXT_NAME; ?></td>
		<td valign="top"><?php echo TXT_IP_ADDRESS; ?></td>
		<td valign="top"><?php echo TXT_MANUFACTURER; ?></td>
		<td valign="top"><?php echo TXT_CATEGORY; ?></td>
		<td valign="top"><?php echo TXT_MODEL; ?></td>
		<td valign="top"><?php echo TXT_LOCATION; ?></td>
		<td valign="top"><?php echo TXT_RACK; ?></td>
		<td valign="top"><?php echo TXT_DESCRIPTION; ?></td>
		<td class="unsortable" width="12%" valign="top"><?php echo TXT_ACTION; ?></td>
	</tr>
	<?php
	while($tmp_request=mysql_fetch_array($request))
	{
		$list1 = "list1"; 
		$list2 = "list2"; 
		$line_count = 0; 
		$line_color = ($line_count % 2) ? $list1 : $list2;	
		
		?>
		<tr class="<?php echo "$line_color"; ?>">
			<td valign="top"><?php print("<a href=\"index.php?include=mainview&page=device&action=view&id=$tmp_request[id]\">$tmp_request[name]</a>"); ?></td>
			<td valign="top"><?php 
			$request2=mysql_query("SELECT id,ip FROM $name_table_ip_address WHERE id=$tmp_request[ip_address_id]") or die ("ERROR!");
			
			while($tmp_request2=mysql_fetch_array($request2))
			{
				echo "<a href=\"index.php?include=mainview&page=ip_address&action=view&id=$tmp_request2[id]\">".$tmp_request2['ip']."</a>";
			}
			?></td>
			<td valign="top"><?php 
			$request2=mysql_query("SELECT id,name,manufacturer_id FROM $name_table_model WHERE id=$tmp_request[model_id]") or die ("ERROR!");
			
			while($tmp_request2=mysql_fetch_array($request2))
			{
				$request3=mysql_query("SELECT id,name FROM $name_table_manufacturer WHERE id=$tmp_request2[manufacturer_id]") or die ("ERROR!");
				
				while($tmp_request3=mysql_fetch_array($request3))
				{
					echo "<a href=\"index.php?include=mainview&page=manufacturer&action=view&id=$tmp_request3[id]\">".$tmp_request3['name']."</a>";
				}
			}
			?></td>
			<td valign="top"><?php 
			$request2=mysql_query("SELECT id,name,category_id FROM $name_table_model WHERE id=$tmp_request[model_id]") or die ("ERROR!");
			
			while($tmp_request2=mysql_fetch_array($request2))
			{
				$request3=mysql_query("SELECT id,name FROM $name_table_category WHERE id=$tmp_request2[category_id]") or die ("ERROR!");
				
				while($tmp_request3=mysql_fetch_array($request3))
				{
					echo "<a href=\"index.php?include=mainview&page=category&action=view&id=$tmp_request3[id]\">".$tmp_request3['name']."</a>";
				}
			}			
			?></td>
			<td valign="top"><?php 
			$request2=mysql_query("SELECT id,name FROM $name_table_model WHERE id=$tmp_request[model_id]") or die ("ERROR!");
			
			while($tmp_request2=mysql_fetch_array($request2))
			{
				echo "<a href=\"index.php?include=mainview&page=model&action=view&id=$tmp_request2[id]\">".$tmp_request2['name']."</a>";
			}
			?></td>
			<td valign="top"><?php 
			$request2=mysql_query("SELECT id,name,location_id FROM $name_table_rack WHERE id=$tmp_request[rack_id]") or die ("ERROR!");
			
			while($tmp_request2=mysql_fetch_array($request2))
			{
				$request3=mysql_query("SELECT id,name FROM $name_table_location WHERE id=$tmp_request2[location_id]") or die ("ERROR!");
				
				while($tmp_request3=mysql_fetch_array($request3))
				{
					echo "<a href=\"index.php?include=mainview&page=location&action=view&id=$tmp_request3[id]\">".$tmp_request3['name']."</a>";
				}
			}
			?></td>
			<td valign="top"><?php 
			$request2=mysql_query("SELECT id,name FROM $name_table_rack WHERE id=$tmp_request[rack_id]") or die ("ERROR!");
			
			while($tmp_request2=mysql_fetch_array($request2))
			{
				echo "<a href=\"index.php?include=mainview&page=rack&action=view&id=$tmp_request2[id]\">".$tmp_request2['name']."</a>";
			}

			?></td>
			<td valign="top"><?php echo $tmp_request['description']; ?></td>
			<td valign="top">[ <?php print("<a href=\"index.php?include=mainview&page=device&action=edit&id=$tmp_request[id]\">".TXT_EDIT."</a>"); ?> ] [ <?php print("<a href=\"index.php?include=mainview&page=device&action=delete&id=$tmp_request[id]\">".TXT_DELETE."</a>"); ?> ]</td>	
		</tr>
		<?php	
		$line_count++;
	}
?>
	</table>
<?php
	}
}
else if ($what=="manufacturer")
{

	$q=trim(htmlentities($q));
	$q=str_replace("'"," ",$q);
	$q=str_replace("%"," ",$q);
?>
<div class="title"><img src="images/search.gif" alt="search" align="bottom"> <?php echo TXT_SEARCH; ?></div>
<br>
<center>
<form method="get" action="index.php" name="search">
<input type="hidden" name="include" value="search">
<input type="hidden" name="page" value="mainpage">
<fieldset class="form" style="border:0px;">
<table width="100%" cellspacing="0" cellpadding="0" align="center">
	<tr align="center">
		<td width="40%" align="right"><label style="padding-right: 55px"><b><?php echo TXT_WHAT; ?></b></label>
		<select name="what" size="1">
			<option value="location"><?php echo TXT_LOCATION; ?></option>
			<option value="rack"><?php echo TXT_RACK; ?></option>
			<option value="patch_panel"><?php echo TXT_PATCH_PANEL; ?></option>
			<option value="port"><?php echo TXT_PORT; ?></option>
			<option value="customer"><?php echo TXT_CUSTOMER; ?></option>
			<option value="network"><?php echo TXT_NETWORK; ?></option>
			<option value="subnet"><?php echo TXT_SUBNET; ?></option>
			<option value="ip_address"><?php echo TXT_IP_ADDRESS; ?></option>
			<option value="vlan"><?php echo TXT_VLAN; ?></option>
			<option value="device"><?php echo TXT_DEVICE; ?></option>
			<option value="manufacturer" selected><?php echo TXT_MANUFACTURER; ?></option>
			<option value="category"><?php echo TXT_CATEGORY; ?></option>
			<option value="model"><?php echo TXT_MODEL; ?></option>
			<option value="slot"><?php echo TXT_SLOT; ?></option>
			<option value="interface"><?php echo TXT_INTERFACE; ?></option>
		</select></td>
		<td width="50%" align="left" style="padding-left: 5px"><label><b><?php echo TXT_KEYWORDS; ?></b></label>
		<input type="text" name="q" size="30" value="<?php echo "$q"; ?>"> <input type="submit" value="<?php echo TXT_SEARCH; ?>"></td>
	</tr>
</table>
</fieldset>
</form>
</center>
<div class="title"><img src="images/manufacturer.gif" alt="manufacturer" align="bottom"> <?php echo TXT_MANUFACTURER; ?> "<?php echo "$q"; ?>"</div>
<?php

	$request = mysql_query("SELECT * FROM $name_table_manufacturer WHERE name LIKE \"%$q%\" OR description LIKE \"%$q%\"") or die("ERROR!");
	$nb_result=mysql_num_rows($request);
	if($nb_result=="0")
	{
		echo "<br>Your search - <b>$q</b> - did not match any manufacturers.<br><br>

		<b>Suggestions:</b><br><br>

		<ul>
			<li>Make sure all words are spelled correctly.</li>
		    <li>Try different keywords.</li>
		    <li>Try more general keywords.</li>
		</ul>";
	}
	else
	{
	?>
	<table class="sortable list" id="sortable" width="100%" cellspacing="2" cellpadding="3">
	<tr class="list_title">
		<td width="20%" valign="top"><?php echo TXT_NAME; ?></td>
		<td width="58%" valign="top"><?php echo TXT_DESCRIPTION; ?></td>
		<td width="12%" valign="top" class="unsortable"><?php echo TXT_ACTION; ?></td>
	</tr>
	<?php
	while($tmp_request=mysql_fetch_array($request))
	{
		$list1 = "list1"; 
		$list2 = "list2"; 
		$line_count = 0; 
		$line_color = ($line_count % 2) ? $list1 : $list2;	
		
		?>
		<tr class="<?php echo "$line_color"; ?>">
			<td width="20%" valign="top"><?php print("<a href=\"index.php?include=mainview&page=manufacturer&action=view&id=$tmp_request[id]\">$tmp_request[name]</a>"); ?></td>
			<td width="58%" valign="top"><?php echo $tmp_request['description']; ?></td>
			<td width="12%" valign="top">[ <?php print("<a href=\"index.php?include=mainview&page=manufacturer&action=edit&id=$tmp_request[id]\">".TXT_EDIT."</a>"); ?> ] [ <?php print("<a href=\"index.php?include=mainview&page=manufacturer&action=delete&id=$tmp_request[id]\">".TXT_DELETE."</a>"); ?> ]</td>	
		</tr>
		<?php	
		$line_count++;
	}
?>
	</table>
<?php
	}
}
else if ($what=="category")
{

	$q=trim(htmlentities($q));
	$q=str_replace("'"," ",$q);
	$q=str_replace("%"," ",$q);
?>
<div class="title"><img src="images/search.gif" alt="search" align="bottom"> <?php echo TXT_SEARCH; ?></div>
<br>
<center>
<form method="get" action="index.php" name="search">
<input type="hidden" name="include" value="search">
<input type="hidden" name="page" value="mainpage">
<fieldset class="form" style="border:0px;">
<table width="100%" cellspacing="0" cellpadding="0" align="center">
	<tr align="center">
		<td width="40%" align="right"><label style="padding-right: 55px"><b><?php echo TXT_WHAT; ?></b></label>
		<select name="what" size="1">
			<option value="location"><?php echo TXT_LOCATION; ?></option>
			<option value="rack"><?php echo TXT_RACK; ?></option>
			<option value="patch_panel"><?php echo TXT_PATCH_PANEL; ?></option>
			<option value="port"><?php echo TXT_PORT; ?></option>
			<option value="customer"><?php echo TXT_CUSTOMER; ?></option>
			<option value="network"><?php echo TXT_NETWORK; ?></option>
			<option value="subnet"><?php echo TXT_SUBNET; ?></option>
			<option value="ip_address"><?php echo TXT_IP_ADDRESS; ?></option>
			<option value="vlan"><?php echo TXT_VLAN; ?></option>
			<option value="device"><?php echo TXT_DEVICE; ?></option>
			<option value="manufacturer"><?php echo TXT_MANUFACTURER; ?></option>
			<option value="category" selected><?php echo TXT_CATEGORY; ?></option>
			<option value="model"><?php echo TXT_MODEL; ?></option>
			<option value="slot"><?php echo TXT_SLOT; ?></option>
			<option value="interface"><?php echo TXT_INTERFACE; ?></option>
		</select></td>
		<td width="50%" align="left" style="padding-left: 5px"><label><b><?php echo TXT_KEYWORDS; ?></b></label>
		<input type="text" name="q" size="30" value="<?php echo "$q"; ?>"> <input type="submit" value="<?php echo TXT_SEARCH; ?>"></td>
	</tr>
</table>
</fieldset>
</form>
</center>
<div class="title"><img src="images/category.gif" alt="category" align="bottom"> <?php echo TXT_CATEGORY; ?> "<?php echo "$q"; ?>"</div>
<?php

	$request = mysql_query("SELECT * FROM $name_table_category WHERE name LIKE \"%$q%\" OR description LIKE \"%$q%\"") or die("ERROR!");
	$nb_result=mysql_num_rows($request);
	if($nb_result=="0")
	{
		echo "<br>Your search - <b>$q</b> - did not match any categories.<br><br>

		<b>Suggestions:</b><br><br>

		<ul>
			<li>Make sure all words are spelled correctly.</li>
		    <li>Try different keywords.</li>
		    <li>Try more general keywords.</li>
		</ul>";
	}
	else
	{
	?>
	<table class="sortable list" id="sortable" width="100%" cellspacing="2" cellpadding="3">
	<tr class="list_title">
		<td width="20%" valign="top"><?php echo TXT_NAME; ?></td>
		<td width="58%" valign="top"><?php echo TXT_DESCRIPTION; ?></td>
		<td width="12%" valign="top" class="unsortable"><?php echo TXT_ACTION; ?></td>
	</tr>
	<?php
	while($tmp_request=mysql_fetch_array($request))
	{
		$list1 = "list1"; 
		$list2 = "list2"; 
		$line_count = 0; 
		$line_color = ($line_count % 2) ? $list1 : $list2;	
		
		?>
		<tr class="<?php echo "$line_color"; ?>">
			<td width="20%" valign="top"><?php print("<a href=\"index.php?include=mainview&page=category&action=view&id=$tmp_request[id]\">$tmp_request[name]</a>"); ?></td>
			<td width="58%" valign="top"><?php echo $tmp_request['description']; ?></td>
			<td width="12%" valign="top">[ <?php print("<a href=\"index.php?include=mainview&page=category&action=edit&id=$tmp_request[id]\">".TXT_EDIT."</a>"); ?> ] [ <?php print("<a href=\"index.php?include=mainview&page=category&action=delete&id=$tmp_request[id]\">".TXT_DELETE."</a>"); ?> ]</td>	
		</tr>
		<?php	
		$line_count++;
	}
?>
	</table>
<?php
	}
}
else if ($what=="model")
{

	$q=trim(htmlentities($q));
	$q=str_replace("'"," ",$q);
	$q=str_replace("%"," ",$q);
?>
<div class="title"><img src="images/search.gif" alt="search" align="bottom"> <?php echo TXT_SEARCH; ?></div>
<br>
<center>
<form method="get" action="index.php" name="search">
<input type="hidden" name="include" value="search">
<input type="hidden" name="page" value="mainpage">
<fieldset class="form" style="border:0px;">
<table width="100%" cellspacing="0" cellpadding="0" align="center">
	<tr align="center">
		<td width="40%" align="right"><label style="padding-right: 55px"><b><?php echo TXT_WHAT; ?></b></label>
		<select name="what" size="1">
			<option value="location"><?php echo TXT_LOCATION; ?></option>
			<option value="rack"><?php echo TXT_RACK; ?></option>
			<option value="patch_panel"><?php echo TXT_PATCH_PANEL; ?></option>
			<option value="port"><?php echo TXT_PORT; ?></option>
			<option value="customer"><?php echo TXT_CUSTOMER; ?></option>
			<option value="network"><?php echo TXT_NETWORK; ?></option>
			<option value="subnet"><?php echo TXT_SUBNET; ?></option>
			<option value="ip_address"><?php echo TXT_IP_ADDRESS; ?></option>
			<option value="vlan"><?php echo TXT_VLAN; ?></option>
			<option value="device"><?php echo TXT_DEVICE; ?></option>
			<option value="manufacturer"><?php echo TXT_MANUFACTURER; ?></option>
			<option value="category"><?php echo TXT_CATEGORY; ?></option>
			<option value="model" selected><?php echo TXT_MODEL; ?></option>
			<option value="slot"><?php echo TXT_SLOT; ?></option>
			<option value="interface"><?php echo TXT_INTERFACE; ?></option>
		</select></td>
		<td width="50%" align="left" style="padding-left: 5px"><label><b><?php echo TXT_KEYWORDS; ?></b></label>
		<input type="text" name="q" size="30" value="<?php echo "$q"; ?>"> <input type="submit" value="<?php echo TXT_SEARCH; ?>"></td>
	</tr>
</table>
</fieldset>
</form>
</center>
<div class="title"><img src="images/model.gif" alt="model" align="bottom"> <?php echo TXT_MODEL; ?> "<?php echo "$q"; ?>"</div>
<?php

	$request = mysql_query("SELECT * FROM $name_table_model WHERE name LIKE \"%$q%\" OR description LIKE \"%$q%\" OR height LIKE \"%$q%\"") or die("ERROR!");
	$nb_result=mysql_num_rows($request);
	if($nb_result=="0")
	{
		echo "<br>Your search - <b>$q</b> - did not match any models.<br><br>

		<b>Suggestions:</b><br><br>

		<ul>
			<li>Make sure all words are spelled correctly.</li>
		    <li>Try different keywords.</li>
		    <li>Try more general keywords.</li>
		</ul>";
	}
	else
	{
	?>
	<table class="sortable list" id="sortable" width="100%" cellspacing="2" cellpadding="3">
	<tr class="list_title">
		<td width="10%" valign="top"><?php echo TXT_NAME; ?></td>
		<td width="12%" valign="top"><?php echo TXT_MANUFACTURER; ?></td>
		<td width="10%" valign="top"><?php echo TXT_CATEGORY; ?></td>
		<td width="6%" valign="top"><?php echo TXT_HEIGHT; ?></td>
		<td width="40%" valign="top"><?php echo TXT_DESCRIPTION; ?></td>
		<td width="12%" valign="top" class="unsortable"><?php echo TXT_ACTION; ?></td>
	</tr>
	<?php
	while($tmp_request=mysql_fetch_array($request))
	{
		$list1 = "list1"; 
		$list2 = "list2"; 
		$line_count = 0; 
		$line_color = ($line_count % 2) ? $list1 : $list2;	
		
		?>
		<tr class="<?php echo "$line_color"; ?>">
			<td width="10%" valign="top"><?php print("<a href=\"index.php?include=mainview&page=model&action=view&id=$tmp_request[id]\">$tmp_request[name]</a>"); ?></td>
			<td width="12%" valign="top"><?php 
			$request2=mysql_query("SELECT id,name FROM $name_table_manufacturer WHERE id=$tmp_request[manufacturer_id]") or die ("ERROR!");

			while($tmp_request2=mysql_fetch_array($request2))
			{
				echo "<a href=\"index.php?include=mainview&page=manufacturer&action=view&id=$tmp_request2[id]\">$tmp_request2[name]</a>";
			}
			?></td>
			<td width="10%" valign="top"><?php 
			$request3=mysql_query("SELECT id,name FROM $name_table_category WHERE id=$tmp_request[category_id]") or die ("ERROR!");

			while($tmp_request3=mysql_fetch_array($request3))
			{
				echo "<a href=\"index.php?include=mainview&page=category&action=view&id=$tmp_request3[id]\">$tmp_request3[name]</a>";
			}
			?></td>
			<td width="6%" valign="top"><?php echo $tmp_request['height']." U"; ?></td>
			<td width="40%" valign="top"><?php echo $tmp_request['description']; ?></td>
			<td width="12%" valign="top">[ <?php print("<a href=\"index.php?include=mainview&page=model&action=edit&id=$tmp_request[id]\">".TXT_EDIT."</a>"); ?> ] [ <?php print("<a href=\"index.php?include=mainview&page=model&action=delete&id=$tmp_request[id]\">".TXT_DELETE."</a>"); ?> ]</td>	
		</tr>
		<?php	
		$line_count++;
	}
?>
	</table>
<?php
	}
}
else if ($what=="slot")
{

	$q=trim(htmlentities($q));
	$q=str_replace("'"," ",$q);
	$q=str_replace("%"," ",$q);
?>
<div class="title"><img src="images/search.gif" alt="search" align="bottom"> <?php echo TXT_SEARCH; ?></div>
<br>
<center>
<form method="get" action="index.php" name="search">
<input type="hidden" name="include" value="search">
<input type="hidden" name="page" value="mainpage">
<fieldset class="form" style="border:0px;">
<table width="100%" cellspacing="0" cellpadding="0" align="center">
	<tr align="center">
		<td width="40%" align="right"><label style="padding-right: 55px"><b><?php echo TXT_WHAT; ?></b></label>
		<select name="what" size="1">
			<option value="location"><?php echo TXT_LOCATION; ?></option>
			<option value="rack"><?php echo TXT_RACK; ?></option>
			<option value="patch_panel"><?php echo TXT_PATCH_PANEL; ?></option>
			<option value="port"><?php echo TXT_PORT; ?></option>
			<option value="customer"><?php echo TXT_CUSTOMER; ?></option>
			<option value="network"><?php echo TXT_NETWORK; ?></option>
			<option value="subnet"><?php echo TXT_SUBNET; ?></option>
			<option value="ip_address"><?php echo TXT_IP_ADDRESS; ?></option>
			<option value="vlan"><?php echo TXT_VLAN; ?></option>
			<option value="device"><?php echo TXT_DEVICE; ?></option>
			<option value="manufacturer"><?php echo TXT_MANUFACTURER; ?></option>
			<option value="category"><?php echo TXT_CATEGORY; ?></option>
			<option value="model"><?php echo TXT_MODEL; ?></option>
			<option value="slot" selected><?php echo TXT_SLOT; ?></option>
			<option value="interface"><?php echo TXT_INTERFACE; ?></option>
		</select></td>
		<td width="50%" align="left" style="padding-left: 5px"><label><b><?php echo TXT_KEYWORDS; ?></b></label>
		<input type="text" name="q" size="30" value="<?php echo "$q"; ?>"> <input type="submit" value="<?php echo TXT_SEARCH; ?>"></td>
	</tr>
</table>
</fieldset>
</form>
</center>
<div class="title"><img src="images/slot.gif" alt="slot" align="bottom"> <?php echo TXT_SLOT; ?> "<?php echo "$q"; ?>"</div>
<?php

	$request = mysql_query("SELECT * FROM $name_table_slot WHERE name LIKE \"%$q%\" OR description LIKE \"%$q%\" OR number LIKE \"%$q%\"") or die("ERROR!");
	$nb_result=mysql_num_rows($request);
	if($nb_result=="0")
	{
		echo "<br>Your search - <b>$q</b> - did not match any slots.<br><br>

		<b>Suggestions:</b><br><br>

		<ul>
			<li>Make sure all words are spelled correctly.</li>
		    <li>Try different keywords.</li>
		    <li>Try more general keywords.</li>
		</ul>";
	}
	else
	{
	?>
	<table class="sortable list" id="sortable" width="100%" cellspacing="2" cellpadding="3">
	<tr class="list_title">
		<td width="30%" valign="top"><?php echo TXT_DEVICE; ?></td>
		<td width="15%" valign="top"><?php echo TXT_NAME; ?></td>
		<td width="8%" valign="top"><?php echo TXT_NUMBER; ?></td>
		<td width="35%" valign="top"><?php echo TXT_DESCRIPTION; ?></td>
		<td width="12%" valign="top" class="unsortable"><?php echo TXT_ACTION; ?></td>
	</tr>
	<?php
	while($tmp_request=mysql_fetch_array($request))
	{
		$list1 = "list1"; 
		$list2 = "list2"; 
		$line_count = 0; 
		$line_color = ($line_count % 2) ? $list1 : $list2;	
		
		?>
		<tr class="<?php echo "$line_color"; ?>">
			<td width="30%" valign="top"><?php
			
			$request2=mysql_query("SELECT id,name FROM $name_table_device WHERE id=$tmp_request[device_id]") or die ("ERROR!");

			while($tmp_request2=mysql_fetch_array($request2))
			{
				echo "<a href=\"index.php?include=mainview&page=device&action=view&id=$tmp_request2[id]\">$tmp_request2[name]</a>";
			}
					
			?></td>
			<td width="15%" valign="top"><?php print("<a href=\"index.php?include=mainview&page=slot&action=view&id=$tmp_request[id]\">$tmp_request[name]</a>"); ?></td>
			<td width="8%" valign="top"><?php print("$tmp_request[number]"); ?></td>
			<td width="35%" valign="top"><?php echo $tmp_request['description']; ?></td>
			<td width="12%" valign="top">[ <?php print("<a href=\"index.php?include=mainview&page=slot&action=edit&id=$tmp_request[id]\">".TXT_EDIT."</a>"); ?> ] [ <?php print("<a href=\"index.php?include=mainview&page=slot&action=delete&id=$tmp_request[id]\">".TXT_DELETE."</a>"); ?> ]</td>	
		</tr>
		<?php	
		$line_count++;
	}
?>
	</table>
<?php
	}
}
else if ($what=="interface")
{

	$q=trim(htmlentities($q));
	$q=str_replace("'"," ",$q);
	$q=str_replace("%"," ",$q);
?>
<div class="title"><img src="images/search.gif" alt="search" align="bottom"> <?php echo TXT_SEARCH; ?></div>
<br>
<center>
<form method="get" action="index.php" name="search">
<input type="hidden" name="include" value="search">
<input type="hidden" name="page" value="mainpage">
<fieldset class="form" style="border:0px;">
<table width="100%" cellspacing="0" cellpadding="0" align="center">
	<tr align="center">
		<td width="40%" align="right"><label style="padding-right: 55px"><b><?php echo TXT_WHAT; ?></b></label>
		<select name="what" size="1">
			<option value="location"><?php echo TXT_LOCATION; ?></option>
			<option value="rack"><?php echo TXT_RACK; ?></option>
			<option value="patch_panel"><?php echo TXT_PATCH_PANEL; ?></option>
			<option value="port"><?php echo TXT_PORT; ?></option>
			<option value="customer"><?php echo TXT_CUSTOMER; ?></option>
			<option value="network"><?php echo TXT_NETWORK; ?></option>
			<option value="subnet"><?php echo TXT_SUBNET; ?></option>
			<option value="ip_address"><?php echo TXT_IP_ADDRESS; ?></option>
			<option value="vlan"><?php echo TXT_VLAN; ?></option>
			<option value="device"><?php echo TXT_DEVICE; ?></option>
			<option value="manufacturer"><?php echo TXT_MANUFACTURER; ?></option>
			<option value="category"><?php echo TXT_CATEGORY; ?></option>
			<option value="model"><?php echo TXT_MODEL; ?></option>
			<option value="slot"><?php echo TXT_SLOT; ?></option>
			<option value="interface" selected><?php echo TXT_INTERFACE; ?></option>
		</select></td>
		<td width="50%" align="left" style="padding-left: 5px"><label><b><?php echo TXT_KEYWORDS; ?></b></label>
		<input type="text" name="q" size="30" value="<?php echo "$q"; ?>"> <input type="submit" value="<?php echo TXT_SEARCH; ?>"></td>
	</tr>
</table>
</fieldset>
</form>
</center>
<div class="title"><img src="images/interface.gif" alt="interface" align="bottom"> <?php echo TXT_INTERFACE; ?> "<?php echo "$q"; ?>"</div>
<?php

	$request = mysql_query("SELECT * FROM $name_table_interface WHERE name LIKE \"%$q%\" OR description LIKE \"%$q%\" OR speed LIKE \"%$q%\"") or die("ERROR!");
	$nb_result=mysql_num_rows($request);
	if($nb_result=="0")
	{
		echo "<br>Your search - <b>$q</b> - did not match any interfaces.<br><br>

		<b>Suggestions:</b><br><br>

		<ul>
			<li>Make sure all words are spelled correctly.</li>
		    <li>Try different keywords.</li>
		    <li>Try more general keywords.</li>
		</ul>";
	}
	else
	{
	?>
	<table class="sortable list" id="sortable" width="100%" cellspacing="2" cellpadding="3">
	<tr class="list_title">
		<td valign="top"><?php echo TXT_DEVICE; ?></td>
		<td valign="top"><?php echo TXT_SLOT; ?></td>
		<td valign="top"><?php echo TXT_INDEX; ?></td>
		<td valign="top"><?php echo TXT_NAME; ?></td>
		<td valign="top"><?php echo TXT_TYPE; ?></td>
		<td valign="top"><?php echo TXT_SPEED; ?></td>
		<td valign="top"><?php echo TXT_DESCRIPTION; ?></td>
		<td class="unsortable" width="12%" valign="top"><?php echo TXT_ACTION; ?></td>
	</tr>
	<?php
	while($tmp_request=mysql_fetch_array($request))
	{
		$list1 = "list1"; 
		$list2 = "list2"; 
		$line_count = 0; 
		$line_color = ($line_count % 2) ? $list1 : $list2;	
		
	$arrayifType[1] = "other";
	$arrayifType[2] = "regular1822";
	$arrayifType[3] = "hdh1822";
	$arrayifType[4] = "ddnX25";
	$arrayifType[5] = "rfc877x25";
	$arrayifType[6] = "ethernetCsmacd";
	$arrayifType[7] = "iso88023Csmacd";
	$arrayifType[8] = "iso88024TokenBus";
	$arrayifType[9] = "iso88025TokenRing";
	$arrayifType[10] = "iso88026Man";
	$arrayifType[11] = "starLan";
	$arrayifType[12] = "proteon10Mbit";
	$arrayifType[13] = "proteon80Mbit";
	$arrayifType[14] = "hyperchannel";
	$arrayifType[15] = "fddi";
	$arrayifType[16] = "lapb";
	$arrayifType[17] = "sdlc";
	$arrayifType[18] = "ds1";
	$arrayifType[19] = "e1";
	$arrayifType[20] = "basicISDN";
	$arrayifType[21] = "primaryISDN";
	$arrayifType[22] = "propPointToPointSerial";
	$arrayifType[23] = "ppp";
	$arrayifType[24] = "softwareLoopback";
	$arrayifType[25] = "eon";
	$arrayifType[26] = "ethernet3Mbit";
	$arrayifType[27] = "nsip";
	$arrayifType[28] = "slip";
	$arrayifType[29] = "ultra";
	$arrayifType[30] = "ds3";
	$arrayifType[31] = "sip";
	$arrayifType[32] = "frameRelay";
	$arrayifType[33] = "rs232";
	$arrayifType[34] = "para";
	$arrayifType[35] = "arcnet";
	$arrayifType[36] = "arcnetPlus";
	$arrayifType[37] = "atm";
	$arrayifType[38] = "miox25";
	$arrayifType[39] = "sonet";
	$arrayifType[40] = "x25ple";
	$arrayifType[41] = "iso88022llc";
	$arrayifType[42] = "localTalk";
	$arrayifType[43] = "smdsDxi";
	$arrayifType[44] = "frameRelayService";
	$arrayifType[45] = "v35";
	$arrayifType[46] = "hssi";
	$arrayifType[47] = "hippi";
	$arrayifType[48] = "modem";
	$arrayifType[49] = "aal5";
	$arrayifType[50] = "sonetPath";
	$arrayifType[51] = "sonetVT";
	$arrayifType[52] = "smdsIcip";
	$arrayifType[53] = "propVirtual";
	$arrayifType[54] = "propMultiplexor";
	$arrayifType[55] = "ieee80212";
	$arrayifType[56] = "fibreChannel";
	$arrayifType[57] = "hippiInterface";
	$arrayifType[58] = "frameRelayInterconnect";
	$arrayifType[59] = "aflane8023";
	$arrayifType[60] = "aflane8025";
	$arrayifType[61] = "cctEmul";
	$arrayifType[62] = "fastEther";
	$arrayifType[63] = "isdn";
	$arrayifType[64] = "v11";
	$arrayifType[65] = "v36";
	$arrayifType[66] = "g703at64k";
	$arrayifType[67] = "g703at2mb";
	$arrayifType[68] = "qllc";
	$arrayifType[69] = "fastEtherFX";
	$arrayifType[70] = "channel";
	$arrayifType[71] = "ieee80211";
	$arrayifType[72] = "ibm370parChan";
	$arrayifType[73] = "escon";
	$arrayifType[74] = "dlsw";
	$arrayifType[75] = "isdns";
	$arrayifType[76] = "isdnu";
	$arrayifType[77] = "lapd";
	$arrayifType[78] = "ipSwitch";
	$arrayifType[79] = "rsrb";
	$arrayifType[80] = "atmLogical";
	$arrayifType[81] = "ds0";
	$arrayifType[82] = "ds0Bundle";
	$arrayifType[83] = "bsc";
	$arrayifType[84] = "async";
	$arrayifType[85] = "cnr";
	$arrayifType[86] = "iso88025Dtr";
	$arrayifType[87] = "eplrs";
	$arrayifType[88] = "arap";
	$arrayifType[89] = "propCnls";
	$arrayifType[90] = "hostPad";
	$arrayifType[91] = "termPad";
	$arrayifType[92] = "frameRelayMPI";
	$arrayifType[93] = "x213";
	$arrayifType[94] = "adsl";
	$arrayifType[95] = "radsl";
	$arrayifType[96] = "sdsl";
	$arrayifType[97] = "vdsl";
	$arrayifType[98] = "iso88025CRFPInt";
	$arrayifType[99] = "myrinet";
	$arrayifType[100] = "voiceEM";
	$arrayifType[101] = "voiceFXO";
	$arrayifType[102] = "voiceFXS";
	$arrayifType[103] = "voiceEncap";
	$arrayifType[104] = "voiceOverIp";
	$arrayifType[105] = "atmDxi";
	$arrayifType[106] = "atmFuni";
	$arrayifType[107] = "atmIma";
	$arrayifType[108] = "pppMultilinkBundle";
	$arrayifType[109] = "ipOverCdlc";
	$arrayifType[110] = "ipOverClaw";
	$arrayifType[111] = "stackToStack";
	$arrayifType[112] = "virtualIpAddress";
	$arrayifType[113] = "mpc";
	$arrayifType[114] = "ipOverAtm";
	$arrayifType[115] = "iso88025Fiber";
	$arrayifType[116] = "tdlc";
	$arrayifType[117] = "gigabitEthernet";
	$arrayifType[118] = "hdlc";
	$arrayifType[119] = "lapf";
	$arrayifType[120] = "v37";
	$arrayifType[121] = "x25mlp";
	$arrayifType[122] = "x25huntGroup";
	$arrayifType[123] = "trasnpHdlc";
	$arrayifType[124] = "interleave";
	$arrayifType[125] = "fast";
	$arrayifType[126] = "ip";
	$arrayifType[127] = "docsCableMaclayer";
	$arrayifType[128] = "docsCableDownstream";
	$arrayifType[129] = "docsCableUpstream";
	$arrayifType[130] = "a12MppSwitch";
	$arrayifType[131] = "tunnel";
	$arrayifType[132] = "coffee";
	$arrayifType[133] = "ces";
	$arrayifType[134] = "atmSubInterface";
	$arrayifType[135] = "l2vlan";
	$arrayifType[136] = "l3ipvlan";
	$arrayifType[137] = "l3ipxvlan";
	$arrayifType[138] = "digitalPowerline";
	$arrayifType[139] = "mediaMailOverIp";
	$arrayifType[140] = "dtm";
	$arrayifType[141] = "dcn";
	$arrayifType[142] = "ipForward";
	$arrayifType[143] = "msdsl";
	$arrayifType[144] = "ieee1394";
	$arrayifType[145] = "if-gsn";
	$arrayifType[146] = "dvbRccMacLayer";
	$arrayifType[147] = "dvbRccDownstream";
	$arrayifType[148] = "dvbRccUpstream";
	$arrayifType[149] = "atmVirtual";
	$arrayifType[150] = "mplsTunnel";
	$arrayifType[151] = "srp";
	$arrayifType[152] = "voiceOverAtm";
	$arrayifType[153] = "voiceOverFrameRelay";
	$arrayifType[154] = "idsl";
	$arrayifType[155] = "compositeLink";
	$arrayifType[156] = "ss7SigLink";
	$arrayifType[157] = "propWirelessP2P";
	$arrayifType[158] = "frForward";
	$arrayifType[159] = "rfc1483";
	$arrayifType[160] = "usb";
	$arrayifType[161] = "ieee8023adLag";
	$arrayifType[162] = "bgppolicyaccounting";
	$arrayifType[163] = "frf16MfrBundle";
	$arrayifType[164] = "h323Gatekeeper";
	$arrayifType[165] = "h323Proxy";
	$arrayifType[166] = "mpls";
	$arrayifType[167] = "mfSigLink";
	$arrayifType[168] = "hdsl2";
	$arrayifType[169] = "shdsl";
	$arrayifType[170] = "ds1FDL";
	$arrayifType[171] = "pos";
	$arrayifType[172] = "dvbAsiIn";
	$arrayifType[173] = "dvbAsiOut";
	$arrayifType[174] = "plc";
	$arrayifType[175] = "nfas";
	$arrayifType[176] = "tr008";
	$arrayifType[177] = "gr303RDT";
	$arrayifType[178] = "gr303IDT";
	$arrayifType[179] = "isup";
	$arrayifType[180] = "propDocsWirelessMaclayer";
	$arrayifType[181] = "propDocsWirelessDownstream";
	$arrayifType[182] = "propDocsWirelessUpstream";
	$arrayifType[183] = "hiperlan2";
	$arrayifType[184] = "propBWAp2Mp";
	$arrayifType[185] = "sonetOverheadChannel";
	$arrayifType[186] = "digitalWrapperOverheadChannel";
	$arrayifType[187] = "aal2";
	$arrayifType[188] = "radioMAC";
	$arrayifType[189] = "atmRadio";
	$arrayifType[190] = "imt";
	$arrayifType[191] = "mvl";
	$arrayifType[192] = "reachDSL";
	$arrayifType[193] = "frDlciEndPt";
	$arrayifType[194] = "atmVciEndPt";
	$arrayifType[195] = "opticalChannel";
	$arrayifType[196] = "opticalTransport";
	$arrayifType[197] = "propAtm";
	$arrayifType[198] = "voiceOverCable";
	$arrayifType[199] = "infiniband";
	$arrayifType[200] = "teLink";
	$arrayifType[201] = "q2931";
	$arrayifType[202] = "virtualTg";
	$arrayifType[203] = "sipTg";
	$arrayifType[204] = "sipSig";
	$arrayifType[205] = "docsCableUpstreamChannel";
	$arrayifType[206] = "econet";
	$arrayifType[207] = "pon155";
	$arrayifType[208] = "pon622";
	$arrayifType[209] = "bridge";
	$arrayifType[210] = "linegroup";
	$arrayifType[211] = "voiceEMFGD";
	$arrayifType[212] = "voiceFGDEANA";
	$arrayifType[213] = "voiceDID";
	$arrayifType[214] = "mpegTransport";
	$arrayifType[215] = "sixToFour";
	$arrayifType[216] = "gtp";
	$arrayifType[217] = "pdnEtherLoop1";
	$arrayifType[218] = "pdnEtherLoop2";
	$arrayifType[219] = "opticalChannelGroup";
	$arrayifType[220] = "homepna";
	$arrayifType[221] = "gfp";
	$arrayifType[222] = "ciscoISLvlan";
	$arrayifType[223] = "actelisMetaLOOP";
	$arrayifType[224] = "fcipLink";
	$arrayifType[225] = "rpr";
	$arrayifType[226] = "qam";
	$arrayifType[227] = "lmp";
	$arrayifType[228] = "cblVectaStar";
	$arrayifType[229] = "docsCableMCmtsDownstream";
	$arrayifType[230] = "adsl2";
	$arrayifType[231] = "macSecControlledIF";
	$arrayifType[232] = "macSecUncontrolledIF";
	$arrayifType[233] = "aviciOpticalEther";
	$arrayifType[234] = "atmbond";
	$arrayifType[235] = "voiceFGDOS";
	$arrayifType[236] = "mocaVersion1";
	$arrayifType[237] = "ieee80216WMAN";
	$arrayifType[238] = "adsl2plus";
	$arrayifType[239] = "dvbRcsMacLayer";
	$arrayifType[240] = "dvbTdm";
	$arrayifType[241] = "dvbRcsTdma";
	$arrayifType[242] = "x86Laps";
		
		?>
		<tr class="<?php echo "$line_color"; ?>">
			<td valign="top"><?php 
			$request2=mysql_query("SELECT id,name,device_id FROM $name_table_slot WHERE id=$tmp_request[slot_id]") or die ("ERROR!");

			while($tmp_request2=mysql_fetch_array($request2))
			{
				$request3=mysql_query("SELECT id,name FROM $name_table_device WHERE id=$tmp_request2[device_id]") or die ("ERROR!");

				while($tmp_request3=mysql_fetch_array($request3))
				{
					echo "<a href=\"index.php?include=mainview&page=device&action=view&id=$tmp_request3[id]\">$tmp_request3[name]</a>";
				}
			}
			?></td>
			<td valign="top"><?php 
			$request2=mysql_query("SELECT id,name FROM $name_table_slot WHERE id=$tmp_request[slot_id]") or die ("ERROR!");

			while($tmp_request2=mysql_fetch_array($request2))
			{
				echo "<a href=\"index.php?include=mainview&page=slot&action=view&id=$tmp_request2[id]\">$tmp_request2[name]</a>";
			}
			?></td>
			<td valign="top"><?php echo $tmp_request['index']; ?></td>
			<td valign="top"><?php print("<a href=\"index.php?include=mainview&page=interface&action=view&id=$tmp_request[id]\">$tmp_request[name]</a>"); ?></td>
			<td valign="top"><?php 
			foreach ($arrayifType as $key => $arrayvalue)
			{
				if ($key == $tmp_request['type'])
				{
					echo "$arrayvalue";
				}
			}
			?></td>
			<td valign="top"><?php 
			switch ($tmp_request['speed'])
			{
				case '1000':
				echo "10/100/1000 Mbps";
				break;
				
				case '100':
				echo "10/100 Mbps";
				break;
				
				case '10':
				echo "10 Mbps";
				break;
			}
			?></td>
			<td valign="top"><?php echo $tmp_request['description']; ?></td>		
			<td width="12%" valign="top">[ <?php print("<a href=\"index.php?include=mainview&page=interface&action=edit&id=$tmp_request[id]\">".TXT_EDIT."</a>"); ?> ] [ <?php print("<a href=\"index.php?include=mainview&page=interface&action=view&id=$tmp_request[id]\"><?php echo TXT_VIEW; ?></a>"); ?> ]</td>	
		</tr>
		<?php	
		$line_count++;
	}
?>
	</table>
<?php
	}
}
?>
Return current item: OpenDataCenter Network Management System