Jump to content

Logging out and clearing sessions


overlordofevil

Recommended Posts

I am trying to get a logout script to work.

 

Basically a person clicks on this

 

<a href="process.php?do=logout" target="_top">Logout</a>

 

now what is suppose to happen is this link should call up the logout script (below) and return the user to the login screen.

 

	}

if ($_GET['do']=="logout") 
{
	session_unset();
	session_destroy();
	if ($_COOKIE[user_id]) 
	{
		setcookie("nero_id", "");
		setcookie("nero_name", "");
		setcookie("nero_pass", "");
		setcookie("nero_rights", "");
	}
	header("Location: index.php");
}

 

What I get after all of this runs is just a blank screen so I am not sure what I missed. Any suggestions would be appreciated.

Link to comment
https://forums.phpfreaks.com/topic/94373-logging-out-and-clearing-sessions/
Share on other sites

stick this at the top of your screen

 

error_reporting(E_ALL);

 

Should make the errors come up for now.

 

I'd guess it resets your sessions correctly, but can't send the header because it's already changed the session info (headers can't be sent twice)

 

Stick

echo "Logged out";

before the header tag, see if that comes up.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.