Need Help with Sessions Please
Moderator: General Moderators
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
The sign out (or logout) routine typically involves click origination. What that means is that a user clicks a link/button and then is taken to a page that handles logouts and session destruction. Closing a session should not happen automatically unless your allowable logged in time limit is reached.
write a redirect page. when the user clicks <span><a href="redirect.php">Sign Out</a></span>
the redirect page will look something like...
the redirect page will look something like...
Code: Select all
<?php
//redirect.php
signOut();
header("Location: http://www.yoursite.com/youareloggedout.php");
?>- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
So that would be two redirects?
Why not post back to the calling page with a querystring trigger?
Why not post back to the calling page with a querystring trigger?
Code: Select all
<?php
if (isset($_GET['logout']) && $_GET['logout'] == 'true')
{
session_destroy();
// Do whatever else you want to do on a logout
}
echo '<a href="' . basename($_SERVER['SCRIPT_FILENAME']) . '" title="Logout">Click here to logout</a>';
?>