Location: PHPKode > projects > SnortCenter 2.x > snortcenter-release/edit_ruletype.php
<?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);
     
    if (($do == "Duplicate") || ($do == "Save")) {
        $result = $db->acidExecute("INSERT INTO ruletype (ruletype_name, ruletype_value) VALUES ('$ruletype_name', '$ruletype_value')");
        $result = $db->acidExecute("SELECT max(id) FROM ruletype");
        $myrow = $result->acidFetchRow();
        $result->acidFreeRows();
        $id = $myrow[0];
	echo '<SCRIPT language=javascript>setTimeout("location.href=\'ruletype.php?sensor_id='.$sensor_id.'\'",0);</SCRIPT>';
    }
     
    if ($do == "Update") {
        $result = $db->acidExecute("UPDATE ruletype SET ruletype_name='$ruletype_name', ruletype_value='$ruletype_value' where id='$id'");
        $result->acidFreeRows();
	echo '<SCRIPT language=javascript>setTimeout("location.href=\'ruletype.php?sensor_id='.$sensor_id.'\'",0);</SCRIPT>';
    }
     
    if ($rule  != "new") {
        $result = $db->acidExecute("SELECT id, ruletype_name, ruletype_value FROM ruletype where id='$id'");
        $myrow = $result->acidFetchRow();
        $result->acidFreeRows();
        list($id, $ruletype_name, $ruletype_value) = $myrow;
    }
     
    include('top.inc.php');
    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[18]:</B> $lang[166]</TD></TR>";
    echo "<TR bgcolor=#DDDDDD><TD align=right valign=top>$lang[167]&nbsp;<INPUT type=text name=ruletype_name value='$ruletype_name'></TD><TD>&nbsp;</TD><TD><TEXTAREA name=ruletype_value cols=50 rows=4>$ruletype_value</TEXTAREA></TD></TR>";
    echo "</TABLE></TD></TR></TABLE></TD></TR></TABLE><BR>";
     
    if ($rule  != "new") {
        echo "<CENTER><INPUT NAME='do' VALUE='Update' TYPE=SUBMIT>&nbsp;<INPUT NAME='do' VALUE='Duplicate' TYPE=SUBMIT>&nbsp;<INPUT VALUE='Reset' TYPE=RESET></CENTER>";
    } else {
        echo "<CENTER><INPUT NAME='do' VALUE='Save' TYPE=SUBMIT>&nbsp;<INPUT VALUE='Reset' TYPE=RESET></CENTER>";
    }
    echo "</FORM><BR>";
    require('bottom.inc.php');
?>
Return current item: SnortCenter 2.x