27 lines
535 B
PHP
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;
|
|
?>
|