Location: PHPKode > projects > SnortCenter 2.x > snortcenter-release/edit_spo.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 ($spo_name == "database:") {
        if ($do  != 'Select') {
            if (!$db_sc_action) {
                $db_sc_action = 'log';
            }
        }
        $spo_value = trim($db_sc_action) .', '. trim($db_sc_type) .',';
         
        if ($db_sc_user) {
            $spo_value  .= ' user=' . $db_sc_user;
        }
        if ($db_sc_password) {
            $spo_value  .= ' password=' . $db_sc_password;
        }
        if ($db_sc_name) {
            $spo_value  .= ' dbname=' . $db_sc_name;
        }
        if ($db_sc_host) {
            $spo_value  .= ' host=' . $db_sc_host;
        }
        if ($db_sc_port) {
            $spo_value  .= ' port=' . $db_sc_port;
        }
        if ($db_sc_sensor_name) {
             $spo_value  .= ' sensor_name=' . $db_sc_sensor_name;
        }
        if ($db_sc_encoding) {
            $spo_value  .= ' encoding=' . $db_sc_encoding;
        }
        if ($db_sc_detail) {
            $spo_value  .= ' detail=' . $db_sc_detail;
        }
        if ($db_sc_ignore_bpf) {
            $spo_value  .= ' ignore_bpf=' . $db_sc_ignore_bpf;
        }
    }
    elseif ($spo_name == "alert_unified:") {
        if ($do  != 'Select') {
            if (!$filename) {
                $filename = 'snort.alert';
            }
            if (!$limit) {
                $limit = '128';
            }
            $spo_value = 'filename ' . trim($filename) .', limit '. trim($limit);
        }
    }
    elseif ($spo_name == "log_unified:") {
        if ($do  != 'Select') {
            if (!$filename) {
                $filename = 'snort.log';
            }
            if (!$limit) {
                $limit = '128';
            }
            $spo_value = 'filename ' . trim($filename) .', limit '. trim($limit);
        }
    }
    elseif ($spo_name == "log_tcpdump:") {
        $spo_value = $file;
    }
    elseif ($spo_name == "alert_fast:") {
        $spo_value = $file;
    }
    elseif ($spo_name == "alert_full:") {
        $spo_value = $file;
    }
    elseif ($spo_name == "log_null") {
        $spo_value = $file;
    }
    elseif ($spo_name == "alert_smb:") {
        $spo_value = $file;
    }
    elseif ($spo_name == "alert_syslog:") {
        $spo_value = trim($facility) .' '. trim($priority) .' ';
        if ($log_cons) {
            $spo_value  .= 'LOG_CONS ';
        }
        if ($log_ndelay) {
            $spo_value  .= 'LOG_NDELAY ';
        }
        if ($log_perror) {
            $spo_value  .= 'LOG_PERROR ';
        }
        if ($log_pid) {
            $spo_value  .= 'LOG_PID ';
        }
    }
    elseif ($spo_name == 'CSV:') {
        if (!$file) {
            $file = "alert.csv";
        }
        $spo_value = trim($file);
        if ($default) {
            $spo_value  .= ' default';
        } else {
            if ($timestamp) {
                $spo_value  .= ' timestamp,';
            }
            if ($msg) {
                $spo_value  .= ' msg,';
            }
            if ($proto) {
                $spo_value  .= ' proto,';
            }
            if ($src) {
                $spo_value  .= ' src,';
            }
            if ($srcport) {
                $spo_value  .= ' srcport,';
            }
            if ($dst) {
                $spo_value  .= ' dst,';
            }
            if ($dsport) {
                $spo_value  .= ' dsport,';
            }
            if ($ethsrc) {
                $spo_value  .= ' ethsrc,';
            }
            if ($ethdst) {
                $spo_value  .= ' ethdst,';
            }
            if ($ethlen) {
                $spo_value  .= ' ethlen,';
            }
            if ($tcpflags) {
                $spo_value  .= ' tcpflags,';
            }
            if ($tcpwindow) {
                $spo_value  .= ' tcpwindow,';
            }
            if ($tcpseq) {
                $spo_value  .= ' tcpseq,';
            }
            if ($tcpack) {
                $spo_value  .= ' tcpack,';
            }
            if ($tcplen) {
                $spo_value  .= ' tcplen,';
            }
            if ($tcpwindow) {
                $spo_value  .= ' tcpwindow,';
            }
            if ($ttl) {
                $spo_value  .= ' ttl,';
            }
            if ($tos) {
                $spo_value  .= ' tos,';
            }
            if ($csv_id) {
                $spo_value  .= ' id,';
            }
            if ($dgmlen) {
                $spo_value  .= ' dgmlen,';
            }
            if ($iplen) {
                $spo_value  .= ' iplen,';
            }
            if ($icmptype) {
                $spo_value  .= ' icmptype,';
            }
            if ($icmpcode) {
                $spo_value  .= ' icmpcode,';
            }
            if ($icmpid) {
                $spo_value  .= ' icmpid,';
            }
            if ($icmpseq) {
                $spo_value  .= ' icmpseq,';
            }
             
            if (strpos($spo_value, ',')  !== false) {
                $spo_value = substr(rtrim($spo_value), 0, -1); //strip last ","
            }
        }
    }
     
     
    if (($do == "Duplicate") || ($do == "Save")) {
        $result = $db->acidExecute("INSERT INTO output (spo_name, spo_value) VALUES ('$spo_name', '$spo_value')");
        $result = $db->acidExecute("SELECT max(id) FROM output");
        $myrow = $result->acidFetchRow();
        $result->acidFreeRows();
        $id = $myrow[0];
	echo '<SCRIPT language=javascript>setTimeout("location.href=\'spo.php?sensor_id='.$sensor_id.'\'",0);</SCRIPT>';
    }
    if ($do == "Update") {
        $result = $db->acidExecute("UPDATE output SET spo_name='$spo_name', spo_value='$spo_value' where id='$id'");
        $result->acidFreeRows();
	echo '<SCRIPT language=javascript>setTimeout("location.href=\'spo.php?sensor_id='.$sensor_id.'\'",0);</SCRIPT>';
    }
    if (($spo  != "new") && ($do  != 'Select')) {
        $result = $db->acidExecute("SELECT id, spo_name, spo_value  FROM output where id='$id'");
        $myrow = $result->acidFetchRow();
        $result->acidFreeRows();
        list($id, $spo_name, $spo_value) = $myrow;
    }

    include('top.inc.php');     
    echo "<BR>";
    echo "<FORM method=GET>";
     
    if ($spo_name == "database:") {
        list($db_sc_action, $db_sc_type, $parameter) = explode(',', trim($spo_value), 3);
        $db_sc_action = trim($db_sc_action);
        $db_sc_type = trim($db_sc_type);
        $foo = explode(' ', trim($parameter));
        foreach($foo as $i) {
            if (strpos($i, "user=")  !== false) {
                $foo1 = explode('=', trim($i), 2);
                $db_sc_user = trim($foo1[1]);
            }
            if (strpos($i, "password=")  !== false) {
                $foo1 = explode('=', trim($i), 2);
                $db_sc_password = trim($foo1[1]);
            }
            if (strpos($i, "dbname=")  !== false) {
                $foo1 = explode('=', trim($i), 2);
                $db_sc_name = trim($foo1[1]);
            }
            if (strpos($i, "host=")  !== false) {
                $foo1 = explode('=', trim($i), 2);
                $db_sc_host = trim($foo1[1]);
            }
            if (strpos($i, "port=")  !== false) {
                $foo1 = explode('=', trim($i), 2);
                $db_sc_port = trim($foo1[1]);
            }
            if (strpos($i, "sensor_name=")  !== false) {
                $foo1 = explode('=', trim($i), 2);
                $db_sc_sensor_name = trim($foo1[1]);
            }
            if (strpos($i, "encoding=")  !== false) {
                $foo1 = explode('=', trim($i), 2);
                $db_sc_encoding = trim($foo1[1]);
            }
            if (strpos($i, "detail=")  !== false) {
                $foo1 = explode('=', trim($i), 2);
                $db_sc_detail = trim($foo1[1]);
            }
            if (strpos($i, "ignore_bpf=")  !== false) {
                $foo1 = explode('=', trim($i), 2);
                $ignore_bpf = trim($foo1[1]);
                if (($ignore_bpf == 'yes') || ($ignore_bpf == '1')) {
                    $ignore_bpf_select = 'CHECKED';
                }
            }
        }
        echo "<INPUT TYPE=HIDDEN NAME='sensor_id' VALUE='$sensor_id'>";
        echo "<INPUT TYPE=HIDDEN NAME='spo_name' VALUE='$spo_name'>";
        echo "<INPUT TYPE=HIDDEN name=id value=$id>";
        echo "<table align=center border=0 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>Database:</B> $lang[207]</TD></TR>";
        echo "<TR bgcolor=#DDDDDD><TD align=left>$lang[208]</TD><TD><INPUT NAME=db_sc_sensor_name TYPE=TEXT value='$db_sc_sensor_name' size='15'> use keyword [AUTO] for automatic sensor_name</TD></TR>";
        echo "<TR bgcolor=#DDDDDD><TD align=left>$lang[209]</TD><TD><INPUT NAME=db_sc_name TYPE=TEXT value='$db_sc_name' size='15'></TD></TR>";
        echo "<TR bgcolor=#DDDDDD><TD align=left>$lang[210]</TD><TD><INPUT NAME=db_sc_type TYPE=TEXT value='$db_sc_type' size='15'> [mysql | postgresql | odbc | mssql | oracle]</TD></TR>";
        echo "<TR bgcolor=#DDDDDD><TD align=left>$lang[211]</TD><TD><INPUT NAME=db_sc_host TYPE=TEXT value='$db_sc_host' size='15'> ($lang[216])</TD></TR>";
        echo "<TR bgcolor=#DDDDDD><TD align=left>$lang[212]</TD><TD><INPUT NAME=db_sc_port TYPE=TEXT value='$db_sc_port' size='15'> ($lang[217]: 3306)</TD></TR>";
        echo "<TR bgcolor=#DDDDDD><TD align=left>$lang[213]</TD><TD><INPUT NAME=db_sc_user TYPE=TEXT value='$db_sc_user' size='15'></TD></TR>";
        echo "<TR bgcolor=#DDDDDD><TD align=left>$lang[178]</TD><TD><INPUT NAME=db_sc_password TYPE=PASSWORD value='$db_sc_password' size='15'></TD></TR>";
        echo "<TR bgcolor=#DDDDDD><TD align=left>$lang[167]</TD><TD><INPUT NAME=db_sc_action TYPE=TEXT value='$db_sc_action' size='15'> [log | alert]</TD></TR>";
        echo "<TR bgcolor=#DDDDDD><TD align=left>$lang[214]</TD><TD><INPUT NAME=db_sc_encoding TYPE=TEXT value='$db_sc_encoding' size='15'> [hex | base64 | ascii]</TD></TR>";
        echo "<TR bgcolor=#DDDDDD><TD align=left>$lang[215]</TD><TD><INPUT NAME=db_sc_detail TYPE=TEXT value='$db_sc_detail' size='15'> [full | fast]</TD></TR>";
        echo "<TR bgcolor=#DDDDDD><TD align=left>$lang[264]</TD><TD><INPUT NAME=db_sc_ignore_bpf TYPE=CHECKBOX value='yes' $ignore_bpf_select></TD></TR>";
        echo "</TABLE></TD></TR></TABLE></TD></TR></TABLE><BR>";
    }
    elseif ($spo_name == "alert_unified:") {
        list($filename, $limit) = explode(',', trim($spo_value), 2);
        $filename = trim(str_replace("filename", '', $filename));
        $limit = trim(str_replace("limit", '', $limit));
         
        echo "<INPUT TYPE=HIDDEN NAME='sensor_id' VALUE='$sensor_id'>";
        echo "<INPUT TYPE=HIDDEN NAME='spo_name' VALUE='$spo_name'>";
        echo "<INPUT TYPE=HIDDEN name=id value=$id>";
        echo "<table align=center border=0 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>Alert_Unified:</B> $lang[202]</TD></TR>";
        echo "<TR bgcolor=#DDDDDD><TD align=left>$lang[197]</TD><TD><INPUT NAME=filename TYPE=TEXT value='$filename' size='40'> ($lang[203])</TD></TR>";
        echo "<TR bgcolor=#DDDDDD><TD align=left>$lang[204]</TD><TD><INPUT NAME=limit TYPE=TEXT value='$limit' size='15'> (MByte)</TD></TR>";
        echo "</TABLE></TD></TR></TABLE></TD></TR></TABLE><BR>";
    }
    elseif ($spo_name == "log_unified:") {
        list($filename, $limit) = explode(',', trim($spo_value), 2);
        $filename = trim(str_replace("filename", '', $filename));
        $limit = trim(str_replace("limit", '', $limit));
         
        echo "<INPUT TYPE=HIDDEN NAME='sensor_id' VALUE='$sensor_id'>";
        echo "<INPUT TYPE=HIDDEN NAME='spo_name' VALUE='$spo_name'>";
        echo "<INPUT TYPE=HIDDEN name=id value=$id>";
        echo "<table align=center border=0 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>Log_Unified:</B> $lang[220]</TD></TR>";
        echo "<TR bgcolor=#DDDDDD><TD align=left>$lang[197]</TD><TD><INPUT NAME=filename TYPE=TEXT value='$filename' size='40'> ($lang[203])</TD></TR>";
        echo "<TR bgcolor=#DDDDDD><TD align=left>$lang[204]</TD><TD><INPUT NAME=limit TYPE=TEXT value='$limit' size='15'> (MByte)</TD></TR>";
        echo "</TABLE></TD></TR></TABLE></TD></TR></TABLE><BR>";
    }
    elseif ($spo_name == "log_tcpdump:") {
        $file = trim($spo_value);
         
        echo "<INPUT TYPE=HIDDEN NAME='sensor_id' VALUE='$sensor_id'>";
        echo "<INPUT TYPE=HIDDEN NAME='spo_name' VALUE='$spo_name'>";
        echo "<INPUT TYPE=HIDDEN name=id value=$id>";
        echo "<table align=center border=0 cellspacing=0 cellpadding=0 width=40%><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>Log_Tcpdump:</B> $lang[219]</TD></TR>";
        echo "<TR bgcolor=#DDDDDD><TD align=left>$lang[197]</TD><TD><INPUT NAME=file TYPE=TEXT value='$file' size='45'></TD></TR>";
        echo "</TABLE></TD></TR></TABLE></TD></TR></TABLE><BR>";
    }
    elseif ($spo_name == "alert_fast:") {
        $file = trim($spo_value);
         
        echo "<INPUT TYPE=HIDDEN NAME='sensor_id' VALUE='$sensor_id'>";
        echo "<INPUT TYPE=HIDDEN NAME='spo_name' VALUE='$spo_name'>";
        echo "<INPUT TYPE=HIDDEN name=id value=$id>";
        echo "<table align=center border=0 cellspacing=0 cellpadding=0 width=40%><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>Alert_fast:</B> $lang[196]</TD></TR>";
        echo "<TR bgcolor=#DDDDDD><TD align=left>$lang[197]</TD><TD><INPUT NAME=file TYPE=TEXT value='$file' size='45'></TD></TR>";
        echo "</TABLE></TD></TR></TABLE></TD></TR></TABLE><BR>";
    }
    elseif ($spo_name == "alert_full:") {
        $file = trim($spo_value);
         
        echo "<INPUT TYPE=HIDDEN NAME='sensor_id' VALUE='$sensor_id'>";
        echo "<INPUT TYPE=HIDDEN NAME='spo_name' VALUE='$spo_name'>";
        echo "<INPUT TYPE=HIDDEN name=id value=$id>";
        echo "<table align=center border=0 cellspacing=0 cellpadding=0 width=40%><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>Alert_full:</B> $lang[198]</TD></TR>";
        echo "<TR bgcolor=#DDDDDD><TD align=left>$lang[197]</TD><TD><INPUT NAME=file TYPE=TEXT value='$file' size='45'></TD></TR>";
        echo "</TABLE></TD></TR></TABLE></TD></TR></TABLE><BR>";
    }
    elseif ($spo_name == "alert_smb:") {
        $file = trim($spo_value);
         
        echo "<INPUT TYPE=HIDDEN NAME='sensor_id' VALUE='$sensor_id'>";
        echo "<INPUT TYPE=HIDDEN NAME='spo_name' VALUE='$spo_name'>";
        echo "<INPUT TYPE=HIDDEN name=id value=$id>";
        echo "<table align=center border=0 cellspacing=0 cellpadding=0 width=50%><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>Alert_smb:</B> $lang[194]</TD></TR>";
        echo "<TR bgcolor=#DDDDDD><TD align=left>$lang[195]</TD><TD><INPUT NAME=file TYPE=TEXT value='$file' size='45'></TD></TR>";
        echo "</TABLE></TD></TR></TABLE></TD></TR></TABLE><BR>";
    }
    elseif ($spo_name == "log_null") {
        echo "<INPUT TYPE=HIDDEN NAME='sensor_id' VALUE='$sensor_id'>";
        echo "<table align=center border=0 cellspacing=0 cellpadding=0 width=40%><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>$spo_name</B> $lang[221]</TD></TR>";
        echo "<INPUT TYPE=HIDDEN NAME='spo_name' VALUE='$spo_name'>";
        echo "<TR bgcolor=#DDDDDD><TD>&nbsp;</TD></TR><TR bgcolor=#DDDDDD><TD align=center>$lang[218]</TD></TR><TR bgcolor=#DDDDDD><TD>&nbsp;</TD></TR>";
        echo "</TABLE></TD></TR></TABLE></TD></TR></TABLE><BR>";
    }
    elseif ($spo_name == "alert_syslog:") {
        list($facility, $priority, $options) = explode(' ', trim($spo_value), 3);
        $facility = trim($facility);
        $priority = trim($priority);
        if ($facility == "LOG_AUTH") {
            $log_auth_select = 'selected';
        }
        if ($facility == "LOG_AUTHPRIV") {
            $log_authpriv_select = 'selected';
        }
        if ($facility == "LOG_DAEMON") {
            $log_daemon_select = 'selected';
        }
        if ($facility == "LOG_LOCAL0") {
            $log_local0_select = 'selected';
        }
        if ($facility == "LOG_LOCAL1") {
            $log_local1_select = 'selected';
        }
        if ($facility == "LOG_LOCAL2") {
            $log_local2_select = 'selected';
        }
        if ($facility == "LOG_LOCAL3") {
            $log_local3_select = 'selected';
        }
        if ($facility == "LOG_LOCAL4") {
            $log_local4_select = 'selected';
        }
        if ($facility == "LOG_LOCAL5") {
            $log_local5_select = 'selected';
        }
        if ($facility == "LOG_LOCAL6") {
            $log_local6_select = 'selected';
        }
        if ($facility == "LOG_LOCAL7") {
            $log_local7_select = 'selected';
        }
        if ($facility == "LOG_USER") {
            $log_user_select = 'selected';
        }
         
        if ($priority == "LOG_EMERG") {
            $log_emerge_select = 'selected';
        }
        if ($priority == "LOG_ALERT") {
            $log_alert_select = 'selected';
        }
        if ($priority == "LOG_CRIT") {
            $log_crit_select = 'selected';
        }
        if ($priority == "LOG_ERR") {
            $log_err_select = 'selected';
        }
        if ($priority == "LOG_WARNING") {
            $log_warning_select = 'selected';
        }
        if ($priority == "LOG_NOTICE") {
            $log_notice_select = 'selected';
        }
        if ($priority == "LOG_INFO") {
            $log_info_select = 'selected';
        }
        if ($priority == "LOG_DEBUG") {
            $log_debug_select = 'selected';
        }
         
        if (strpos($options, "LOG_CONS")  !== false) {
            $log_cons_select = 'CHECKED';
        }
        if (strpos($options, "LOG_NDELAY")  !== false) {
            $log_ndelay_select = 'CHECKED';
        }
        if (strpos($options, "LOG_PERROR")  !== false) {
            $log_perror_select = 'CHECKED';
        }
        if (strpos($options, "LOG_PID")  !== false) {
            $log_pid_select = 'CHECKED';
        }
         
        echo "<INPUT TYPE=HIDDEN NAME='sensor_id' VALUE='$sensor_id'>";
        echo "<INPUT TYPE=HIDDEN NAME='spo_name' VALUE='$spo_name'>";
        echo "<INPUT TYPE=HIDDEN name=id value=$id>";
        echo "<table align=center border=0 cellspacing=0 cellpadding=0 width=40%><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>Alert_syslog:</B> $lang[199]</TD></TR>";
        echo "<TR bgcolor=#DDDDDD><TD align=left>$lang[201]</TD><TD><SELECT NAME=facility>
            <OPTION $log_auth_select>LOG_AUTH</OPTION>
            <OPTION $log_authpriv_select>LOG_AUTHPRIV</OPTION>
            <OPTION $log_daemon_select>LOG_DAEMON</OPTION>
            <OPTION $log_local0_select>LOG_LOCAL0</OPTION>
            <OPTION $log_local1_select>LOG_LOCAL1</OPTION>
            <OPTION $log_local2_select>LOG_LOCAL2</OPTION>
            <OPTION $log_local3_select>LOG_LOCAL3</OPTION>
            <OPTION $log_local4_select>LOG_LOCAL4</OPTION>
            <OPTION $log_local5_select>LOG_LOCAL5</OPTION>
            <OPTION $log_local6_select>LOG_LOCAL6</OPTION>
            <OPTION $log_local7_select>LOG_LOCAL7</OPTION>
            <OPTION $log_user_select>LOG_USER</OPTION>
            </SELECT></TD></TR>";
        echo "<TR bgcolor=#DDDDDD><TD align=left>$lang[103]</TD><TD><SELECT NAME=priority
            <OPTION $log_emerg_select>LOG_EMERG</OPTION>
            <OPTION $log_alert_select>LOG_ALERT</OPTION>
            <OPTION $log_crit_select>LOG_CRIT</OPTION>
            <OPTION $log_err_select>LOG_ERR</OPTION>
            <OPTION $log_warning_select>LOG_WARNING</OPTION>
            <OPTION $log_notice_select>LOG_NOTICE</OPTION>
            <OPTION $log_info_select>LOG_INFO</OPTION>
            <OPTION $log_debug_select>LOG_DEBUG</OPTION>
            </SELECT></TD></TR>";
        echo "<TR bgcolor=#DDDDDD><TD align=left>LOG_CONS</TD><TD><INPUT NAME=log_cons TYPE=checkbox value='LOG_CONS' $log_cons_select></TD></TR>";
        echo "<TR bgcolor=#DDDDDD><TD align=left>LOG_NDELAY</TD><TD><INPUT NAME=log_ndelay TYPE=checkbox value='LOG_NDELAY' $log_ndelay_select></TD></TR>";
        echo "<TR bgcolor=#DDDDDD><TD align=left>LOG_PERROR</TD><TD><INPUT NAME=log_perror TYPE=checkbox value='LOG_PERROR' $log_perror_select></TD></TR>";
        echo "<TR bgcolor=#DDDDDD><TD align=left>LOG_PID</TD><TD><INPUT NAME=log_pid TYPE=checkbox value='LOG_PID' $log_pid_select></TD></TR>";
        echo "</TABLE></TD></TR></TABLE></TD></TR></TABLE><BR>";
    }
    elseif ($spo_name == "CSV:") {
        list($file, $format) = explode(' ', trim($spo_value), 2);
        $file = trim($file);
        $format = trim($format);
        if ($format == "default") {
            $default = 'CHECKED';
        } else {
            $foo = explode(',', trim($format));
            foreach($foo as $i) {
                $i = trim($i);
                if ($i == "timestamp") {
                    $timestamp = 'CHECKED';
                }
                if ($i == "msg") {
                    $msg = 'CHECKED';
                }
                if ($i == "proto") {
                    $proto = 'CHECKED';
                }
                if ($i == "src") {
                    $src = 'CHECKED';
                }
                if ($i == "srcport") {
                    $srcport = 'CHECKED';
                }
                if ($i == "dst") {
                    $dst = 'CHECKED';
                }
                if ($i == "dsport") {
                    $dsport = 'CHECKED';
                }
                if ($i == "ethsrc") {
                    $ethsrc = 'CHECKED';
                }
                if ($i == "ethdst") {
                    $ethdst = 'CHECKED';
                }
                if ($i == "ethlen") {
                    $ethlen = 'CHECKED';
                }
                if ($i == "tcpflags") {
                    $tcpflags = 'CHECKED';
                }
                if ($i == "tcpwindow") {
                    $tcpwindow = 'CHECKED';
                }
                if ($i == "tcpseq") {
                    $tcpseq = 'CHECKED';
                }
                if ($i == "tcpack") {
                    $tcpack = 'CHECKED';
                }
                if ($i == "tcplen") {
                    $tcplen = 'CHECKED';
                }
                if ($i == "tcpwindow") {
                    $tcpwindow = 'CHECKED';
                }
                if ($i == "ttl") {
                    $ttl = 'CHECKED';
                }
                if ($i == "tos") {
                    $tos = 'CHECKED';
                }
                if ($i == "id") {
                    $csv_id = 'CHECKED';
                }
                if ($i == "dgmlen") {
                    $dgmlen = 'CHECKED';
                }
                if ($i == "iplen") {
                    $iplen = 'CHECKED';
                }
                if ($i == "icmptype") {
                    $icmptype = 'CHECKED';
                }
                if ($i == "icmpcode") {
                    $icmpcode = 'CHECKED';
                }
                if ($i == "icmpid") {
                    $icmpid = 'CHECKED';
                }
                if ($i == "icmpseq") {
                    $icmpseq = 'CHECKED';
                }
            }
        }
         
        echo "<INPUT TYPE=HIDDEN NAME='sensor_id' VALUE='$sensor_id'>";
        echo "<INPUT TYPE=HIDDEN NAME='spo_name' VALUE='$spo_name'>";
        echo "<INPUT TYPE=HIDDEN name=id value=$id>";
        echo "<table align=center border=0 cellspacing=0 cellpadding=0 width=45%><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>CSV:</B> $lang[205]</TD></TR>";
        echo "<TR bgcolor=#DDDDDD><TD align=left>csv filename</TD><TD><INPUT NAME=file TYPE=TEXT value='$file' size='25'></TD><TD align=left>$lang[206]</TD><TD><INPUT NAME=default TYPE=checkbox $default></TD></TR>";
         
        echo "<TR bgcolor=#DDDDDD><TD align=left>timestamp</TD><TD><INPUT NAME=timestamp TYPE=checkbox $timestamp></TD><TD align=left>msg</TD><TD><INPUT NAME=msg TYPE=checkbox $msg></TD></TR>";
        echo "<TR bgcolor=#DDDDDD><TD align=left>src</TD><TD><INPUT NAME=src TYPE=checkbox $src></TD><TD align=left>proto</TD><TD><INPUT NAME=proto TYPE=checkbox $proto></TD></TR>";
        echo "<TR bgcolor=#DDDDDD><TD align=left>srcport</TD><TD><INPUT NAME=srcport TYPE=checkbox $srcport></TD><TD align=left>ethsrc</TD><TD><INPUT NAME=ethsrc TYPE=checkbox $ethsrc></TD></TR>";
        echo "<TR bgcolor=#DDDDDD><TD align=left>dst</TD><TD><INPUT NAME=dst TYPE=checkbox $dst></TD><TD align=left>ethdst</TD><TD><INPUT NAME=ethdst TYPE=checkbox $ethdst></TD></TR>";
        echo "<TR bgcolor=#DDDDDD><TD align=left>dsport</TD><TD><INPUT NAME=dsport TYPE=checkbox $dsport></TD><TD align=left>ethlen</TD><TD><INPUT NAME=ethlen TYPE=checkbox $ethlen></TD></TR>";
         
	echo "<TR bgcolor=#DDDDDD><TD align=left>tcpwindow</TD><TD><INPUT NAME=tcpwindow TYPE=checkbox $tcpwindow></TD></TR>";
        echo "<TR bgcolor=#DDDDDD><TD align=left>tcpflags</TD><TD><INPUT NAME=tcpflags TYPE=checkbox $tcpflags></TD><TD align=left>id</TD><TD><INPUT NAME=csv_id TYPE=checkbox $csv_id></TD></TR>";
        echo "<TR bgcolor=#DDDDDD><TD align=left>tcpseq</TD><TD><INPUT NAME=tcpseq TYPE=checkbox $tcpseq></TD><TD align=left>dgmlen</TD><TD><INPUT NAME=dgmlen TYPE=checkbox $dgmlen></TD></TR>";
        echo "<TR bgcolor=#DDDDDD><TD align=left>tcpack</TD><TD><INPUT NAME=tcpack TYPE=checkbox $tcpack></TD><TD align=left>iplen</TD><TD><INPUT NAME=iplen TYPE=checkbox $iplen></TD></TR>";
        echo "<TR bgcolor=#DDDDDD><TD align=left>tcplen</TD><TD><INPUT NAME=tcplen TYPE=checkbox $tcplen></TD><TD align=left>icmptype</TD><TD><INPUT NAME=icmptype TYPE=checkbox $icmptype></TD></TR>";
        echo "<TR bgcolor=#DDDDDD><TD align=left>tcpwindow</TD><TD><INPUT NAME=tcpwindow TYPE=checkbox $tcpwindow></TD><TD align=left>icmpcode</TD><TD><INPUT NAME=icmpcode TYPE=checkbox $icmpcode></TD></TR>";
        echo "<TR bgcolor=#DDDDDD><TD align=left>ttl</TD><TD><INPUT NAME=ttl TYPE=checkbox $ttl></TD><TD align=left>icmpid</TD><TD><INPUT NAME=icmpid TYPE=checkbox $icmpid></TD></TR>";
        echo "<TR bgcolor=#DDDDDD><TD align=left>tos</TD><TD><INPUT NAME=tos TYPE=checkbox $tos></TD><TD align=left>icmpseq</TD><TD><INPUT NAME=icmpseq TYPE=checkbox $icmpseq></TD></TR>";
        echo "</TABLE></TD></TR></TABLE></TD></TR></TABLE><BR>";
    }
     
    elseif ($spo  != "new") {
        echo "<INPUT TYPE=HIDDEN NAME='sensor_id' VALUE='$sensor_id'>";
        echo "<INPUT TYPE=HIDDEN NAME='spo_name' VALUE='$spo_name'>";
        echo "<INPUT TYPE=HIDDEN name=id value=$id>";
        echo "<table align=center border=0 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[224]:</B> $lang[162] !!!</TD></TR>";
        echo "<TR bgcolor=#DDDDDD><TD align=left><INPUT NAME=spo_name TYPE=TEXT value='$spo_name'></TD><TD><INPUT NAME=spo_value TYPE=TEXT value='$spo_value' size='75'></TD></TR>";
        echo "</TABLE></TD></TR></TABLE></TD></TR></TABLE><BR>";
    }
     
     
    if ($do == 'Select') {
        echo "<CENTER><INPUT NAME='do' VALUE='Save' TYPE=SUBMIT>&nbsp;<INPUT VALUE='Reset' TYPE=RESET></CENTER>";
    }
    elseif (($spo  != "new") && ($spo_name  != "log_null")) {
        echo "<CENTER><INPUT NAME='do' VALUE='Update' TYPE=SUBMIT>&nbsp;<INPUT NAME='do' VALUE='Duplicate' TYPE=SUBMIT>&nbsp;<INPUT VALUE='Reset' TYPE=RESET></CENTER>";
    }
    elseif ($spo == "new") {
        echo "<INPUT TYPE=HIDDEN NAME='sensor_id' VALUE='$sensor_id'>";
        echo "<table align=center border=0 cellspacing=0 cellpadding=0 width=40%><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=center colspan=2><B>$lang[222]</B></TD></TR>";
        echo "<TR bgcolor=#DDDDDD><TD>&nbsp;</TD></TR><TR bgcolor=#DDDDDD><TD align=center>
            <SELECT name=spo_name>
            <OPTION value='alert_fast:'>Alert Fast ($lang[196])</OPTION>
            <OPTION value='alert_full:'>Alert Full ($lang[198])</OPTION>
            <OPTION value='alert_smb:'>Alert SMB ($lang[194])</OPTION>
            <OPTION value='alert_syslog:'>Alert Syslog ($lang[199])</OPTION>
            <OPTION value='alert_unified:'>Alert Unified ($lang[202])</OPTION>
            <OPTION value='CSV:'>CSV ($lang[205])</OPTION>
            <OPTION value='database:'>Database ($lang[207])</OPTION>
            <OPTION value='log_null'>Log Null ($lang[221])</OPTION>
            <OPTION value='log_tcpdump:'>Log tcpdump ($lang[219])</OPTION>
            <OPTION value='log_unified:'>Log Unified ($lang[220])</OPTION>
            <OPTION value=''>-----------------------------------------------</OPTION>
            <OPTION value=''>$lang[223] $snortcenter_ver</OPTION>
            </SELECT>
            </TD></TR><TR bgcolor=#DDDDDD><TD>&nbsp;</TD></TR>";
        echo "</TABLE></TD></TR></TABLE></TD></TR></TABLE><BR>";
        echo "<CENTER><INPUT NAME='do' VALUE='Select' TYPE=SUBMIT></CENTER>";
    }
     
    echo "</FORM>";
    echo "<BR>";
    require('bottom.inc.php');
?>
Return current item: SnortCenter 2.x