How do i unset a session... ie the user has clicked a logout link.
With cookies I would set the cookie to a past time value
I read about unset() in the php manual, but it says do NOT use unset($_SESSION);
unsetting sessions [SOLVED]
Moderator: General Moderators
unsetting sessions [SOLVED]
Last edited by s.dot on Tue Nov 08, 2005 4:28 pm, edited 1 time in total.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
apparently its a combination, as shown when I looked up session_destroy... thanks
for those who didn't know
for those who didn't know
Code: Select all
<?php
// Initialize the session.
// If you are using session_name("something"), don't forget it now!
session_start();
// Unset all of the session variables.
$_SESSION = array();
// If it's desired to kill the session, also delete the session cookie.
// Note: This will destroy the session, and not just the session data!
if (isset($_COOKIE[session_name()])) {
setcookie(session_name(), '', time()-42000, '/');
}
// Finally, destroy the session.
session_destroy();
?>Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.