Location: PHPKode > projects > SnortSMS > snortsms/variables/act_action.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.             *
 ***************************************************************************/

$todaydate = date("F d, Y H:i:s");
$action = $_REQUEST['FRM_action'];
$rows = $_REQUEST['FRM_row'];
$out = "";

// DEBUG
//print "<pre>";
//print_r($_REQUEST);
//print "</pre>\n";





if($action == "Delete")
	{
	if (is_array($rows))
		{
		foreach ( $rows as $id )
			{
			/*** Get the varaible ***/
			$sql = "select * FROM TBL_VARIABLES WHERE id =" . $id;
			$rsRule = $db->query($sql); if (DB::isError($rsRule)) { Stop ( "[".__FILE__."][".__LINE__."] " . $rsRule->getdebugInfo());}
			$row = $rsRule->fetchRow(DB_FETCHMODE_ASSOC);
			$rsRule->free();
		
			/*** Save a copy to the trash file ***/
			$out .= "var " . $row['varname'] . " ". $row['varvalue'] . "\n";
		
			/*** Remove the varaiable from the assignments table (if assigned to anything) ***/
			$sql = "DELETE FROM TBL_ASSIGNMENTS WHERE type = 'V' AND itemid = " . $id;
			$rsDel = $db->query($sql); if (DB::isError($rsDel)) { Stop ( "[".__FILE__."][".__LINE__."] " . $rsDel->getdebugInfo());}
		
			/*** Delete the varaible ***/
			$sql = "DELETE FROM TBL_VARIABLES WHERE id =" . $id;
			$rsDel = $db->query($sql); if (DB::isError($rsDel)) { Stop ( "[".__FILE__."][".__LINE__."] " . $rsDel->getdebugInfo());}
	

			}
		}
	else
		{
		//print "<BR>Nothing to delete.<BR>";
		}
	}

	
	
	
	
	
	
	
	

	
if ($out != "")
	{
	$handle = fopen($GBL['trashcan'], "a");
	fwrite($handle,"###################### Deletion: $todaydate ######################\n");
	fwrite( $handle, $out );			
	fclose($handle);
	}

	
	
	
// DEBUG
//print "<pre>";
//print_r($_SERVER);
//print "</pre>\n";


header("location:".$_SERVER['HTTP_REFERER']);

?>



Return current item: SnortSMS