<?php
session_start();
require_once("../config.php");

if (!isset($_SESSION['admin_login'])) {
    header("Location: ../index.php");
    exit();
}

$id = $_GET['id'] ?? 0;

if ($id) {
    $stmt = $conn->prepare("DELETE FROM news WHERE id=?");
    $stmt->bind_param("i", $id);
    $stmt->execute();
}

header("Location: dashboard.php");
exit();