<?php
require_once __DIR__ . '/../includes/config.php';
if (file_exists(__DIR__ . '/../includes/auth.php')) {
    require_once __DIR__ . '/../includes/auth.php';
}
require_once __DIR__ . '/functions.php';

if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
    sett_redirect('list.php?msg=' . urlencode('الطلب غير مسموح'));
}

$id = (int)($_POST['id'] ?? 0);
if ($id < 1) {
    sett_redirect('list.php?msg=' . urlencode('معرّف الإعداد غير صحيح'));
}

$delete = sett_delete_setting($id);
sett_redirect('list.php?msg=' . urlencode($delete['message']));
