<?php
require_once __DIR__ . '/config/config.php';

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $userId = intval($_POST['user_id']);
    $fullName = trim($_POST['full_name']);
    $email = trim($_POST['email']);
    $status = trim($_POST['account_status']);

    $stmt = $conn->prepare("UPDATE users SET full_name = ?, email = ?, account_status = ? WHERE id = ?");
    $stmt->bind_param("sssi", $fullName, $email, $status, $userId);
    $stmt->execute();

    echo json_encode(['success' => true, 'message' => 'User updated successfully.']);
}
