<?php
include 'auth.php';
require_once '../config/db.php';

$id = (int)$_GET['id'];
$table = $_GET['table'] ?? '';
$return = $_GET['return'] ?? 'local-tours.php';

$allowed = ['package_gallery', 'local_tour_gallery'];
if (!in_array($table, $allowed)) {
    die("Invalid table");
}

$conn->query("DELETE FROM $table WHERE id = $id");
header("Location: $return");
exit();
