turnero/configuracion: mostrar IP actual del cliente en sección dispositivos

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-07-09 10:27:47 -05:00
co-authored by Claude Sonnet 4.6
parent 9afadb9a6f
commit f5b38a331e
+10
View File
@@ -15,6 +15,8 @@ if (!isUserLoggedIn()) { header('Location: ' . BASE_URL . 'login.php'); exit; }
$db = Database::getInstance();
$pdo = $db->getConnection();
$_myIp = trim(explode(',', $_SERVER['HTTP_X_FORWARDED_FOR'] ?? $_SERVER['HTTP_X_REAL_IP'] ?? $_SERVER['REMOTE_ADDR'] ?? '')[0]);
// ── Cargar datos para los tabs (con fallback para tablas aún no migradas) ──
$lugares = [];
$prioridades = [];
@@ -527,6 +529,14 @@ $tab = $_GET['tab'] ?? 'lugares';
</table>
</div>
<div class="alert alert-info py-2 px-3 mb-3 d-flex align-items-center gap-2" style="font-size:.85rem">
<i class="fas fa-wifi"></i>
Tu IP actual: <code class="ms-1"><?= htmlspecialchars($_myIp) ?></code>
<button class="btn btn-sm btn-outline-primary ms-2 py-0" onclick="document.getElementById('dv-ip').value='<?= htmlspecialchars($_myIp) ?>';document.getElementById('dv-ip').focus()">
Usar esta IP
</button>
</div>
<div class="form-add p-3" style="background:#f8fafc;border-radius:10px;border:1px solid #e2e8f0">
<p class="section-title mb-3"><i class="fas fa-plus me-1"></i>Agregar dispositivo</p>
<div class="row g-2 align-items-end">