<?php  
include 'koneksi.php';
session_start();
if (!isset($_SESSION['login_admin'])) {
    header('Location: dashboard.php');
    exit;
}

if (isset($_GET['id_post'])) {
    $id = intval($_GET['id_post']);
    $query = "DELETE FROM tb_post WHERE id_post = $id";
    if (mysqli_query($host, $query)) {
        echo "<script>alert('Galeri berhasil dihapus!'); window.location.href='manage_galeri.php';</script>";
    } else {
        echo "<script>alert('Error: " . mysqli_error($host) . "');</script>";
    }
} else {
    echo "<script>alert('ID galeri tidak ditemukan!'); window.location.href='manage_galeri.php';</script>";
}
?>
