I have a system of logueados users, when they leave the session (logout.php) the div of My user account does not disappear.
The idea is that if you logout, the login and registration buttons will be displayed. I have tried with an elseif to indicate that if the session does not exist do this:
elseif (! isset ($ _ SESSION ["user_id"])) {? >
Login
But the problem is that it remains in the code of the first if, in which the div is shown with the user menu, and always shows it whether or not it is logged. Does anyone know what happens?
COMPLETE CODE;
enter the code here
<?php if($status = 'Active' or $status = 'Canceled') { ?>
<nav style="width:15%;left:85%;top:-10px;" class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
</div>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown"><a class="dropdown-toggle" data-toggle="dropdown" href="#"><?php $row['nombre']; ?> <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Suscripción</a></li>
<li><a href="../login/logout.php"><span class="glyphicon glyphicon-log-out"></span> Salir</a></li>
</ul>
</li>
<ul class="nav navbar-nav navbar-right">
<li><a href="#"><span class="glyphicon glyphicon-log-out"></span></a></li>
</ul>
</ul>
</div>
</nav>
<?php }
elseif(!isset($_SESSION["id_usuario"])){ ?>
<button style="float:left;margin:3px;" type="button" class="btn btn-success navbar-right"><span class="glyphicon glyphicon-lock"></span> Login</button>
<button style="margin:3px;" type="button" class="btn btn-warning navbar-right"><span class="glyphicon glyphicon-user"></span> Suscribirse</button>
<?php }
else { ?>
<button style="float:left;margin:3px;" type="button" class="btn btn-success navbar-right"><span class="glyphicon glyphicon-lock"></span> Login</button>
<button style="margin:3px;" type="button" class="btn btn-warning navbar-right"><span class="glyphicon glyphicon-user"></span> Suscribirse</button>
<?php }
?>