Location: PHPKode > projects > SnortSMS > snortsms/variables/act_Save-Update.php
<?
/***************************************************************************
 *   Copyright (C) 2009 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_id = $_REQUEST['FRM_id'];
$temp_action = $_REQUEST['BTN_submit'];
$temp_varname = mysql_escape_string($_REQUEST['FRM_varname']);
$temp_varvalue = mysql_escape_string($_REQUEST['FRM_varvalue']);
$temp_vartype = $_REQUEST['FRM_vartype'];



if ($temp_action == "Save")
	{
	/*** Insert ***/
	$sql = 	"INSERT INTO TBL_VARIABLES ".
			"(varname, varvalue, vartype) ".
			"VALUES('$temp_varname', '$temp_varvalue', '$temp_vartype')";
	$result = $db->query($sql); if (DB::isError($result)) { Stop ( "[".__FILE__."][".__LINE__."] " . $result->getdebugInfo());}
	
	}
else
	{
	/*** Update ***/
	$sql =	"UPDATE	TBL_VARIABLES ".
			"SET ".
			"varname = '".$temp_varname."', ".
			"varvalue = '".$temp_varvalue."', ".
			"vartype = '".$temp_vartype."' ".
			"WHERE id = ".$temp_id;
	$result = $db->query($sql); if (DB::isError($result)) { Stop ( "[".__FILE__."][".__LINE__."] " . $result->getdebugInfo());}
	
	}

header("location:index.php?fmk=variables.main");

?>
Return current item: SnortSMS