#!/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 = $query->param("add_date");
$incident_id = $query->param("incident_id");
$description = $query->param("description");

#
# DB Query Parameters
#
$db_query=$db_handle->prepare("insert into event_management_id values(\'$incident_id\', \'$date\', \'$type\',\'$id\',\'$description\')");
$rc=$db_query->execute();
$db_query2=$db_handle->prepare("update event_management_data set incident_update_time=\"$date\"");
$rc=$db_query2->execute();

#
# HTML SECTION
#
printtitle();

if ($type eq "traffic") {
print <<EOF;
<span class='titlehead'><b>PIX Event Management > Add PIX Traffic Log ID > Verification</b></span>
EOF
}
if ($type eq "ids") {
print <<EOF;
<span class='titlehead'><b>PIX Event Management > Add PIX IDS Log ID > Verification</b></span>
EOF
}
print <<EOF;
<br><br>
<span class="main">
The following serves of a verification of your action.<br>
You have linked the following data to the defined Incident ID:<br><br>
</span>
<table width="400" cellpadding="0" cellspacing="0" border="0">
EOF
$getVerification = "SELECT incident_id, incident_entry_time, incident_pix_id_type, incident_pix_id, incident_pix_id_description FROM event_management_id where incident_pix_id like \"$id\" and incident_id like \"$incident_id\" and incident_pix_id_type like \"$type\"";
$statement2 = $db_handle->prepare($getVerification) or die "Couldn't prepare query '$getVerification': $DBI::errstr\n";
$statement2->execute();
while (($incident_id_new, $incident_entry_time, $incident_pix_id_type, $incident_pix_id, $incident_pix_id_description) = $statement2->fetchrow) {
print <<EOF;
<td width="150"><span class="main">Entry Time:</td>
<td width="150"><span class="main">$incident_entry_time</td>
<tr>
<td width="150"><span class="main">PIX Log ID:</td>
<td width="150"><span class="main">$incident_pix_id</td>
<tr>
<td width="150"><span class="main">PIX ID Type:</td>
<td width="150"><span class="main">$incident_pix_id_type</td>
<tr>
<td width="150"><span class="main">PIX ID Description:</td>
<td width="150"><span class="main">$incident_pix_id_description</td>
EOF
}
print <<EOF;
</table>
EOF

$db_handle->disconnect();

