safe_query("INSERT INTO tickets
(userID, date, category, subject, severity, lastPost)
VALUES (%i, NOW(), %i, '%s', %i, %i)",
array($_SESSION['support_id'], $_POST['category'],
$_POST['subject'], $_POST['severity'], $_SESSION['support_id']),
__FILE__, __LINE__);
$ticket_id = $database->get_insert_id();
// Insert the message
// NOTE: The actual ticket and the message are stored seperately, so don't get confused here
$database->safe_query("INSERT INTO ticket_messages
(date, message, ticketID, userID)
VALUES (NOW(), '%s', %i, %i)",
array(nl2br(htmlentities($_POST['message'])), $ticket_id, $_SESSION['support_id']),
__FILE__, __LINE__);
// Get the body of the email
$message = newTicketMail($_SESSION['support_id'], stripslashes($_POST['subject']), $_POST['severity'],
stripslashes($_POST['message']));
// Send the actual email
mail($SETTINGS['adminEmail'], "New support ticket (ID #{$ticket_id})", $message, "From: {$SETTINGS['fromEmail']}");
pageHeader("Ticket Received");
echo "Your RFQ was received by our support team and we will reply as soon as possible.
back";
}
// If the form hasn't been submitted yet
} else {
pageHeader("Request For Quote");
// Get the category list
$cat_list = showTicketCategories(false, "name ASC", 0);
// Get the severity list
$severities = showTicketSeverities(false);
// Show the input form
echo <<