hi migos I have a login system which when it should expire because I pass it to another page that does not have session start does not expire. that is, it always keeps me full session variables and it is not what I want I leave the code. When I refresh the index page or I want to reach it through the browser, the message of the condition continues to appear, as if the session varials were full. Thanks
In the login.php file I have this:
session_start();
require_once("conexion.php");
$contra = $_POST['contra'];
$email = $_POST['mail'];
$consulogin = "select * from usuario
where email = '{$email}'
and contrasena='{$contra}' ";
$res = $lnk->query($consulogin);
$numeroderegistros = $res->num_rows;
$fila = $res->fetch_object();
if($numeroderegistros==1){
if($fila->nivel==0){
$_SESSION['sesion']=0;
} else {
$_SESSION['sesion']=1;
$_SESSION['nombre']=$fila->nick;
header('location:index.php');
}
} else {
header('location:index.php');
}
And in the index.php file I have this:
if(isset($_SESSION['sesion']) && $_SESSION['sesion']==true ){
echo "hola ".$_SESSION['nombre']." bienvenido";*/
} else { ?>
<form id="login" method="post" action="login.php" ><br>
Email: <br>
<input type="email" name="mail" ><br>
Contraseña: <br>
<input type="password" name="contra" autocomplete="new-password"><br>
<input type="submit" value="Submit">
</form>
<?php } ?>
</div>