View Full Version : Trying to build a logout button
04-05-2011, 06:22 PM
I'm trying to build a logout button, accomplishing the top execution with the button code below it. How do I do something like this? It has me puzzled.
<FORM><INPUT TYPE="BUTTON" VALUE="button text here" ONCLICK="window.location.href='http://mysite'"></FORM>
04-05-2011, 06:25 PM
I should have said this:
When a person is on a permission-granted page, I want them to be able to click "Logout" and then be automatically redirected back to my home page. I should have said that right away. Sorry.
04-05-2011, 06:28 PM
Set the form action to the page you want the users to land on.
I guess thats all you're asking right?
04-05-2011, 10:20 PM
What about the logout part with the PHP?
04-06-2011, 02:52 PM
I googled it and found this http://www.plus2net.com/php_tutorial/php_login_logout.php
04-06-2011, 02:57 PM
As quartzy pointed out, since php is an open source, there are probably tons of free login/logout scripts and tutorials online.
04-07-2011, 04:58 AM
An example of a logout page can be as follows: (simply put)
header ('Location: http://your-redirect-page.com/');
When a user clicks the logout link, it will automatically send them to your desired page instantly, and clear the session (logout the user).
But in order for this to work, a session needs to be started from the get go!!
04-07-2011, 05:17 AM
Assuming we are attempting to log out of a PHP Session; from a security perspective I've found it safer to re-initialize the Session rather then merely destroying it before logging out.
//set some $_SESSION[$values]
$_SESSION = array();
In this manner the first Session is replaced with a second, empty, Session before logging out to remove all traces of the first Session.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.