<?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);
$config_value = "$shortname,$description,$priority";
if (($do == "Duplicate") || ($do == "Save")) {
$result = $db->acidExecute("INSERT INTO config (config_name, config_value) VALUES ('classification:', '$config_value')");
$result = $db->acidExecute("SELECT max(id) FROM config");
$myrow = $result->acidFetchRow();
$result->acidFreeRows();
$id = $myrow[0];
echo '<SCRIPT language=javascript>setTimeout("location.href=\'class.php?sensor_id='.$sensor_id.'\'",0);</SCRIPT>';
}
if ($do == "Update") {
$result = $db->acidExecute("UPDATE config SET config_value='$config_value' where id='$id'");
$result->acidFreeRows();
echo '<SCRIPT language=javascript>setTimeout("location.href=\'class.php?sensor_id='.$sensor_id.'\'",0);</SCRIPT>';
}
if ($class != "new") {
$result = $db->acidExecute("SELECT id, config_value FROM config where id='$id'");
$myrow = $result->acidFetchRow();
$result->acidFreeRows();
list($id, $config_value) = $myrow;
}
include('top.inc.php');
echo "<BR>";
echo "<FORM method=GET>";
list($shortname, $description, $priority) = explode(',', trim($config_value), 3);
$shortname = trim($shortname);
$description = trim($description);
$priority = trim($priority);
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[21]:</B> $lang[168]</TD></TR>";
echo "<TR bgcolor=#DDDDDD><TD align=left>$lang[169]</TD><TD><INPUT NAME=shortname TYPE=TEXT value='$shortname' size='40'></TD></TR>";
echo "<TR bgcolor=#DDDDDD><TD align=left>$lang[170]</TD><TD><INPUT NAME=description TYPE=TEXT value='$description' size='70'></TD></TR>";
echo "<TR bgcolor=#DDDDDD><TD align=left>$lang[103] #</TD><TD><INPUT NAME=priority TYPE=TEXT value='$priority' size='4'></TD></TR>";
echo "</TABLE></TD></TR></TABLE></TD></TR></TABLE><BR>";
if ($class != "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');
?>