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); +} +?> + + + +
+ + +