I'm creating a small site, but when I press to exit, the site shifts, but if I put the link on one of the pages, I can enter the system and it does not check if it was logged in, even with security fields
Login.php:
<div class="login">
<div class="row">
<div class="col-sm-5 texto-capa">
<form method="POST" action="validalogin.php">
<img class="mb-4" src="imagens/icon/android-icon-72x72.png" alt="" width="72" height="72">
<h3>Área de Login</h3>
<div class="form-group">
<label>E-mail</label>
<input type="text" class="form-control" id="login" name="login" placeholder="Digite seu e-mail..." />
</div>
<div class="form-group">
<label>Senha</label>
<input type="password" class="form-control" id="senha" name="senha" placeholder="Digite sua senha..."/>
</div>
<div class="checkbox mb-3">
<label>
<input type="checkbox" value="remember-me"> Relembre-me
</label>
</div>
<button type="submit" class="btn btn-entrar"><b>ENTRAR</b></button><br>
<p class="mt-5 mb-3 text-muted">© 2018</p>
</form>
<p class="text-center text-danger">
<?php
if(isset($_SESSION['security'])){
echo $_SESSION['security'];
unset($_SESSION['security']);
}
?>
</p>
</div>
</div>
</div>
Security.php
<?php
ob_start();
if($_SESSION['login'] == null || $_SESSION['id'] == null){
$_SESSION['security'] = "Efetue o Login!";
header("Location: login.php");
}
?>
Close.php
<?php
unset($_SESSION['login'], $_SESSION['id'], $_SESSION['usuario']);
session_destroy();
header("Location: login.php");
?>