Log out and refresh page

0

I am editing a user panel, with login among others. But I have a question, when I click on EXIT (the logout of the page), I would need it to refresh the page besides leaving the user account, I already tried to increment 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;");
}
    
asked by anonymous 26.03.2016 / 22:49

1 answer

1

Try something like this:

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

And in the page of session destroy put the value you are comparing as string:

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

I believe that true without the quotation marks is being understood as 1 because php is derived from C and in C there is no boolean type (true and false), only int (1 and 0). When you get an aggregate via GET it's a string. So you're comparing a "true" string with an int 1.

    
27.03.2016 / 18:12