Doubt in the logoff in php

Asked

Viewed 46 times

0

Would anyone have any idea why even by destroying the session that stores a logged-in user on the site, when accessing url directly shown as if the user remained logged in, even after the call from session_destroy();?

index

<li class="nav-item">                       
<a class="nav-link" rel="tooltip" title="Sair" data-placement="bottom" href="pag-login.php" target="_self">

<i class="fas fa-sign-out-alt"></i>

<?php echo $_SESSION['email'];?>

// CHAMADA DO ARQUIVO QUE DESTROY AS SESSION:
<a href="sair.php"></a>

</li>  

quit php.

<?php

session_start();

unset(
    $_SESSION['email'],

    $_SESSION['id'],
    $_SESSION['tipo_user'],
    $_SESSION['nao_autenticado']);
session_destroy();

header('Location: pag-login.php');
exit();
  • what do you mean "is shown as if the user has remained logged in"? The information you have saved is still showing up?

  • Exactly that right there!

  • Bianca tries to do so $_SESSION = array(); in place of unset

  • What is the test you do to see if the user is logged in or not on each page?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.