37301-vm/admin/delete_product.php
Flatlogic Bot 9bf0056520 test
2026-01-07 09:28:17 +00:00

21 lines
447 B
PHP

<?php
session_start();
require_once __DIR__ . '/../db/config.php';
// Check if user is logged in
if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== true) {
header('Location: index.php');
exit;
}
if (!isset($_GET['id'])) {
die('Product ID not specified.');
}
$pdo = db();
$stmt = $pdo->prepare('DELETE FROM products WHERE id = ?');
$stmt->execute([$_GET['id']]);
header('Location: products.php?status=deleted');
exit;
?>