Initial production backup
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/auth.php';
|
||||
requireLogin();
|
||||
|
||||
$db = getDB();
|
||||
$postId = intval($_GET['id'] ?? 0);
|
||||
|
||||
if ($postId > 0) {
|
||||
// Verify post exists
|
||||
$stmt = $db->prepare("SELECT id, cover_image FROM blog_posts WHERE id = :id LIMIT 1");
|
||||
$stmt->execute([':id' => $postId]);
|
||||
$post = $stmt->fetch();
|
||||
|
||||
if ($post) {
|
||||
// Delete post
|
||||
$stmt = $db->prepare("DELETE FROM blog_posts WHERE id = :id");
|
||||
$stmt->execute([':id' => $postId]);
|
||||
$_SESSION['flash'] = 'Artículo eliminado correctamente.';
|
||||
}
|
||||
}
|
||||
|
||||
header('Location: ' . BLOG_URL . '/admin/');
|
||||
exit;
|
||||
Reference in New Issue
Block a user