i'm using this code: but doesnt seem to work because the structure of my html file has 3 frames, a sidebar, title, and the main.
Now, the user will have two buttons, the call new sidebar. Which is only accessible if he has logged in. And the other button is log out. When the user press the call new sidebar. The sidebar will change into a user-only sidebar. Now, when the user clicks the logout button the sidebar which is only for users is still there. Is it possible to target two frames in html. Any other technique that you can recommend so that when the user logs off开发者_运维技巧. There will be no other way to access the user-only sidebar.
session_start();
session_destroy();
?>
You can specify a target for your form which could be _parent to reload the whole page:
<form action="[..]logout[..]" method="post" target="_parent">
</form>
I'd recommend in your logout code to erase $_SESSION to make sure you have no data left in there, simply do
session_start();
session_destroy();
$_SESSION = array();
Make this into a habit, after do a state change, reload the page or redirect to other page. State change is including logout, add, edit, delete, etc. By doing this, you can make sure that the action result reflected in the new page, and the user can see it.
you could do the logout and the refresh the whole window with javascript.
精彩评论