<?php
/*
** SnortCenter Copyright (C) 2001,2002,2003 Stefan Dens
**
** Author: Stefan Dens <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.
*/
?>
<?php
include("config.php");
$db = NewACIDDBConnection($DBlib_path, $DBtype);
$db->acidConnect($DB_dbname, $DB_host, $DB_port, $DB_user, $DB_password);
include('top.inc.php');
if (($do == "Duplicate") || ($do == "Save")) {
$result = $db->acidExecute("INSERT INTO vars (var_name, var_value) VALUES ('$var_name', '$var_value')");
$result = $db->acidExecute("SELECT max(id) FROM vars");
$myrow = $result->acidFetchRow();
$result->acidFreeRows();
$id = $myrow[0];
echo '<SCRIPT language=javascript>setTimeout("location.href=\'vars.php?sensor_id='.$sensor_id.'\'",0);</SCRIPT>';
}
if ($do == "Update") {
$result = $db->acidExecute("UPDATE vars SET var_name='$var_name', var_value='$var_value' where id='$id'");
$result->acidFreeRows();
echo '<SCRIPT language=javascript>setTimeout("location.href=\'vars.php?sensor_id='.$sensor_id.'\'",0);</SCRIPT>';
}
if ($var != "new") {
$result = $db->acidExecute("SELECT id, var_name, var_value FROM vars where id='$id'");
$myrow = $result->acidFetchRow();
$result->acidFreeRows();
list($id, $var_name, $var_value) = $myrow;
}
echo "<BR>";
echo "<FORM method=GET>";
echo "<INPUT TYPE=HIDDEN NAME='sensor_id' VALUE='$sensor_id'>";
echo "<INPUT TYPE=HIDDEN name=id value=$id>";
echo "<table align=center border=2 cellspacing=0 cellpadding=0 width=60%><tr>";
# -------- Begin left table --------------
echo "<TD width=48% valign=top>";
echo "<table align=center border=0 cellpadding=1 cellspacing=0 width=100%><tr bgcolor=#f9f890><td>";
echo "<table style=\"font-size:12px; font-family: Verdana;\" align=center border=0 cellspacing=0 cellpadding=0 width=100%>";
echo "<TR><TD align=left colspan=2><B>$lang[9]:</B> $lang[125]</TD></TR>";
echo "<TR bgcolor=#DDDDDD><TD align=left>$lang[126]</TD><TD><INPUT NAME=var_name TYPE=TEXT value='$var_name' size='40'></TD></TR>";
echo "<TR bgcolor=#DDDDDD><TD align=left>$lang[127]</TD><TD><INPUT NAME=var_value TYPE=TEXT value='$var_value' size='70'></TD></TR>";
echo "</TABLE></TD></TR></TABLE></TD></TR></TABLE><BR>";
if ($var != "new") {
echo "<CENTER><INPUT NAME='do' VALUE='Update' TYPE=SUBMIT> <INPUT NAME='do' VALUE='Duplicate' TYPE=SUBMIT> <INPUT VALUE='Reset' TYPE=RESET></CENTER>";
} else {
echo "<CENTER><INPUT NAME='do' VALUE='Save' TYPE=SUBMIT> <INPUT VALUE='Reset' TYPE=RESET></CENTER>";
}
echo "</FORM><BR>";
require('bottom.inc.php');
?>