<?
/***************************************************************************
* Copyright (C) 2005 by J Randolph Smith *
* hide@address.com *
* *
* This program 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. *
* *
* This program 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 this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
$temp_sensorid = $_REQUEST['FRM_sensorid'];
$tab = (isset($_REQUEST['tab']) ? $_REQUEST['tab'] : 0 );
/*** Create an array of all available variables ***/
$vari = array();
while ($row = $rsVaris->fetchRow(DB_FETCHMODE_ASSOC))
{
$var = $row['varname'].$row['id'];
$vari[$var]['name'] = $row['varname'];
$vari[$var]['value'] = $row['varvalue'];
$vari[$var]['id'] = $row['id'];
$vari[$var]['selected'] = 0;
}
/* Go back and update which are currently selected. */
while ($row = $rsVarSel->fetchRow(DB_FETCHMODE_ASSOC))
{
$var = $row['varname'].$row['id'];
$vari[$var]['selected'] = 1;
}
/*** Draw the Sensor dropdown box ***/
$temp_sensor_combo = "<SELECT name=\"FRM_sensorid\" onchange=\"this.form.submit();\">\n";
while ($row = $rsSensors->fetchRow(DB_FETCHMODE_ASSOC))
{
$sel = ($row['id'] == $temp_sensorid ? "selected" : "" );
$temp_sensor_combo .= "<OPTION value=\"".$row['id']."\" ".$sel.">".$row['name']."</OPTION>\n";
}
$temp_sensor_combo .= "</SELECT>\n";
include_once("sensorconf/dsp_header.php");
?>
<BR><BR>
<BR>
<CENTER>
<TABLE border="0" width="600" class="bg2" cellpadding="4">
<TR>
<TD>
<FORM action="index.php" method="GET">
<input type="hidden" name="fmk" value="<?=$obj_FMK->currentZone()?>.<?=$obj_FMK->currentAction()?>">
<span class="heading">Sensor: </span> <?=$temp_sensor_combo?>
</FORM>
</TD>
</TR>
<TR>
<TD align="right">
<table border="0" cellpadding="0" cellspacing="0">
<tr height="20">
<td width="15"><img src="images/tab_left-0.gif" height="20" width="15" border="0"></td>
<td BACKGROUND="images/tab_mid-0.gif" class="tab-off" onclick="window.location.href='index.php?fmk=sensorconf.sensor&FRM_sensorid=<?=$temp_sensorid?>&tab=2'">Snort Config</td>
<td width="15"><img src="images/tab_right-0.gif" height="20" width="15" border="0"></td>
<td width="2"> </td>
<td width="15"><img src="images/tab_left-1.gif" height="20" width="15" border="0"></td>
<td BACKGROUND="images/tab_mid-1.gif" class="tab-on">Variables</td>
<td width="15"><img src="images/tab_right-1.gif" height="20" width="15" border="0"></td>
<td width="2"> </td>
</tr>
</table>
<table border="0" width="100%" class="bg1" cellpadding="0">
<tr>
<td>
<table border="0" width="100%" cellpadding="2" class="bg2">
<tr>
<td> </td>
</tr>
<tr>
<td align="center">
<TABLE class="bg2" border="0" cellspacing="0" cellpadding="2">
<tr class="label">
<td align="center">On/Off</td>
<td>Variable Name</td>
</tr>
<?
/* Draw */
if($rsVaris_total == 0 )
{
?>
<TR><TD align="center" colspan="2"><BR><BR><B>- Library Empty -</B><BR><BR><BR></TD></TR>
<?
}
else
{
$cursor = 0;
foreach ($vari as $item)
{
if ( $item['selected'] == 1 )
{
$temp_LED = "<a href=\"index.php?fmk=variables.deactivate&FRM_varid=".$item['id']."&FRM_sensorid=".$temp_sensorid."\" title=\"Deactivate Variable\"><img src=\"images/check-1.png\" border=\"0\"></a>";
}
else
{
$temp_LED = "<a href=\"index.php?fmk=variables.activate&FRM_varid=".$item['id']."&FRM_sensorid=".$temp_sensorid."\" title=\"Deactivate Variable\"><img src=\"images/check-0.png\" border=\"0\"></a>";
}
?>
<tr>
<td align="center"><?=$temp_LED?></td>
<TD><i>var</i> <?=$item['name']?> <?=$item['value']?></TD>
</tr>
<?
}
}
?>
<tr>
<td colspan="2">
<table width="100%" border="0" cellspacing="0" cellpadding="4">
<tr>
<td>
<FORM action="index.php" method="GET">
<input type="hidden" name="FRM_sensorid" value="<?=$temp_sensorid?>">
<SELECT name="fmk" onchange="this.form.submit();">
<OPTION value="variables.select" selected>- Action -</OPTION>
<OPTION value="variables.activateall">Activate All</OPTION>
<OPTION value="variables.deactivateall">Dectivate All</OPTION>
</SELECT>
<a href="index.php?fmk=variables.main">[Edit/Add Variables]</a>
</FORM>
</td>
</tr>
</table>
</td>
</tr>
</TABLE>
<tr>
<td align="right"><a href="index.php?fmk=sensorconf.sensor&FRM_sensorid=<?=$temp_sensorid?>&tab=2">[ << Back ]</a></td>
</tr>
<tr><td> </td></tr>
</td>
</tr>
</table>
</td>
</tr>
</table>
</TD>
</TR>
</TABLE>
</CENTER>