Auto commit: 2026-02-14T16:04:13.421Z
This commit is contained in:
parent
3cfa9f0a7e
commit
7060efbbb4
90
admin.php
Normal file
90
admin.php
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
<?php
|
||||||
|
require_once __DIR__ . '/db/config.php';
|
||||||
|
|
||||||
|
$secret_token = 'lili_admin_2026';
|
||||||
|
if (($_GET['token'] ?? '') !== $secret_token) {
|
||||||
|
die('Acceso denegado. Se requiere un token válido.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$db = db();
|
||||||
|
|
||||||
|
// Get active users (last 10 minutes)
|
||||||
|
$stmt = $db->query("SELECT COUNT(*) FROM visitor_logs WHERE last_activity > DATE_SUB(NOW(), INTERVAL 10 MINUTE)");
|
||||||
|
$active_users = $stmt->fetchColumn();
|
||||||
|
|
||||||
|
// Get country distribution for active users
|
||||||
|
$stmt = $db->query("SELECT country, country_code, lat, lon, COUNT(*) as count FROM visitor_logs WHERE last_activity > DATE_SUB(NOW(), INTERVAL 10 MINUTE) GROUP BY country_code");
|
||||||
|
$locations = $stmt->fetchAll();
|
||||||
|
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="es">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="refresh" content="30">
|
||||||
|
<title>Admin Dashboard - Lili Records</title>
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css">
|
||||||
|
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
|
||||||
|
<style>
|
||||||
|
body { background: #0f172a; color: white; font-family: 'Inter', sans-serif; }
|
||||||
|
.card { background: rgba(30, 41, 59, 0.7); border: 1px solid rgba(255,255,255,0.1); color: white; backdrop-filter: blur(10px); }
|
||||||
|
#map { height: 500px; border-radius: 15px; margin-top: 20px; }
|
||||||
|
.stat-value { font-size: 3rem; font-weight: bold; color: #00e676; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container py-5">
|
||||||
|
<div class="row mb-4">
|
||||||
|
<div class="col-md-12 text-center">
|
||||||
|
<h1>Panel de Administración Real-Time</h1>
|
||||||
|
<p class="text-secondary">Lili Records Radio Statistics</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="card p-4 text-center">
|
||||||
|
<h5>Usuarios Conectados</h5>
|
||||||
|
<div class="stat-value"><?= $active_users ?></div>
|
||||||
|
<p class="text-secondary">En los últimos 10 minutos</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card p-4 mt-4">
|
||||||
|
<h5>Distribución por País</h5>
|
||||||
|
<ul class="list-group list-group-flush bg-transparent">
|
||||||
|
<?php foreach ($locations as $loc): ?>
|
||||||
|
<li class="list-group-item bg-transparent text-white border-secondary d-flex justify-content-between">
|
||||||
|
<span><?= htmlspecialchars($loc['country']) ?></span>
|
||||||
|
<span class="badge bg-primary"><?= $loc['count'] ?></span>
|
||||||
|
</li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-8">
|
||||||
|
<div class="card p-3">
|
||||||
|
<h5>Mapa de Conexiones</h5>
|
||||||
|
<div id="map"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
|
||||||
|
<script>
|
||||||
|
const map = L.map('map').setView([20, 0], 2);
|
||||||
|
L.tileLayer('https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png', {
|
||||||
|
attribution: '© OpenStreetMap contributors'
|
||||||
|
}).addTo(map);
|
||||||
|
|
||||||
|
const locations = <?= json_encode($locations) ?>;
|
||||||
|
locations.forEach(loc => {
|
||||||
|
if (loc.lat && loc.lon) {
|
||||||
|
L.marker([loc.lat, loc.lon])
|
||||||
|
.addTo(map)
|
||||||
|
.bindPopup(`<b>${loc.country}</b><br>${loc.count} usuario(s)`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@ -6,7 +6,10 @@ function track_visitor() {
|
|||||||
session_start();
|
session_start();
|
||||||
}
|
}
|
||||||
|
|
||||||
$ip = $_SERVER['REMOTE_ADDR'];
|
$ip = $_SERVER['HTTP_CF_CONNECTING_IP'] ?? $_SERVER['HTTP_X_FORWARDED_FOR'] ?? $_SERVER['REMOTE_ADDR'];
|
||||||
|
// X-Forwarded-For can be a comma-separated list
|
||||||
|
$ip = explode(',', $ip)[0];
|
||||||
|
|
||||||
$session_id = session_id();
|
$session_id = session_id();
|
||||||
$db = db();
|
$db = db();
|
||||||
|
|
||||||
|
|||||||
41
index.php
41
index.php
@ -394,7 +394,6 @@ $whatsapp_link = "https://wa.me/" . preg_replace('/[^0-9]/', '', $whatsapp_numbe
|
|||||||
<div class="track-info">
|
<div class="track-info">
|
||||||
<div class="track-status">EN VIVO</div>
|
<div class="track-status">EN VIVO</div>
|
||||||
<div id="track-title" class="track-title">Cargando stream...</div>
|
<div id="track-title" class="track-title">Cargando stream...</div>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
@ -402,35 +401,35 @@ $whatsapp_link = "https://wa.me/" . preg_replace('/[^0-9]/', '', $whatsapp_numbe
|
|||||||
<i id="play-icon" class="bi bi-play-fill"></i>
|
<i id="play-icon" class="bi bi-play-fill"></i>
|
||||||
</button>
|
</button>
|
||||||
<i class="bi bi-volume-up"></i>
|
<i class="bi bi-volume-up"></i>
|
||||||
<input type="range" class="volume-slider" id="volume" min="0" max="1" step="0.1" value="0.8" oninput="changeVolume(this.value)">
|
<input type="range" class="volume-slider" min="0" max="1" step="0.01" value="1" oninput="changeVolume(this.value)">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Interaction Form -->
|
<div class="interaction-form">
|
||||||
<div class="interaction-form">
|
<label for="user-name">TU NOMBRE</label>
|
||||||
<label>Tu Nombre</label>
|
<input type="text" id="user-name" placeholder="Ej: Juan Pérez">
|
||||||
<input type="text" id="user-name" placeholder="Ej. Juan Pérez">
|
|
||||||
|
|
||||||
<label>Tu Mensaje / Pedido Musical</label>
|
<label for="user-message">TU MENSAJE / PEDIDO</label>
|
||||||
<textarea id="user-message" placeholder="Escribe aquí lo que quieras decirnos..."></textarea>
|
<textarea id="user-message" placeholder="Escribe aquí tu saludo o canción favorita..."></textarea>
|
||||||
|
|
||||||
<button class="send-whatsapp-btn" onclick="sendToWhatsApp()">
|
<button class="send-whatsapp-btn" onclick="sendToWhatsApp()">
|
||||||
<i class="bi bi-whatsapp"></i> Enviar al WhatsApp
|
<i class="bi bi-whatsapp"></i> ENVIAR AL WHATSAPP
|
||||||
</button>
|
</button>
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Payment / Support Section -->
|
|
||||||
<div class="payment-section">
|
|
||||||
<p class="small">Apoya nuestro proyecto</p>
|
|
||||||
<div class="qr-placeholder">
|
|
||||||
<i class="bi bi-qr-code"></i>
|
|
||||||
<span>Transfermóvil</span>
|
|
||||||
</div>
|
</div>
|
||||||
<p style="font-size: 0.7rem; opacity: 0.6;">Escanea para donar</p>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<?php if (isset($_GET['admin']) && $_GET['admin'] === '1'): ?>
|
||||||
|
<!-- Admin Real-Time Stats (Only visible with ?admin=1) -->
|
||||||
|
<div class="glass-card mt-4" style="margin-top: 2rem;">
|
||||||
|
<h3 style="font-size: 1.2rem; margin-bottom: 1rem; color: var(--accent-color);">
|
||||||
|
<i class="bi bi-shield-lock"></i> Panel Admin Real-Time
|
||||||
|
</h3>
|
||||||
|
<iframe src="admin.php?token=lili_admin_2026" style="width: 100%; height: 400px; border: none; border-radius: 12px; background: rgba(0,0,0,0.2);"></iframe>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|
||||||
<!-- Right Section: Featured Image -->
|
<!-- Right Section: Featured Image -->
|
||||||
<section class="image-section">
|
<section class="image-section">
|
||||||
<div class="featured-img-container">
|
<div class="featured-img-container">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user