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 sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

log out user settings

Status
Not open for further replies.

matanzas

Technical User
Apr 15, 2006
184
CA
If I create a link (as below) to log out a user I understand that there must be a session_start();

Do I have to change any of the unset $_SESSION settings?

Code:
<?php
// *** Logout the current user.
$logoutGoTo = "/interview/logout.htm";
session_start();
unset($_SESSION['MM_Username']);
unset($_SESSION['MM_UserGroup']);
if ($logoutGoTo != "") {header("Location: $logoutGoTo");
session_unregister('MM_Username');
session_unregister('MM_UserGroup');

exit;
}
?>

Thanks
 
Yes.

Don't use session_unregister().

[tt]session_unregister('MM_Username');[/tt]

is the same as

[tt]unset($_SESSION['MM_Username']);[/tt]

and the PHP online manual recommends against using session_unregister().



Want the best answers? Ask the best questions! TANSTAAFL!
 
Thanks, I'll just delete
session_unregister('MM_Username');
and
session_unregister('MM_UserGroup');
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top