I'm trying to use the code below for when the user clicks exit, it is redirected to the file below to destroy the session, however after the destroyed session it can not log in again because the following page after login does not loads, only the name of the next page appears in the address bar.
Page that contains the login functions:
session_start();
$_SESSION['usuariosession'] = $user;
$_SESSION['senhasession'] = $pass;
$_SESSION['autenticandosession'] = true;
header('Location:views/painel.php/');
Next page after login:
session_start();
if(!isset($_SESSION['autenticandosession']) || $_SESSION['autenticandosession'] != true){
echo "Acesso não autorizado </br>";
echo "Por favor faça seu login <a href='login.php'> clicando aqui </a>";
exit();
}else{
echo "<p> Bem vindo ".ucfirst($_SESSION['usuariosession'])."</p> </br>";
}
<html>
<head>
<title> Painel </title>
</head>
<body>
<h1> Olá eu sou o painel, se voce chegou até aqui é porque suas credenciais deram certo... </h1>
<a href="../sair.php"> Sair </a>
</body>
</html>
Page with the function to exit:
session_start();
unset ($_SESSION['usuariosession']);
unset ($_SESSION['senhasession']);
session_destroy();
header('Location:views/login.php/');