<?php
$db = new PDO('sqlite:app_feed.db');

// Handle Global Limit Update
if (isset($_POST['set_global'])) {
    $db->exec("INSERT OR REPLACE INTO settings (key, value) VALUES ('global_limit', '" . floatval($_POST['global_limit']) . "')");
}

// Handle Individual User Limit Update
if (isset($_POST['set_user_limit'])) {
    $stmt = $db->prepare("UPDATE users SET min_withdrawal = ? WHERE id = ?");
    $stmt->execute([floatval($_POST['user_limit']), $_POST['user_id']]);
}
?>