<?php
require_once __DIR__ . '/../src/bootstrap.php';
require_once __DIR__ . '/../src/functions.php';

if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
    redirect('index.php');
}

try {
    $pdo = db();
    deleteAllCampaigns($pdo);
    flash('Tüm kampanyalar silindi.');
    redirect('index.php');
} catch (\Throwable $e) {
    flash('Hata: ' . $e->getMessage(), 'error');
    redirect('index.php');
}
