[thelist] php: session help

Tanner Burson tanner at younet.okstate.edu
Fri Jul 18 22:12:34 CDT 2003


----- Original Message -----
From: "Nemesis" <nemesis at nemesis1.f2o.org>
To: <thelist at lists.evolt.org>
Sent: Friday, July 18, 2003 8:49 PM
Subject: Re: [thelist] php: session help


> *This message was transferred with a trial version of CommuniGate(tm) Pro*
> Chris W. Parker wrote:
>
> >Nemesis <mailto:nemesis at nemesis1.f2o.org>
> >    on Friday, July 18, 2003 5:01 PM said:
> >
> >
> >
> >>>If you are using PHP 4.3.2 use session_regenerate_id() to generate a
> >>>new session id.
> >>>
> >>>
> >
> >4.2.2
> >
> >Bummer. That would be easy.
> >
> >
> >
> >>>I've tried session_destroy() and session_unset() but neither have
> >>>worked.
> >>>
> >>>
> >>>
> >>You have to empty the cookie, pre 4.3.2. There are some good examples
> >>at
> >>
> >>
> >>
> >
> >Then on the logout page I have this:
> >
> ><?
> >// start the customers session
> > session_start();
> >
> > $_SESSION = Array ();
> > session_destroy();
> >
> > header("Location: {$_SERVER["HTTP_REFERER"]}");
> > exit;
> >?>
> >
> >Both pages have session_start(); at the top. I removed some the logic
> >and the comments from the login page but I copy and pasted verbatim the
> >logout page. Do you see anything wrong with this?
> >
> >
> >Chris.
> >
> >
>  Weird, I tried this a few minutes ago for logout  and it worked
> perfectly. It destroyed the session id making the old session useless.
> |
> session_destroy();
>
> setcookie("SES_NAME","","","/");
>
> header("somewhere");
> exit;|

Make sure in your php.ini file that you have the session timeout set to 0 or
else you can get weird results when killing sessions.  Also (assuming you're
on a *nix box) check the permissions of /tmp and make sure that PHP has the
correct permissions...





More information about the thelist mailing list