From 795940c0f278b7e2ff4ff7b0e328dca480662a1c Mon Sep 17 00:00:00 2001 From: arf20 Date: Wed, 20 Mar 2024 17:31:54 +0100 Subject: Add ticket and ticket management --- openticket.php | 189 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 189 insertions(+) create mode 100644 openticket.php (limited to 'openticket.php') diff --git a/openticket.php b/openticket.php new file mode 100644 index 0000000..4448f7b --- /dev/null +++ b/openticket.php @@ -0,0 +1,189 @@ +fetch_all(MYSQLI_ASSOC); + +// POST actions +if ($_SERVER["REQUEST_METHOD"] == "POST") { + // add entry + $sql = "INSERT INTO orders (service, name, client, billing, comments) VALUES (?, ?, ?, ?, ?)"; + $stmt = mysqli_prepare($link, $sql); + mysqli_stmt_bind_param($stmt, "sssss", $param_service, $param_name, $param_client, $param_billing, $param_comments); + $param_service = $_POST["service"]; + $param_name = $_POST["name"]; + $param_client = $clientid; + $param_billing = $_POST["billing"]; + $param_comments = $_POST["comments"]; + + if (!mysqli_stmt_execute($stmt) || (mysqli_stmt_affected_rows($stmt) != 1)) { + echo "SQL error."; + } else { + // send admin mail + // Get admin mails + $sql = "SELECT email FROM users WHERE type = 'admin'"; + $stmt = mysqli_prepare($link, $sql); + mysqli_stmt_execute($stmt); + $result = mysqli_stmt_get_result($stmt); + $admins = $result->fetch_all(MYSQLI_ASSOC); + + foreach ($admins as $admin) { + $mailer->addAddress($admin["email"]); + } + + $mailer->Subject = "New service order request"; + $mailer->Body = "Admins,\n\nUser $username requested service ".getservicebyid($_POST["service"])["name"]."\n\n" + ."Instance name: ".$_POST["name"]."\n" + ."Calculated billing: ".$_POST["billing"]."\n" + ."Comments:\n" + .$_POST["comments"] + ."\n\n--\nARFNET Client, Service, Ticket and Invoice Management System\nhttps://arf20.com"; + if (!$mailer->send()) { + echo 'Mailer Error [ask arf20]: ' . $mailer->ErrorInfo; + } else header("location: ".$_SERVER['SCRIPT_NAME']); + } +} + +function getservicebyid($id) { + global $services; + foreach ($services as $service) { + if ($service["id"] == $id) { + return $service; + } + } +} + +function genoption($id, $name) { + return "" + ."
\n"; +} + +?> + + + + + + + ARFNET CSTIMS + + + +
+ ARFNET +
+
+
+
+
+

ARFNET Client Service Ticket and Invoice Management System

+

panel

+
+

Order a new service

+
+
+
+
+
+
+
+
+
+
+
+
+

+                            
+
+

+
+
+

+
+
+ + +
+
+
+
+ +
+
+ + -- cgit v1.2.3