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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.