<?php
require_once '../../includes/config.php';
requireAdmin();
$db = getDB();
$uid = intval($_GET['user_id'] ?? 0);
if(!$uid) { echo json_encode([]); exit; }
$txns = $db->prepare("SELECT t.*, o.name as op_name FROM transactions t LEFT JOIN operators o ON t.operator_id=o.id WHERE t.user_id=? ORDER BY t.created_at DESC LIMIT 50");
$txns->execute([$uid]);
header('Content-Type: application/json');
echo json_encode($txns->fetchAll(PDO::FETCH_ASSOC));
