From 3ca10395b5609cfaae0e61b6b59716a6936bcbf2 Mon Sep 17 00:00:00 2001 From: Andrea Fiorencis Date: Wed, 8 Apr 2026 11:48:50 +0200 Subject: [PATCH] Creata dashboard amministratore --- src/admin/index.php | 76 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 src/admin/index.php diff --git a/src/admin/index.php b/src/admin/index.php new file mode 100644 index 0000000..9d2829e --- /dev/null +++ b/src/admin/index.php @@ -0,0 +1,76 @@ +prepare($sql_role); +$stmt_role->bind_param("i", $user_id); +$stmt_role->execute(); +$stmt_role->bind_result($role); +$stmt_role->fetch(); +$stmt_role->close(); + +if ($role !== 'admin') { + http_response_code(403); + die("Accesso negato. Solo gli amministratori possono accedere a questa sezione."); +} + +// Query per ottenere tutti i prodotti +$sql = "SELECT p.ProductID, p.ProductName, c.Name AS 'CategoryName', p.Description, p.Price, p.StockQuantity, p.ImagePath FROM Products p JOIN Categories c ON p.CategoryID=c.CategoryID"; +$result = $conn->query($sql); + +if ($result === false) { + die("Errore nella query: " . $conn->error); +} +?> + + + + + + + Dashboard amministratore - TechStore + + + + +
+ +
+ + + + Benvenuto, + + + +
+
+ + +
+ +
+

Hello World!

+

+
+ + + + + close(); ?> + +