Mini Kabibi Habibi
<?php
session_start();
include 'includes/db.php';
if (!isset($_SESSION['user_id']) || $_SESSION['role'] !== 'admin') {
header("Location: login.php");
exit();
}
if (isset($_GET['id']) && is_numeric($_GET['id'])) {
$id = (int)$_GET['id'];
// Delete the supply
$stmt = $pdo->prepare("DELETE FROM medical_supplies WHERE id = ?");
$stmt->execute([$id]);
// Redirect back to the list page
header("Location: " . $_SERVER['HTTP_REFERER']);
exit();
} else {
// Invalid ID or missing
header("Location: current_stock.php");
exit();
}