function DoHead() { include "header.php"; OpenTable(); ?> <center><b><strong> · <a href="<?php echo $_SERVER['PHP_SELF']; ?> ">Administration Home</a> ·<br> · <a href="<?php echo $_SERVER['PHP_SELF']; ?> ?op=Accounting">Accounting Admin</a> · <?php include "modules/Accounting/updater.php"; if (isUpdate()) { ?> <br>··· <a href="http://moahosting.com/modules.php?name=Downloads&d_op=viewdownload&cid=2">An update is available!</a> ···<br> <?php } ?> </strong></b></center> <?php CloseTable(); echo "<br>"; OpenTable(); // Create the accounting menu DoMenu(); }
function CancelReq() { global $prefix, $db, $cookie, $user; $config = $db->sql_fetchrow($db->sql_query("SELECT * FROM " . $prefix . "_hosting_accounting_config")); OpenTable(); DoMenu(); if (isset($_POST['submit'])) { // Build the email sent to the admin about the user's cancellation request $msg = "Dear Admin,\nPlease cancel the following services from " . $cookie[1] . "'s account:\n\n"; $msg .= "Reason for Cancel: " . $_POST['reason'] . "\n"; $msg .= "Comments: " . $_POST['comments'] . "\n\n"; foreach ($_POST['item'] as $item_id) { // Loop through all of the services that were cancelled $row = $db->sql_fetchrow($db->sql_query("SELECT parent_id, description FROM " . $prefix . "_hosting_accounting_details WHERE id='" . $item_id . "'")); $msg .= "Invoice ID: " . $row['parent_id'] . "\n"; $msg .= "Description: " . $row['description'] . "\n\n"; $chk = 1; } // If a service was selected and the user entered a cancellation reason then email the admin, else display an error if ($chk == 1 && $_POST['reason'] != "") { $row = $db->sql_fetchrow($db->sql_query("SELECT user_id, username, user_email FROM " . $prefix . "_users WHERE user_id='" . $cookie[0] . "'")); $mailheaders = "From: " . $row['user_email'] . "\n"; $mailheaders .= "Reply-To: " . $row['user_email'] . "\n\n"; // Create the email subject $subject = "Cancellation Request Submitted by User: "******"100%" cellspacing="0" cellpadding="1" style="border: 1px solid;"><tr><td> Your cancellation request has been sent.</td></tr></table><br> <?php } else { ?> <br><table width="100%" cellspacing="0" cellpadding="1" style="border: 1px solid;"><tr><td> Error: Please fill in all required fields!</td></tr></table><br> <?php } } else { ?> <br> <table width="100%" cellspacing="2" cellpadding="1" style="border: 1px solid;"> <form method="post"> <tr> <td style="border-bottom: 1px solid;" colspan="2"> Select service(s) to cancel:</td> </tr> <?php // Fetch all of the invoices for this user $result = $db->sql_query("SELECT id FROM " . $prefix . "_hosting_accounting WHERE uid='" . $cookie[0] . "' AND status='unpaid'"); while ($row = $db->sql_fetchrow($result)) { // Fetch all of the services for each invoice and display them $result2 = $db->sql_query("SELECT id, description FROM " . $prefix . "_hosting_accounting_details WHERE parent_id='" . $row['id'] . "'"); while ($row2 = $db->sql_fetchrow($result2)) { ?> <tr> <td colspan="2" align="left"> <input type="checkbox" name="item[]" value="<?php echo $row2['id']; ?> "> <?php echo $row2['description']; ?> </td> </tr> <?php } } ?> <tr> <td width="30%" class="tblcolor1"> Reason for Cancel: </td> <td align="left"><input type="text" name="reason" style="width:200;"> *</td> </tr> <tr> <td valign="top" width="30%" class="tblcolor1"> Additional Comments: </td> <td align="left"><textarea name="comments" style="width:200; height:75;"></textarea></td> </tr> <tr><td colspan="2" align="center"><input type="submit" name="submit" value="Submit" style="width:100;"></td></tr></form> </table> <?php } CloseTable(); }
function NewTicket() { DoMenu(); global $db, $socketfrom, $socketfromname, $maintablewidth, $maintablealign, $sess_uid, $prefix, $cookie, $tr_color1; // IF THE FORM IS SUBMITTED THEN VERIFY SOME CONTENTS if (isset($_POST[submit])) { // IF FORM IS NOT FILLED OUT CORRECTLY THEN SHOW ERROR MESSAGES if ($_POST['message'] == '' || $_POST['ticketsubject'] == '') { ?> <table width="<?php echo $maintablewidth; ?> " cellspacing="1" cellpadding="1" border="1" class="boxborder" align="<?php echo $maintablealign; ?> "> <tr> <td><br /><blockquote><p>Please complete all the fields.</p></blockquote></td> </tr> </table> <?php } else { $urgency = explode('|', $_POST['urgency']); $category = explode('|', $_POST['category']); $date = getdate(); $query = "INSERT INTO " . $prefix . "_hosting_tickets_tickets\r\n\t\t\t\t\t\t\t\tSET\r\n\t\t\t\t\t\t\t\ttickets_uid = '" . $sess_uid . "',\r\n\t\t\t\t\t\t\t\ttickets_subject = '" . $_POST[ticketsubject] . "',\r\n\t\t\t\t\t\t\t\ttickets_timestamp = '" . $date[mon] . "/" . $date[mday] . "/" . $date[year] . " - " . $date[hours] . ":" . $date[minutes] . ":" . $date[seconds] . "',\r\n\t\t\t\t\t\t\t\ttickets_name = '" . $_POST[PostName] . "',\r\n\t\t\t\t\t\t\t\ttickets_email = '" . $_POST[email] . "',\r\n\t\t\t\t\t\t\t\ttickets_urgency = '" . $urgency[0] . "',\r\n\t\t\t\t\t\t\t\ttickets_category = '" . $category[0] . "',\r\n\t\t\t\t\t\t\t\ttickets_admin = '" . $cookie[1] . "',\r\n\t\t\t\t\t\t\t\ttickets_question = '" . addslashes($_POST[message]) . "'"; if ($db->sql_query($query)) { $result = $db->sql_query("SELECT tickets_id FROM " . $prefix . "_hosting_tickets_tickets WHERE tickets_uid = '" . $sess_uid . "' ORDER BY tickets_id ASC"); while ($row = $db->sql_fetchrow($result)) { $lastinsertid = $row[tickets_id]; } // CHECK THE FILE ATTACHMENT AND DISPLAY ANY ERRORS if ($allowattachments == 'TRUE') { FileUploadsVerification("{$_FILES}(userfile)", $lastinsertid); } // EMAIL ADMINISTRATOR THE TICKET NOTIFICATION $message = "Ticket ID:\t " . $lastinsertid . "\n"; $message .= "Name:\t\t " . $_POST['PostName'] . "\n"; $message .= "Email:\t " . $_POST['email'] . "\n"; $message .= "Subject:\t " . $_POST['ticketsubject'] . "\n"; $message .= "Urgency:\t " . $urgency['1'] . "\n"; $message .= "Department:\t " . $category['1'] . "\n"; $message .= "Post Date:\t " . date($dformatemail) . "\n"; $message .= "----------------------------------------------------------------------\n"; $message .= "Message:\n"; $message .= stripslashes($_POST['message']) . "\n"; $message .= "----------------------------------------------------------------------\n"; $mailheaders = "From: " . $_POST['email'] . "\n"; $mailheaders .= "Reply-To: " . $_POST['email'] . "\n\n"; $subject = "New Ticket Created: " . $lastinsertid . "\n\n"; mail($socketfrom, $subject, $message, $mailheaders); } else { echo "error"; } ?> <meta http-equiv="refresh" content="0;URL=<?php echo $_SERVER['PHP_SELF']; ?> ?name=<?php echo $_GET[name]; ?> &caseid=view&ticketid=<?php echo $lastinsertid; ?> " /><?php } } else { // PRODUCE THE FORM SO THE PERSON CAN WRITE THE NEW TICKET $query = "\tSELECT user_email, username FROM " . $prefix . "_users WHERE user_id = '" . $sess_uid . "' LIMIT 0,1"; $result = $db->sql_query($query); $row = $db->sql_fetchrow($result); ?> <form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?> ?name=<?php echo $_GET[name]; ?> &caseid=NewTicket" method="post"> <table width="<?php echo $maintablewidth; ?> " cellspacing="1" cellpadding="4" border="1" class="boxborder" align="<?php echo $maintablealign; ?> "> <tr> <td class="boxborder" width="50%" valign="top"><p> <table width="100%" cellspacing="1" cellpadding="1" border="1" class="boxborder" align="center"> <tr bgcolor="<?php echo $tr_color1; ?> "> <td class="boxborder" colspan="2"><p><b>New Support Ticket - All Fields Required</b></p></td> </tr> <tr> <td bgcolor="<?php echo $tr_color1; ?> " class="boxborder"><p><b>Username:</b></p></td> <td class="boxborder"><p><input type="hidden" name="PostName" size="40" value="<?php echo $row[username]; ?> " /><?php echo $row[username]; ?> </p></td> </tr> <tr> <td bgcolor="<?php echo $tr_color1; ?> " class="boxborder"><p><b>Email:</b></p></td> <td class="boxborder"><p><input type="hidden" name="email" size="40" value="<?php echo $row[user_email]; ?> " /><?php echo $row[user_email]; ?> </p></td> </tr> <tr> <td bgcolor="<?php echo $tr_color1; ?> " class="boxborder"><p><b>Subject:</b></p></td> <td class="boxborder"><p><input name="ticketsubject" size="40" <?php if (isset($_POST['ticketsubject']) && $_POST['ticketsubject'] != '') { echo ' value="' . $_POST['ticketsubject'] . '"'; } ?> ></p></td> </tr> <tr> <td bgcolor="<?php echo $tr_color1; ?> " class="boxborder"><p><b>Department:</b></p></td> <td class="boxborder"><p> <select name="category"> <?php $query = "\tSELECT tickets_categories_id, tickets_categories_name\r\n\t\t\t\t\tFROM " . $prefix . "_hosting_tickets_categories\r\n\t\t\t\t\tORDER BY tickets_categories_name ASC"; $result = $db->sql_query($query); while ($row = $db->sql_fetchrow($result)) { echo '<option value="' . $row['tickets_categories_id'] . '|' . $row['tickets_categories_name'] . '">' . $row['tickets_categories_name'] . '</option>'; } ?> </select> </p></td> </tr> <tr> <td bgcolor="<?php echo $tr_color1; ?> " class="boxborder"><p><b>Urgency:</b></p></td> <td class="boxborder"><p> <select name="urgency"> <?php $query = "\tSELECT tickets_status_id, tickets_status_name, tickets_status_color\r\n\t\t\t\t\tFROM " . $prefix . "_hosting_tickets_status\r\n\t\t\t\t\tORDER BY tickets_status_order ASC"; $result = $db->sql_query($query); while ($row = $db->sql_fetchrow($result)) { echo '<option style="background-color:#' . $row['tickets_status_color'] . '" value="' . $row['tickets_status_id'] . '|' . $row['tickets_status_name'] . '">' . $row['tickets_status_name'] . '</option>'; } ?> </select></p></td> </tr> </table><div style="padding-top:5px"></div> <table width="100%" cellspacing="1" cellpadding="1" border="1" class="boxborder" align="center"> <tr bgcolor="<?php echo $tr_color1; ?> "> <td class="boxborder"><p><b>Question</b></p></td> </tr> <tr> <td align="right"> <textarea name="message" cols="65" rows="10"> <?php if (isset($_POST['message']) && $_POST['message'] != '') { echo $_POST['message'] . '</textarea>'; } else { echo '</textarea>'; } ?> <input type="submit" name="submit" value="Submit" /> </td> </tr> </table> <?php // ALLOW THE USERS TO ATTACH A FILE TO THE TICKET if ($allowattachments == 'TRUE') { FileUploadForm(); } ?> </p></td> </p></td> <td class="boxborder" width="50%" valign="top"> <table width="100%" cellspacing="1" cellpadding="1" border="1" class="boxborder" align="center"> <?php // IF ATTACHMENTS ARE TRUE THEN SHOW ALLOWED FILETYPES if ($allowattachments == 'TRUE') { ?> <tr> <td><p><b>Allowed FILE TYPES for attachments:</b><br /> <?php for ($i = '0'; $i <= COUNT($allowedtypes) - 1; $i++) { echo $allowedtypes[$i] . '<br />'; } ?> </p></td> </tr> <?php } ?> </table> </td> </tr> </table> </form> <?php if (isset($refresh) && $refresh == 'TRUE') { ?> <meta http-equiv="refresh" content="2;URL=<?php echo $_SERVER['PHP_SELF']; ?> ?name=<?php echo $_GET[name]; ?> &caseid=view&ticketid=<?php echo $lastinsertid; ?> " /> <?php } } }