36952-vm/delete_payment.php
Flatlogic Bot 76d7d99142 PMS 1
2025-12-15 01:31:18 +00:00

27 lines
535 B
PHP

<?php
require_once 'session.php';
check_admin();
require_once 'db/config.php';
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
http_response_code(405);
die('Method Not Allowed');
}
$id = $_POST['id'] ?? null;
if (!$id) {
header("Location: index.php?page=payments&error=1");
exit;
}
$db = db();
$stmt = $db->prepare("DELETE FROM payments WHERE id = ?");
if ($stmt->execute([$id])) {
header("Location: index.php?page=payments&success=3");
} else {
header("Location: index.php?page=payments&error=2");
}
exit;
?>