hiiiii
i need a code for logout page using sessions or any other in php
any suggestions are accepted...
hiiiii
i need a code for logout page using sessions or any other in php
any suggestions are accepted...
Completely depends on how you have your login set up / what sessions you use, but you could have:
This would work if you had an array like:PHP Code:<?php
if(isset($_GET['logout']) && $_GET['logout'] == 1) {
unset($_SESSION['login_details']);
}
?>
Array ( [login_details] => Array (
[username] => 'Schmoopy'
[name] => 'Jack'
[more_stuff] => 'random'
) )
etc..
So it would get rid of all that information. So when you check for the "login_details" array, it won't be there, meaning the user is not logged in.
zee000 (02-13-2010)
Or if your using session_start();
PHP Code:<?php
//logout.php
session_start();
session_destroy();
header("location: HOMEPAGE_GOES_HERE.php");
?>
-Ben -- THE DYNAMIC DRIVERS
My Links: My DD Profile||My Youtube Video Tutorials||DD Helping Coders||DD Coders In Training
I told my client to press F5, the client pressed F, then 5, *facepalm*
But remember using session_destroy will get rid of all the session variables, so if you have any you want to keep hold of for a different part of the site, then use unset so you don't affect them.
Bookmarks