College of Agriculture and Life Sciences Computer Support Data System

New Help Ticket

\n"; if($query['subject'] == "") $error .= "You must have a subject that briefly describes your problem.
\n"; if($query['description'] == "") $error .= "You must describe your problem.
\n"; if($query['source'] != "web") $error .= "The source of this ticket must be from the web.
\n"; if ($error == false) { // check the username include("/secure_www/support/db2/includes/vars.php"); include("/secure_www/support/db2/includes/functions.php"); dbConnect(); $theQuery = "SELECT uid, email, defaultAid, firstname, lastname, phone, address FROM ".$GLOBALS['dbTableUsers'] . " WHERE username='".$query['username']."'"; $result = do_query($theQuery, __LINE__); if (mysql_num_rows($result) != 1) { $error .= "You must enter your valid College of Ag username. If you are having problmes please call 294-1927.
\n"; } if($error == false) { // insert the ticket $row = mysql_fetch_array($result); $query['uid'] = $row['uid']; $query['aid'] = $row['defaultAid']; if ($query['aid'] == "") $query['aid'] = 1; $query['status'] = "Open"; $query['priority'] = 3; $theQuery = "INSERT INTO " . $GLOBALS['dbTableTickets'] . " (uid, dateSubmitted, aid, source, status, subject, description, priority) VALUES (".$query['uid'].", now(), ".$query['aid'].", '".$query['source']."', '".$query['status']."', '".$query['subject']."', '".$query['description']."', ".$query['priority'].")"; $result2 = do_query($theQuery, __LINE__); $tid = mysql_insert_id(); $theQuery = "SELECT uid FROM ". $GLOBALS['dbTableAdmins']." WHERE aid=".$query['aid']; $result3 = do_query($theQuery, __LINE__); if (mysql_num_rows($result3) == 1) { $row3 = mysql_fetch_array($result3); $theQuery = "SELECT username FROM ".$GLOBALS['dbTableUsers']." WHERE uid=".$row3['uid']; $result4 = do_query($theQuery, __LINE__); $row4 = mysql_fetch_array($result4); $assignedTo = $row4['username']; } else { $assignedTo = "UNASSIGNED!"; } // send email $subject = "[ticket] ".stripslashes($query['subject']); $from = $row['email']; $message .= "Submitted by: ". $row['firstname'] ." ". $row['lastname']. " (".$query['username'].")\n"; $message .= "Phone: ".$row['phone']."\n"; $message .= "Address: ".$row['address']."\n"; $message .= "Assigned to: ".$assignedTo."\n"; $message .= "\n"; $message .= "Subject: ".stripslashes($query['subject'])."\n"; $message .= "\n"; $message .= "Problem Description:\n\n"; $message .= $query['description']; $message .= "\n\n"; $message .= "https://www.ag.iastate.edu/support/db2/tickets/edit.php?tid=".$tid."\n"; $message = stripslashes(stripslashes($message)); $subject = stripslashes($subject); // the email $otherinfo ="From: ".$from."\nReply-To: ".$from."\n"; /* // debug email echo "TO: ".$GLOBALS['agHelpEmail']."
\n"; echo "FROM: ".$from."
\n"; echo "SUBJECT: ".$subject."
\n"; echo "
\n"; echo $message; echo "\n\n


"; */ $mailsent = mail($GLOBALS['agHelpEmail'], $subject, $message, $otherinfo); if(!$mailsent) echo "Error sending email to ".$GLOBALS['agHelpEmail']." Please Call 294-1927."; echo "Thank You, ".$row['firstname']." for submitting a help ticket. We will respond to your request as soon as possible."; } else $displayForm = true; } else $displayForm = true; } else $displayForm = true; if ($displayForm == true) { ?>
Username:
Subject:
Description:

© Copyright 2005, Ag College Computer Support, Iowa State University
Developed by John Rearick