query("SELECT juego_id, nombre FROM juegos_config ORDER BY juego_id ASC"); return $res->fetch_all(MYSQLI_ASSOC); } $juegos = all_juegos($conn); $juego_id = (int)($_GET['juego_id'] ?? 0); $q = trim($_GET['q'] ?? ''); // buscar por IP o UA $desde = $_GET['desde'] ?? ''; $hasta = $_GET['hasta'] ?? ''; $where = "1=1"; $types=""; $params=[]; if ($juego_id) { $where.=" AND jm.juego_id=?"; $types.="i"; $params[]=$juego_id; } if ($q!=='') { $where.=" AND (jm.ip_address LIKE CONCAT('%',?,'%') OR jm.user_agent LIKE CONCAT('%',?,'%'))"; $types.="ss"; $params[]=$q; $params[]=$q; } if ($desde!==''){ $where.=" AND jm.fecha_juego >= ?"; $types.="s"; $params[]=$desde." 00:00:00"; } if ($hasta!==''){ $where.=" AND jm.fecha_juego <= ?"; $types.="s"; $params[]=$hasta." 23:59:59"; } // Export CSV if (($_GET['export'] ?? '') === 'csv') { header('Content-Type: text/csv; charset=utf-8'); header('Content-Disposition: attachment; filename=jugadas_memoria.csv'); $out=fopen('php://output','w'); fputcsv($out,['ID','Fecha','Juego','Juego ID','Aciertos','Tiempo (ms)','IP','User Agent']); $sql="SELECT jm.id, jm.fecha_juego, gc.nombre AS juego, jm.juego_id, jm.aciertos, jm.tiempo_ms, jm.ip_address, jm.user_agent FROM jugadas_memoria jm LEFT JOIN juegos_config gc ON gc.juego_id=jm.juego_id WHERE $where ORDER BY jm.id DESC"; $stmt=$conn->prepare($sql); if($types){ $stmt->bind_param($types, ...$params); } $stmt->execute(); $res=$stmt->get_result(); while($r=$res->fetch_assoc()){ fputcsv($out, [$r['id'],$r['fecha_juego'],$r['juego'],$r['juego_id'],$r['aciertos'],$r['tiempo_ms'],$r['ip_address'],$r['user_agent']]); } fclose($out); exit; } // Paginación $page=max(1,(int)($_GET['page']??1)); $pp=25; $off=($page-1)*$pp; $sqlCount="SELECT COUNT(*) c FROM jugadas_memoria jm LEFT JOIN juegos_config gc ON gc.juego_id=jm.juego_id WHERE $where"; $stmt=$conn->prepare($sqlCount); if($types){ $stmt->bind_param($types, ...$params); } $stmt->execute(); $total=(int)$stmt->get_result()->fetch_assoc()['c']; $sql="SELECT jm.id, jm.fecha_juego, gc.nombre AS juego, jm.juego_id, jm.aciertos, jm.tiempo_ms, jm.ip_address, jm.user_agent FROM jugadas_memoria jm LEFT JOIN juegos_config gc ON gc.juego_id=jm.juego_id WHERE $where ORDER BY jm.id DESC LIMIT $pp OFFSET $off"; $stmt=$conn->prepare($sql); if($types){ $stmt->bind_param($types, ...$params); } $stmt->execute(); $rows=$stmt->get_result()->fetch_all(MYSQLI_ASSOC); $pages=(int)ceil($total/$pp); ?> Memoria | Jugadas

Jugadas — Memoria

Limpiar
IDFechaJuegoJuego IDAciertosTiempo (s)IPUser Agent
Sin registros
1): ?>