0
I have the following code on a user page:
public static function destruirSessao() {
if (isset($_SESSION)) {
session_start();
unset($_SESSION["codigo"]);
unset($_SESSION["nome"]);
session_destroy();
}
}
on the index.php page:
if (!thread::getUsuarioAtivo()) {
header("location: login.php");
} else {
?>
Código HTML/ conteúdo da página
<?php } ?>
Even defining Session_destroy, it still remains,e, so I’m able to type in the url: index.php and log in to the last person’s session, how can I fix it? there is some logic error in the code?
The Logout link is this on the index page:
<a href="endSess.php?act=logout" ></a>
calling another page that logout, that logout page has the code
$verif = $_GET['act'];
if ($verif == "logout") {
thread::destruirSessao();
header('Location: login.php');
}
Wow, where are you calling to destroy session?
– gabrielfalieri
Oh yes, there is a button on the Index page that calls a php page that is logout, and has the thread::destroy codigo();
– Froslass
Put the code of this button please?
– gabrielfalieri
Edit your question so it’s easier
– gabrielfalieri
That was it, I gave a session_start(); in the function to destroy Sesame(); and it worked :D, Thank you! Gabriel Carvalho! and the other Gabriel Falieri too! : D
– Froslass