I have a system that I use to validate the session. For validation use the code below:
<?php
session_start();
public function validaUsuarios($loginUsuario,$senhaUsuario){
.......
$_SESSION['logado'] = true;
header('location: entrar.php');
......
?>
And on the enter.php page:
<?php
session_start();
if($_SESSION['logado'] == false || $_SESSION['logado'] == ''){
header('location: index.php');
}else{
...........
What I do not understand is that on other servers it worked perfectly, but on that server it does not catch up at first, that is, when giving a print, nothing happens in the session.