#!/usr/bin/perl
#
# PIX Logging Architecture
# [ Kristof Philipsen ]
#
# This file is part of PIX Logging Architecture
#
# PIX Logging Architecture 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.
#
# PIX Logging Architecture 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 Foobar; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

                                                                                                                                                                                                  
use DBI;
use CGI;
                                                                                                                                                                                                  
#
# include configuration
#
require "conf.pl";      # General Configuration
require "subs.pl";      # Subroutines
                                                                                                                                                                                                  
#
# Make Database Connection
#
db_connect();
                                                                                                                                                                                                  
#
# Get CGI Parameters
#
$query = new CGI;
$id = $query->param("id");
$type = $query->param("type");
$date=`date +%Y"-"%m"-"%d" "%H":"%M":"%S`;
$date=~s/\n//g;
                                                                                                                                                                                                  
#
# HTML SECTION
#
printtitle();
                                                                                                                                                                                                  
if ($type eq "traffic") {
print <<EOF;
<span class='titlehead'><b>PIX Event Management > Add PIX Traffic Log ID</b></span>
EOF
}
if ($type eq "ids") {
print <<EOF;
<span class='titlehead'><b>PIX Event Management > Add PIX IDS Log ID</b></span>
EOF
}
print <<EOF;
<br><br>
<form action="./pix_event_id_process" method="post">
<table width="400" cellpadding="0" cellspacing="0" border="0">
<td width="100"><span class="main">PIX Log ID:</span></td>
<td width="100"><span class="main"><b>$id</b></span></td>
<tr>
<td width="100"><span class="main">PIX Log Type:</span></td>
<td width="100"><span class="main"><b>$type</b></span></td>
<tr>
<td width="100"><span class="main">PIX Incident ID:</span></td>
<td width="100"><span class="main">
<input type="hidden" name="id" value="$id">
<input type="hidden" name="type" value="$type">
<input type="hidden" name="add_date" value="$date">
<select name="incident_id">
<option selected>-incident id-
<option>

EOF
$getAllEvents = "SELECT incident_id, incident_name FROM event_management_data";
$statement2 = $db_handle->prepare($getAllEvents) or die "Couldn't prepare query '$getAllEvents': $DBI::errstr\n";
$statement2->execute();
while (($incident_id, $incident_name) = $statement2->fetchrow) {
print <<EOF;
<option value="$incident_id">($incident_id) $incident_name
EOF
}
print <<EOF;
</select>
</td>
<tr>
<td width="100"><span class="main">PIX ID Description:</span></td>
<td width="100"><span class="main">
<input type="text" name="description" size="40"><span class="main">
</td>
</table>
<input type="submit" value="ADD">
EOF
$db_handle->disconnect();

