From c509a2d6aa9394fa7200d8fa11904914d8e81f06 Mon Sep 17 00:00:00 2001 From: arf20 Date: Tue, 19 Mar 2024 04:58:03 +0100 Subject: Order working --- admin.php | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'admin.php') diff --git a/admin.php b/admin.php index 37a69f6..2aeebe1 100644 --- a/admin.php +++ b/admin.php @@ -10,6 +10,8 @@ if(!isset($_SESSION["loggedin"]) || $_SESSION["loggedin"] !== true){ $username = $_SESSION["username"]; $type = $_SESSION["type"]; +if ($type != "admin") die("Permission denied."); + require_once "config.php"; // Get users @@ -33,6 +35,24 @@ mysqli_stmt_execute($stmt); $result = mysqli_stmt_get_result($stmt); $orders = $result->fetch_all(MYSQLI_ASSOC); +function getservicebyid($id) { + global $services; + foreach ($services as $service) { + if ($service["id"] == $id) { + return $service; + } + } +} + +function getclientbyid($id) { + global $users; + foreach ($users as $client) { + if ($client["id"] == $id) { + return $client; + } + } +} + ?> @@ -59,7 +79,7 @@ $orders = $result->fetch_all(MYSQLI_ASSOC); usertypestatus ".$user['username']."".$user['type']."".$user['status']."\n"; + echo "".$user["username"]."".$user["type"]."".$user["status"]."\n"; } ?> @@ -70,7 +90,7 @@ $orders = $result->fetch_all(MYSQLI_ASSOC); nametypebilling ".$service['name']."".$service['type']."".$service['billing']."\n"; + echo "".$service["name"]."".$service["type"]."".$service["billing"]."\n"; } ?> @@ -81,7 +101,7 @@ $orders = $result->fetch_all(MYSQLI_ASSOC); serviceinstanceclient ".$order['service']."".$order['name']."".$order['client']."\n"; + echo "".getservicebyid($order["service"])["name"]."".$order["name"]."".getclientbyid($order["client"])["username"]."\n"; } ?> -- cgit v1.2.3