Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LOGOUT

Status
Not open for further replies.

ameslee

Programmer
Feb 12, 2006
34
AU
hope someone can help me? Just wondering if there are any scripts that can be used to logout once logged in?

thanks

Amy
 
here's my function to logout...
Code:
	function Logout(){
		/* Kill session variables and logout*/
		unset($_SESSION['logged_in']);
		unset($_SESSION['username']);
		unset($_SESSION['password']);
		unset($_SESSION['Security']);
		$_SESSION = array(); // reset session array
		session_destroy();   // destroy session.
	}
you'd still need to change the session vars to match yours.
 
Dont worry i found this code, and it works
<?php
session_start();
unset($_session['password']);
unset($_session['username']);
session_destroy();
header('Location: /index.php?error=4')
?>
 
it didn't work because you first have to start the session before you destroy it.

i would also recommend killing/nullifying the session cookie if you want a properly destroyed session.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top