<?php
//This page will add the issue into the database after form data validation.
include ("pagefunctions.php");
if (trim($Category)=="") {
die("<b>Submission Failed!</b><br> <p>You need to select a Category. Press the back button now");
}
if (trim($Description)=="") {
die("<b>Submission Failed!</b><br> <p>You need to fill in the problem description. Press the back button now");
}
if (trim($Contact)=="") {
die("<b>Submission Failed!</b><br> <p>You need to fill in your contact info. Press the back button now");
}
gentop("Thank You");
$date = date("Y-m-d H:i:s");
global $connection;
$db = mysql_select_db("radTracker",$connection) or die ("Couldn't Connect to radtracker DB");
$sql_iinsert1 = "INSERT INTO issue
(Description,
Severity,
Category,
Date,
Contact,
Contactemail,
Contactphone,
Building,
Room,
CompName,
Costcenter)
VALUES('$Description',
'$Severity',
'$Category',
'$date',
'$Contact',
'$Contactemail',
'$Contactphone',
'$Building',
'$Room',
'$CompName',
'$costcenter')";
$insert1_result = mysql_query($sql_iinsert1,$connection) or die (mysql_error());
echo "<html>\n<head>\n<title>Issue Logged</title>\n</head>\n\n<body bgcolor='white'>\n
<table><Tr><td colspan=2 align=middle><h3 align='center'>Your submission has been processed</h3></td></tr>";
echo "<tr><td align=middle colspan =2>Support responding to your request ...</td></tr>";
/* email and pager notification system*/
echo "<tr><td>Severity is set to </td><td>$Severity</td></tr>";
if ($Severity=="high"){
echo "<tr><TD>Pager is being sent to</td><td></td></tr>";
$sql_iinsert1="Select Pager,personnel.name from personnel,expertise,category where personnel.name=expertise.name and expertise.CUID=category.CUID and category.category='$Category'";
$sql_result = mysql_query($sql_iinsert1,$connection) or die (mysql_error());
while ($row = mysql_fetch_array($sql_result)) {
$recip=$row["Pager"];
$pname=$row["name"];
mail("$recip","High Priority Issue","$Description");
print("$mailsend");
echo "<tr><TD>Pager is being sent to</td><td>$pname</td></tr>";
}
}
$sql_iinsert1="Select Email,personnel.name from personnel,expertise,category where personnel.name=expertise.name and expertise.CUID=category.CUID and category.category='$Category'";
$sql_result = mysql_query($sql_iinsert1,$connection) or die (mysql_error());
while ($row = mysql_fetch_array($sql_result)) {
$recip=$row["Email"];
$pname=$row["name"];
mail("$recip"," $Severity" . " Priority Isse with $Category ","Problem Reported by $Contact\nProblem\n" . "$Description");
print("$mailsend");
echo "<tr><TD>Email is being sent to</td><td>$pname</td></tr>";
}
global $supportstring;
echo "<tr><td>" . $supportstring . "</td></tr></table>";
genbottom();
?>