Log out and refresh page

Asked

Viewed 281 times

0

I am editing a user panel, with login among others.
But I have a question, when I click QUIT (the logout of the page), I would need it to update the page besides leaving the user account, I tried incrementing several refresh and Reload codes but none worked

This is the code that appears in the index

<tr>
    <td><a href="javascript: void(0);" onclick="loading(\'?go=painel&deslogar=true\', \'painel\');">SAIR</a></td>
  </tr>

This is the code

    if($_GET["deslogar"] == true) {
    session_destroy();
    header("location: ?go=painel&painel=true;");
}
  • Put a . / before the redirect address. Example: . /? go=panel*panel=true, or enter the full redirect address, including http or https protocol.

1 answer

1

Try something like that:

<a href='session_destroy.php'>Sair</a>

And on the Session page put the value you’re comparing as string:

if($_GET["deslogar"] == "true") {
    session_destroy();
    header("location: caminho/para/minha/outra/pagina.php;");
}

I believe that true without quotes is being understood as 1 because php derives from C and in C there is no boolean type (true and false), only int (1 and 0). When you take an agrumeto via GET it is a string. So you are comparing a string "true" with an int 1.

Browser other questions tagged

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