Add database info to navbar dropdown
This commit is contained in:
@@ -3,6 +3,9 @@ require_once __DIR__ . '/../../src/Auth.php';
|
||||
$auth = new Auth();
|
||||
$user = $auth->getCurrentUser();
|
||||
$currentPage = $currentPage ?? '';
|
||||
|
||||
$dbHost = getenv('DB_HOST') ?: 'No configurado';
|
||||
$dbName = getenv('DB_NAME') ?: 'No configurado';
|
||||
?>
|
||||
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
|
||||
<div class="container">
|
||||
@@ -37,8 +40,11 @@ $currentPage = $currentPage ?? '';
|
||||
<?= htmlspecialchars($user['nombre'] ?? 'Usuario') ?>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><span class="dropdown-item-text"><strong>Usuario:</strong> <?= htmlspecialchars($user['nombre'] ?? 'Usuario') ?></span></li>
|
||||
<li><span class="dropdown-item-text"><strong>Rol:</strong> <?= htmlspecialchars(ucfirst($user['rol'] ?? '')) ?></span></li>
|
||||
<li><hr class="dropdown-divider"></li>
|
||||
<li><span class="dropdown-item-text small text-muted"><strong>DB:</strong> <?= htmlspecialchars($dbHost) ?>/<?= htmlspecialchars($dbName) ?></span></li>
|
||||
<li><hr class="dropdown-divider"></li>
|
||||
<li><a class="dropdown-item" href="/logout.php">Cerrar Sesión</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
Reference in New Issue
Block a user