Location: PHPKode > projects > SnortSMS > snortsms/configs/dsp_selected.php
<?
/***************************************************************************
 *   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			= $_REQUEST['tab'];


/*** Create an array of all available variables ***/
$vari = array();
while ($row = $rsConfigs->fetchRow(DB_FETCHMODE_ASSOC))
	{	
	$var = $row['directive'];
	$vari[$var]['directive'] = $row['directive'];
	$vari[$var]['value'] = $row['value'];
	$vari[$var]['id'] = $row['id'];
	$vari[$var]['selected'] = 0;
	}
/* Go back and update which are currently selected. */
while ($row = $rsConfigSel->fetchRow(DB_FETCHMODE_ASSOC))
	{
	$var = $row['directive'];		
	$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">&nbsp;</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">Config Directives</td>
<td width="15"><img src="images/tab_right-1.gif" height="20" width="15" border="0"></td>
<td width="2">&nbsp;</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> &nbsp;</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>Config Name</td>



</tr>


<?
/* Draw  */
if($rsConfigs_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)
		{
		$temp_back = ( $temp_back == "bg2" ? "bg2" : "bg2");
		
		if ( $item['selected'] == 1 )
			{
			$temp_LED = "<a href=\"index.php?fmk=configs.deactivate&FRM_id=".$item['id']."&FRM_sensorid=".$temp_sensorid."\" title=\"Deactivate Plugin\"><img src=\"images/check-1.png\" border=\"0\"></a>";
			}
		else
			{
			$temp_LED = "<a href=\"index.php?fmk=configs.activate&FRM_id=".$item['id']."&FRM_sensorid=".$temp_sensorid."\" title=\"Deactivate Plugin\"><img src=\"images/check-0.png\" border=\"0\"></a>";
			}
		?>
		<tr class="<?=$temp_back?>">
		<td align="center"><?=$temp_LED?></td>
		<TD>config <?=$item['directive']?> <?=$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="configs.select" selected>- Action -</OPTION>
	<OPTION value="configs.activateall">Activate All</OPTION>
	<OPTION value="configs.deactivateall">Dectivate All</OPTION>
</SELECT>
&nbsp;
<a href="index.php?fmk=configs.main">[Edit/Add Config Directive]</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">[ &lt;&lt; Back ]</a></td>
</tr>
<tr><td> &nbsp;</td></tr>


</td>
</tr>
</table>

</td>
</tr>
</table>


</TD>
</TR>


</TABLE>
</CENTER>






Return current item: SnortSMS