<?php
require_once '/home12/fiberule/public_html/kartikthanaweddingdinner/config/db.php';

if (!isset($_GET['type'], $_GET['id'])) {
    die("Invalid request");
}

$id = (int)$_GET['id'];
$type = $_GET['type'];

if ($type === 'rsvp') {
    $stmt = $pdo->prepare("DELETE FROM rsvps WHERE id = ?");
    $stmt->execute([$id]);
}

if ($type === 'wish') {
    $stmt = $pdo->prepare("DELETE FROM wishes WHERE id = ?");
    $stmt->execute([$id]);
}

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