Location: PHPKode > projects > SnortCenter 2.x > snortcenter-release/sensor_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");
    include_once("list.inc.php");
     
    $db = NewACIDDBConnection($DBlib_path, $DBtype);
    $db->acidConnect($DB_dbname, $DB_host, $DB_port, $DB_user, $DB_password);
     
    if ($do == 'Deactivate') {
        deactivate($rule, 'ruletype', $sensor_id, $db);
    }
    if ($do == 'Activate') {
        activate($rule, 'ruletype', $sensor_id, $db);
    }
    $rule_act = get_active('ruletype', $sensor_id, $db);
    include('top.inc.php');
    echo "<TABLE align=center><TR valign=top><TD width=33%>";
    echo "&nbsp;";
    echo "</TD><TD width=33%>";
    display_scope($sensor_id, $category, $s_pos, 0, $db);
    echo "</TD><TD width=33%>";
    echo "&nbsp;";
    echo "</TD></TR></TABLE>";
    display_list_start($sensor_id, 0);
     
    $result = $db->acidExecute("SELECT id,ruletype_name,ruletype_value, snort_default from ruletype ORDER BY snort_default, ruletype_name");
    $count = 0;
    while ($myrow = $result->acidFetchRow()) {
        list($id, $ruletype_name, $ruletype_value, $snort_default) = $myrow;
        if ($color  != "white") {
            $color = "white";
        } else {
            $color = "#DDDDDD";
        }
	
	if ($snort_default == 'yes') $color = '#fffaa8';
        echo "<TR border=1 style='border : $color;' bgcolor=$color><TD width=50><INPUT style=\"background-color: $color;\" TYPE=checkbox name=rule[$count] value=\"$id\" id=\"$id\">";
        if (in_array ("|$id|", $rule_act)) {
            echo"<A href=\"sensor_ruletype.php?rule[$count]=$id&do=Deactivate&sensor_id=$sensor_id\"><img border=0 alt=\"Deactivate\" height=20 src='./images/green.png'></A>";
        } else {
            echo"<A href=\"sensor_ruletype.php?rule[$count]=$id&do=Activate&sensor_id=$sensor_id\"><img border=0 alt=\"Activate\" height=20 src='./images/red.png'></A>";
        }
        $ruletype_value = nl2br($ruletype_value);
        echo "</TD><TD><label for='$id'>ruletype $ruletype_name&nbsp;$ruletype_value</label></TD></TR>";
        $count++;
    }
     
    display_list_end(1);
    include('bottom.inc.php');
     
    $result->acidFreeRows();
    $db->acidClose();
?>


Return current item: SnortCenter 2.x