2011-03-17 00:09:20 +00:00
<? php
2010-07-26 17:28:51 +00:00
if ( $_POST [ 'hostname' ]) { $where = " AND hostname LIKE '%" . mres ( $_POST [ 'hostname' ]) . "%'" ; }
if ( $_POST [ 'os' ]) { $where = " AND os = '" . mres ( $_POST [ 'os' ]) . "'" ; }
if ( $_POST [ 'version' ]) { $where .= " AND version = '" . mres ( $_POST [ 'version' ]) . "'" ; }
if ( $_POST [ 'hardware' ]) { $where .= " AND hardware = '" . mres ( $_POST [ 'hardware' ]) . "'" ; }
if ( $_POST [ 'features' ]) { $where .= " AND features = '" . mres ( $_POST [ 'features' ]) . "'" ; }
if ( $_POST [ 'location' ]) { $where .= " AND location = '" . mres ( $_POST [ 'location' ]) . "'" ; }
if ( $_GET [ 'location' ] && ! isset ( $_POST [ 'location' ])) { $where .= " AND location = '" . mres ( $_GET [ 'location' ]) . "'" ; }
if ( $_GET [ 'type' ]) { $where = "AND type = '" . mres ( $_GET [ type ]) . "'" ; }
if ( $_GET [ 'location' ] == "Unset" ) { $where .= " AND location = ''" ; }
2011-03-17 00:09:20 +00:00
print_optionbar_start ( 62 );
2010-07-26 17:28:51 +00:00
?>
2010-02-06 22:14:43 +00:00
<table cellpadding="4" cellspacing="0" class="devicetable" width="100%">
<form method="post" action="">
2011-03-17 00:09:20 +00:00
<tr>
2010-02-06 22:14:43 +00:00
<td width="30" align="center" valign="middle"></td>
<td width="300"><span style="font-weight: bold; font-size: 14px;"></span>
2011-03-26 19:28:39 +00:00
<input type="text" name="hostname" id="hostname" size="40" value="<?php echo($_POST['hostname']); ?>" />
2010-02-06 22:14:43 +00:00
</td>
<td width="200">
<select name='os' id='os'>
<option value=''>All OSes</option>
<?php
2010-07-26 17:28:51 +00:00
$query = mysql_query("SELECT `os` FROM `devices` WHERE 1 $where GROUP BY `os` ORDER BY `os`");
2011-03-17 00:09:20 +00:00
while ($data = mysql_fetch_array($query))
2010-02-06 22:14:43 +00:00
{
if ($data['os'])
{
echo("<option value='".$data['os']."'");
2010-02-06 22:20:59 +00:00
if ($data['os'] == $_POST['os']) { echo(" selected"); }
2010-06-25 12:18:00 +00:00
echo(">".$config['os'][$data['os']]['text']."</option>");
2010-02-06 22:14:43 +00:00
}
}
?>
</select>
<br />
<select name='version' id='version'>
<option value=''>All Versions</option>
<?php
2010-07-26 17:28:51 +00:00
$query = mysql_query("SELECT `version` FROM `devices` WHERE 1 $where GROUP BY `version` ORDER BY `version`");
2011-03-17 00:09:20 +00:00
while ($data = mysql_fetch_array($query))
2010-02-06 22:14:43 +00:00
{
if ($data['version'])
{
echo("<option value='".$data['version']."'");
2010-02-06 22:20:59 +00:00
if ($data['version'] == $_POST['version']) { echo(" selected"); }
2010-02-06 22:14:43 +00:00
echo(">".$data['version']."</option>");
}
}
?>
</select>
</td>
<td width="200">
<select name="hardware" id="hardware">
<option value="">All Platforms</option>
<?php
2010-07-26 17:28:51 +00:00
$query = mysql_query("SELECT `hardware` FROM `devices` WHERE 1 $where GROUP BY `hardware` ORDER BY `hardware`");
2011-03-17 00:09:20 +00:00
while ($data = mysql_fetch_array($query))
2010-02-06 22:14:43 +00:00
{
if ($data['hardware'])
{
echo('<option value="'.$data['hardware'].'"');
2010-02-06 22:20:59 +00:00
if ($data['hardware'] == $_POST['hardware']) { echo(" selected"); }
2010-02-06 22:14:43 +00:00
echo(">".$data['hardware']."</option>");
}
}
?>
</select>
<br />
<select name="features" id="features">
<option value="">All Featuresets</option>
<?php
2010-07-26 17:28:51 +00:00
$query = mysql_query("SELECT `features` FROM `devices` WHERE 1 $where GROUP BY `features` ORDER BY `features`");
2011-03-17 00:09:20 +00:00
while ($data = mysql_fetch_array($query))
2010-02-06 22:14:43 +00:00
{
if ($data['features'])
{
echo('<option value="'.$data['features'].'"');
2010-02-06 22:20:59 +00:00
if ($data['features'] == $_POST['features']) { echo(" selected"); }
2010-02-06 22:14:43 +00:00
echo(">".$data['features']."</option>");
}
}
?>
</select>
</td>
<td>
<select name="location" id="location">
<option value="">All Locations</option>
<?php
2011-03-17 21:02:28 +00:00
2011-03-26 19:12:24 +00:00
if($_SESSION['userlevel'] >= '5')
{
2011-03-17 21:02:28 +00:00
$query = mysql_query("SELECT location FROM devices WHERE 1 $where GROUP BY location ORDER BY location");
} else {
$query = mysql_query("SELECT location FROM devices AS D, devices_perms AS P WHERE 1 $where AND D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' GROUP BY location ORDER BY location");
}
2011-03-17 00:09:20 +00:00
while ($data = mysql_fetch_array($query))
2010-02-06 22:14:43 +00:00
{
if ($data['location'])
{
echo('<option value="'.$data['location'].'"');
2010-02-06 22:20:59 +00:00
if ($data['location'] == $_POST['location']) { echo(" selected"); }
2010-02-06 22:14:43 +00:00
echo(">".$data['location']."</option>");
}
}
?>
</select>
2010-02-07 14:17:02 +00:00
<input class="submit" type="submit" class="submit" value="Search">
2010-02-06 22:14:43 +00:00
</td>
<td width="10"></td>
</tr>
2009-03-20 13:25:19 +00:00
</form>
</table>
2007-04-03 14:10:23 +00:00
<?php
2010-01-09 02:10:34 +00:00
print_optionbar_end();
2010-02-06 22:14:43 +00:00
$sql = "SELECT * FROM devices WHERE 1 $where ORDER BY `ignore`, `status`, `hostname`";
2011-03-17 00:09:20 +00:00
if ($_GET['status'] == "alerted")
{
$sql = "SELECT * FROM devices " . $device_alert_sql . " GROUP BY `device_id` ORDER BY `ignore`, `status`, `os`, `hostname`";
2007-06-24 14:56:47 +00:00
}
2007-04-03 14:10:23 +00:00
2011-03-19 01:43:13 +00:00
echo('<table cellpadding="7" cellspacing="0" class="devicetable sortable" width="100%">
2010-09-26 22:48:48 +00:00
<tr class="tablehead"><th></th><th>Device</th><th></th><th>Operating System</th><th>Platform</th><th>Uptime</th></tr>');
2009-03-20 13:25:19 +00:00
$device_query = mysql_query($sql);
2011-03-17 00:09:20 +00:00
while ($device = mysql_fetch_array($device_query))
{
if (device_permitted($device['device_id']))
{
2011-03-12 08:50:47 +00:00
include("includes/hostbox.inc.php");
2007-06-24 14:56:47 +00:00
}
2007-04-03 14:10:23 +00:00
}
echo("</table>");
?>