aboutsummaryrefslogtreecommitdiff
path: root/admin.php
diff options
context:
space:
mode:
authorarf20 <aruizfernandez05@gmail.com>2024-03-19 04:58:03 +0100
committerarf20 <aruizfernandez05@gmail.com>2024-03-19 04:58:03 +0100
commitc509a2d6aa9394fa7200d8fa11904914d8e81f06 (patch)
tree3ba0ba4aa4ebe1ad232b2dfbabf5dbf99a3327b7 /admin.php
parent1818a590244c1ae8390a6fb58d6e1f775b46d723 (diff)
downloadarfnet2-cstims-c509a2d6aa9394fa7200d8fa11904914d8e81f06.tar.gz
arfnet2-cstims-c509a2d6aa9394fa7200d8fa11904914d8e81f06.zip
Order working
Diffstat (limited to 'admin.php')
-rw-r--r--admin.php26
1 files changed, 23 insertions, 3 deletions
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;
+ }
+ }
+}
+
?>
<!doctype html>
@@ -59,7 +79,7 @@ $orders = $result->fetch_all(MYSQLI_ASSOC);
<tr><th>user</th><th>type</th><th>status</th></tr>
<?php
foreach ($users as $user) {
- echo "<tr><td>".$user['username']."</td><td>".$user['type']."</td><td>".$user['status']."</tr>\n";
+ echo "<tr><td>".$user["username"]."</td><td>".$user["type"]."</td><td>".$user["status"]."</tr>\n";
}
?>
</table>
@@ -70,7 +90,7 @@ $orders = $result->fetch_all(MYSQLI_ASSOC);
<tr><th>name</th><th>type</th><th>billing</th></tr>
<?php
foreach ($services as $service) {
- echo "<tr><td>".$service['name']."</td><td>".$service['type']."</td><td>".$service['billing']."</tr>\n";
+ echo "<tr><td>".$service["name"]."</td><td>".$service["type"]."</td><td>".$service["billing"]."</tr>\n";
}
?>
</table>
@@ -81,7 +101,7 @@ $orders = $result->fetch_all(MYSQLI_ASSOC);
<tr><th>service</th><th>instance</th><th>client</th></tr>
<?php
foreach ($orders as $order) {
- echo "<tr><td>".$order['service']."</td><td>".$order['name']."</td><td>".$order['client']."</tr>\n";
+ echo "<tr><td>".getservicebyid($order["service"])["name"]."</td><td>".$order["name"]."</td><td>".getclientbyid($order["client"])["username"]."</tr>\n";
}
?>
</table>