blog+contacto php listo

This commit is contained in:
2026-09-20 13:28:57 -03:00
parent cd67fca3dc
commit cfb97b486e
24 changed files with 8970 additions and 165 deletions
+29
View File
@@ -0,0 +1,29 @@
<?php
require_once '../config/db.php';
require_once 'auth.php';
verificarAuth();
if (!isset($_GET['id'])) {
header('Location: dashboard.php');
exit;
}
// Obtener el artículo para borrar la imagen
$stmt = $pdo->prepare("SELECT imagen FROM blog_posts WHERE id = ?");
$stmt->execute([$_GET['id']]);
$post = $stmt->fetch();
if ($post && $post['imagen']) {
$ruta_imagen = '../' . $post['imagen'];
if (file_exists($ruta_imagen)) {
unlink($ruta_imagen);
}
}
// Eliminar el artículo
$stmt = $pdo->prepare("DELETE FROM blog_posts WHERE id = ?");
$stmt->execute([$_GET['id']]);
header('Location: dashboard.php');
exit;
?>