<?php
require_once __DIR__.'/_auth.php';$admin=afAdminApiUser($pdo);$q=sanitize($_GET['q']??'');$limit=max(1,min(100,(int)($_GET['limit']??30)));$params=[];$where='1=1';if($q!==''){$where='(nome LIKE ? OR username LIKE ? OR email LIKE ? OR aura_id LIKE ?)';$like='%'.$q.'%';$params=[$like,$like,$like,$like];}$st=$pdo->prepare("SELECT id,nome,username,email,aura_id,papel,status,seguranca_status,risco_conta,nivel,melhor_pontuacao,total_partidas,data_cadastro FROM af_usuarios WHERE {$where} ORDER BY id DESC LIMIT {$limit}");$st->execute($params);jsonResponse(['ok'=>true,'usuarios'=>$st->fetchAll()]);
