Derek Fountain wrote:[color=blue]
> The documentation says session_destroy() "destroys all of the data
> associated with the current session". Um, like what?[/color]
It deletes the session file. Session file is the one which holds the
serialized session variables; should be available on session path
usually a temp directory on server.
[color=blue]
> The docs further say that you should remove all information in the[/color]
_SESSION[color=blue]
> global with $_SESSION = array() and you should use setcookie() to set[/color]
the[color=blue]
> session cookie to a blank value. Having done those, what does that[/color]
leave[color=blue]
> session_destroy() to do?[/color]
When you session_start(), it actually populates the $_SESSION
array--the values will be available till the script ends--even if you
use session_destroy() in the middle--which is the case, you may want to
avoid-- and so $_SESSION = array().
On usual configurations, cookie will hold the session id.
session_destroy() only deletes the session file at server--it doesn't
reset the session cookie. Since, PHP's session management is
"permissive", even if you delete the session file (and hence the
session data) with session_destroy(), in the next session_start() (the
execution of next page), it will create a session with session id which
is same as of previous (deleted) session. It happens as the session id
of previous (deleted) session is still available in the cookie. That's
why the suggestion is to reset the session cookie--so that you get new
session id (hence "pure new session").
--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog:
http://rajeshanbiah.blogspot.com/