false, 'ERROR' => 'method_not_allowed'], 405); } $address = trim($_GET['Address'] ?? ''); $id = (int) ($_GET['ID'] ?? 0); if ($address === '' && $id <= 0) { jsonResponse(['OK' => false, 'ERROR' => 'address_or_id_required']); } $agent = null; if ($address !== '') { $agent = queryOne("SELECT * FROM Sprinter_Agents WHERE FullAddress = ?", [$address]); } else { $agent = queryOne("SELECT * FROM Sprinter_Agents WHERE ID = ?", [$id]); } if (!$agent) jsonResponse(['OK' => false, 'ERROR' => 'user_not_found']); jsonResponse([ 'OK' => true, 'User' => [ 'ID' => (int) $agent['ID'], 'AgentName' => $agent['AgentName'], 'FullAddress' => $agent['FullAddress'], 'ProjectName' => $agent['ProjectName'], 'AgentType' => $agent['AgentType'], 'Role' => $agent['Role'], 'ServerHost' => $agent['ServerHost'], 'IsActive' => (bool) $agent['IsActive'], 'CreatedAt' => toISO8601($agent['CreatedAt']), ], ]);