English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I am little confused how should I call unset() function to sign the user out of the site.
Cheers
http://www.djabid.com

2007-06-09 15:09:28 · 2 answers · asked by Abid H 1 in Computers & Internet Programming & Design

2 answers

The unset() function frees a specific session variable so you would use it like this

unset($_SESSION['name']);

You can also use the session_destroy function to destroy all the session variables like this

session_destroy();

2007-06-09 15:22:40 · answer #1 · answered by naughty_sharky 3 · 0 0

session_unset();
?>

will remove all session variables - if you want to completely destroy the session (as if they had closed their browser), use:

session_destroy();
?>

Direct your link 'Sign Out' to something like http://djabid.com/logout.php

And put something like the following in the logout.php file
session_destroy();
echo 'You've been successfully logged out';
?>

There are tons of ways to do this, depending on what you want the final result to be and how your code is set up thus far.

2007-06-09 15:26:14 · answer #2 · answered by Jen 2 · 0 0

fedest.com, questions and answers