35512-vm/delete-asset.php
2025-11-05 22:26:48 +00:00

25 lines
477 B
PHP

<?php
require_once 'db/config.php';
require_once 'auth-check.php';
if (!isset($_GET['id']) || !is_numeric($_GET['id'])) {
header("Location: index.php");
exit;
}
$asset_id = $_GET['id'];
try {
$pdo = db();
$stmt = $pdo->prepare("DELETE FROM assets WHERE id = ?");
$stmt->execute([$asset_id]);
header("Location: index.php?success=asset_deleted");
exit;
} catch (PDOException $e) {
header("Location: index.php?error=db_error");
exit;
}
?>