|
Posted by Koncept on 10/31/06 16:32
In article <nbGdnTTol9Gf3drYnZ2dnUVZ_tOdnZ2d@comcast.com>, Jerry
Stuckle <jstucklex@attglobal.net> wrote:
> > // Note: This will destroy the session, and not just the session data!
> > if ( isset( $_COOKIE[session_name()] ) )
> > setcookie( session_name(), '', time() - 42000, '/' );
> >
>
> This line will never do anything. The session_name is the value of the
> cookie, not the name.
That's incorrect. session_name() will return the key (*PHPSESSID* )
which is then used as a key in the $_COOKIE superglobal to point to the
current session id.
http://php.net/session_destroy
You will notice that the code I provided you is directly from the PHP
docs and it is *not* incorrect.
As you can see from the example below, each time I start a new browser
session, I can, in fact, echo out what you suggest to be superfluous.
Perhaps the answer to your problem lies in this simple oversight unless
you have altered the value of "session.use_cookies" in your ini file.
<?php
session_start();
if(isset($_COOKIE[session_name()])){
echo $_COOKIE[session_name()];
}
// 72728376dfdd7f3de60f75111ace5a6e (first session - browser one)
// 1ce309fbb3bbdd0d34ed2b73be8cbe5b (first session - browser two)
?>
--
Koncept <<
"The snake that cannot shed its skin perishes. So do the spirits who are
prevented from changing their opinions; they cease to be a spirit." -Nietzsche
Navigation:
[Reply to this message]
|