<?php
require_once __DIR__ . '/../../config/session.php';
require_once __DIR__ . '/../../config/db.php';
require_once __DIR__ . '/../../config/response.php';
require_login();
$raw = json_decode(file_get_contents('php://input'), true);
$id = (int)($raw['id'] ?? 0);
$status = $raw['status'] === 'active' ? 'active' : 'inactive';
$pdo->prepare("UPDATE users SET status = ? WHERE id = ?")->execute([$status, $id]);
jsonResponse(['success' => true]);