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

<?php

include ("myfunctions.php");

# If the includes are not working for the db settings then populate them locally:
include ("dbconn_out.php");
include ("tixdbconn_in.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.


#-------------------------------------------------------------------------
# Set up database connectivity
#-------------------------------------------------------------------------

# Database connection for IDS logs
  $db_connection = mysql_connect($db_host, $db_user, $db_passwd);
  mysql_select_db($db_database);

# Database connection for Ticketing System
  $tix_db_connection = mysql_connect($tix_db_host, $tix_db_user, $tix_db_passwd);
  mysql_select_db($tix_db_database);


#-------------------------------------------------------------------------
# Determine what status to view
#-------------------------------------------------------------------------

  switch ($status)
  {
    case "all":
      $STATUS_ID_JOIN = "ticket.status_id>=0 AND ticket.status_id<=4";
      break;
    case "new":
      $STATUS_ID_JOIN = "ticket.status_id=0";
      break;
    case "assigned":
      $STATUS_ID_JOIN = "ticket.status_id=1";
      break;
    case "pending":
      $STATUS_ID_JOIN = "ticket.status_id=2";
      break;
    case "resolved":
      $STATUS_ID_JOIN = "ticket.status_id=3";
      break;
    case "dismissed":
      $STATUS_ID_JOIN = "ticket.status_id=4";
      break;
    default:
      $STATUS_ID_JOIN = "ticket.status_id>=0 AND ticket.status_id<=4";
      break;
  }


  $Selstr = " SELECT ticket.tix_id, ticket.timestamp, engineer.eng_name, ";
  $Selstr .= "eng_rank.rank_name, status.status_name, ticket.description ";
  $Selstr .= "FROM ticket, engineer, status, eng_rank ";
  $Selstr .= "WHERE $STATUS_ID_JOIN AND ";
  $Selstr .= "engineer.engineer_id=ticket.engineer_id AND ";
  $Selstr .= "ticket.status_id=status.status_id AND ";
  $Selstr .= "eng_rank.rank_id=engineer.rank_id";


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

#------ Create screen ------------------------------------------------------------
print "<table width=\"100%\" bgcolor=\"white\">\n";
print " <tr><td><a href=\"tixviewall.php\">View Tickets</a></td></tr>\n";
print " <tr>\n";
print "    <td>\n";
print "      <table width=\"100%\" bgcolor=\"orange\">\n";
print "        <tr><td align=\"center\"><b>View $status Tickets</b></tr>\n";
print "      </table>\n";
print "    </td>\n";
print " </tr>\n";
print " <tr>\n";
print "    <td>\n";
print "      <table width=\"100%\">\n";

if (mysql_num_rows($ViewResult) != 0)
{
  for ($i=0; $i < mysql_num_rows($ViewResult); $i++)
  {
    $ViewRow = mysql_fetch_row($ViewResult);


    print "         <tr>\n";
    print "           <td>\n";
    print "              <table width=\"100%\" bgcolor=\"white\">\n";
    print "                <tr><td width=\"50\"  align=\"left\"><b>Rec#</b></td>\n";
    print "                    <td width=\"100\" align=\"left\"><b>Ticket #:</b></td>\n";
    print "                    <td width=\"150\" align=\"left\"><b>Created On:</b></td>\n";
    print "                    <td width=\"175\" align=\"left\"><b>Engineer:</b></td>\n";
    print "                    <td width=\"90\"  align=\"left\"><b>Status:</b></td>\n";
    print "                    <td                             ><b>Title:</b></td></tr>\n";
    print "                <tr><td width=\"50\"  align=\"left\">$i</td>\n";
    print "                    <td width=\"100\" align=\"left\">
              <a href=\"tixedit.php?tix_database=View Ticket History&theTix_number=$ViewRow[0]\">$ViewRow[0]</a></td>\n";
    print "                    <td width=\"150\" align=\"left\">$ViewRow[1]</td>\n";
    print "                    <td width=\"175\" align=\"left\">$ViewRow[2] - $ViewRow[3]</td>\n";
    print "                    <td width=\"90\"  align=\"left\">$ViewRow[4]</td>\n";
    print "                    <td                             >$ViewRow[5]</td></tr>\n";
    print "              </table>\n";
    print "           </td>\n";
    print "         </tr>\n";
    print "         <tr><td><hr></td></tr>\n";
  }
}
print "      </table>\n";
print "    </td>\n";
print " </tr>\n";
print "</table>\n";
#-------------------- End screen ----------------------------------------------------
?>

  </body>
</html>




Return current item: Snort Log Monitor and Ticketing System