Location: PHPKode > projects > Snort Log Monitor and Ticketing System > snortlogmonitor/tixhistory.php
<html>
<head>
<title>Snort IDS logs for Securetty.com</title>
<base target="_self">
</head>
<body bgcolor="gray">
<form action="tixedit.php" target="logdata" method="post">

<?php
/* filename= tixedit.php */
include ("mytime.php");
include ("myfunctions.php");

# If the includes are not working for the db settings then populate them locally:
include ("dbconn_out.php");
include ("tixdbconn_out.php");

##  mysql snort database
#  $db_host       = "";  # mysql database server.
#  $db_user       = "";  # mysql user with SELECT, UPDATE, INSERT priveleges.
#  $db_passwd     = "";  # password for mysql user.
#  $db_database   = "";  # database name where snort logs to.
##  mysql snort database for ticketing system
#  $tix_db_host       = "";  # IP of mysql server containing ticketing database.
#  $tix_db_user       = "";  # mysql user with SELECT, INSERT, UPDATE, DELETE priveleges.
#  $tix_db_passwd     = "";  # password for mysql user.
#  $tix_db_database   = "";  # name of the ticketing database.


if (($tix_database == "View Ticket History") AND ($theTix_number != ""))
{

#----- Connect to Ticketing database ---------------------------------------
  $tix_db_connection = mysql_connect($tix_db_host, $tix_db_user, $tix_db_passwd);
  mysql_select_db($tix_db_database);

#----- Query ticket table in mtstix database to populate the screen --------
  $Selstr = "SELECT tix_id, engineer_id, timestamp, description ";
  $Selstr .= "FROM ticket ";
  $Selstr .= "WHERE tix_id=$theTix_number";

  $TixResult = mysql_query($Selstr, $tix_db_connection);
  if (mysql_num_rows($TixResult) != 0)
  {
    $tixhdr = mysql_fetch_row($TixResult);
  }
  $EngID = intval($tixhdr[1]);
  $Selstr = "SELECT engineer.eng_name, eng_rank.rank_name ";
  $Selstr .= "FROM engineer, eng_rank ";
  $Selstr .= "WHERE engineer.rank_id=eng_rank.rank_id ";
  $Selstr .= "AND engineer_id=$EngID";

  $EngResult = mysql_query($Selstr, $tix_db_connection);
  if (mysql_num_rows($EngResult) != 0)
  {
    $EngRow = mysql_fetch_row($EngResult);
  }

#----- Query history table in mtstix database to populate the screen --------

  $Selstr = "SELECT history.timestamp, engineer.eng_name, eng_rank.rank_name, status.status_name, history.notes ";
  $Selstr .= "FROM history, engineer, eng_rank, status ";
  $Selstr .= "WHERE tix_id=$theTix_number AND engineer.engineer_id=history.engineer_id AND ";
  $Selstr .= "status.status_id=history.status_id AND engineer.rank_id=eng_rank.rank_id";


  $HistResult = mysql_query($Selstr, $tix_db_connection);





#--------- Present Ticketi History Screen -----------------------------------------------------------

print "<table width=\"100%\" bgcolor=\"blue\">\n";
print "<tr><th align=\"center\"><b>Ticket History</b></th></tr>\n";
print "<tr bgcolor=\"blue\"><td>\n";
print "     <table width=\"100%\" border=\"0\" bgcolor=\"orange\">\n";
print "       <tr><td width=\"120\" align=\"left\"><b>Ticket Number:</b></td>\n";
print "           <td width=\"200\" align=\"left\"><b>Created by:</b></td>\n";
print "           <td width=\"170\" align=\"left\"><b>Creation Date:</b></td>\n";
print "           <td align=\"left\"><b>Title:</b></td></tr>\n";
print "       <tr><td width=\"120\" align=\"left\">$tixhdr[0]</td>\n";
print "           <td width=\"200\" align=\"left\">$EngRow[0] - $EngRow[1]</td>\n";
print "           <td width=\"170\" align=\"left\">$tixhdr[2]</td>\n";
print "           <td align=\"left\">$tixhdr[3]</td></tr>\n";
print "     </table></td></tr>\n";
print "<tr><td><hr></td></tr>\n";
print "<tr>\n";
print "  <td>\n";
print "     <table border=\"0\" width=\"100%\" bgcolor=\"purple\">\n";

if (mysql_num_rows($HistResult) != 0)
{
  for ($i=0; $i < mysql_num_rows($HistResult); $i++)
  {

    $HistRow = mysql_fetch_row($HistResult);

    print "       <tr><td><table width=\"100%\" border=\"0\" bgcolor=\"purple\">\n";
    print "                 <tr><td width=\"70\"  align=\"left\"><b>Update#</b></td>\n";
    print "                     <td width=\"150\" align=\"left\"><b>Date:</b></td>\n";
    print "                     <td width=\"100\"  align=\"left\"><b>Status:</b></td>\n";
    print "                     <td               align=\"left\"><b>Engineer:</b></td></tr>\n";
    print "                 <tr><td width=\"70\" >$i</td>\n";
    print "                     <td width=\"150\">$HistRow[0]</td>\n";
    print "                     <td width=\"100\" >$HistRow[3]</td>\n";
    print "                     <td              >$HistRow[1] - $HistRow[2]</td></tr>\n";
    print "                 <tr><td></td>\n";
    print "                     <td colspan=\"4\">$HistRow[4]</td></tr>\n";
    print "               </table></td></tr>\n";
    print "       <tr><td><hr></td></tr>\n";
  }
}
print "     </table>\n";
print "  </td>\n";
print "</tr>\n";
print "</table>\n";


#---- Pass on these variables -----
print "<input type=\"hidden\" name=\"theTix_number\" value=$theTix_number>";
}

?>




  </body>
</html>
Return current item: Snort Log Monitor and Ticketing System