From 3b86297c2ddcd691842efd22426fc301f6927ffa Mon Sep 17 00:00:00 2001 From: arf20 Date: Mon, 18 Mar 2024 02:44:40 +0100 Subject: Fix manageusers, create manageservices --- manageservices.php | 132 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 manageservices.php (limited to 'manageservices.php') diff --git a/manageservices.php b/manageservices.php new file mode 100644 index 0000000..c8a17ed --- /dev/null +++ b/manageservices.php @@ -0,0 +1,132 @@ +fetch_all(MYSQLI_ASSOC); + +// GET actions +// delete entry +if (isset($_GET["del"])) { + $sql = "DELETE FROM services WHERE id = ?"; + $stmt = mysqli_prepare($link, $sql); + mysqli_stmt_bind_param($stmt, "s", $param_id); + $param_id = $_GET["del"]; + if (!mysqli_stmt_execute($stmt) || mysqli_stmt_affected_rows($stmt) != 1) { + echo "SQL error."; + } else header("location: ".$_SERVER['SCRIPT_NAME']); +} + +// POST actions +if ($_SERVER["REQUEST_METHOD"] == "POST") { + // add entry + if (isset($_POST["add"])) { + $sql = "INSERT INTO services (name, type, billing, description) VALUES (?, ?, ?, ?)"; + $stmt = mysqli_prepare($link, $sql); + mysqli_stmt_bind_param($stmt, "ssss", $param_name, $param_type, $param_billing, $param_description); + $param_name = $_POST["name"]; + $param_type= $_POST["type"]; + $param_billing = $_POST["billing"]; + $param_description = $_POST["description"]; + + if (!mysqli_stmt_execute($stmt) || (mysqli_stmt_affected_rows($stmt) != 1)) { + echo "SQL error."; + } else header("location: ".$_SERVER['SCRIPT_NAME']); + } +} + +function getservicebyid($id) { + global $services; + foreach ($services as $service) { + if ($service["id"] == $id) { + return $service; + } + } +} + +?> + + + + + + + ARFNET CSTIMS + + +
+ ARFNET +
+
+
+
+
+

ARFNET Client Service Ticket and Invoice Management System

+

panel

+

Service offerings

+ +

Edit service ".$service["id"]."

\n" + ."

\n" + ."

\n" + ."

\n" + ."

\n" + ."
cancel" + ."
"; + } + ?> + + add + + + " + ."" + ."" + ."" + ."" + ."\n"; + } + ?> +
idnametypebillingdescriptionaction
".$service['id']."".$service['name']."".$service['type']."".$service['billing']."
".$service['description']."
del edit
+ +
+ + +
+ + + -- cgit v1.2.3