Re: PHP and Sessions
| From: | The Disguised Jedi | Date: | Mon, 18 Apr 2005 17:15:50 +0000 |
| Subject: | Re: PHP and Sessions | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-213287@lists.php.net to get a copy of this message | ||
yes, set the cookie expiration to 0. Can be done in php.ini, or with the
function mentioned.
use ini_set() or change the value.
On 4/18/05, Petar Nedyalkov <bu@orbitel.bg> wrote:
>
> On Monday 18 April 2005 05:22, Reynier Perez Mira wrote:
> > Hi list:
> >
> > I have this code that Works perfectly:
> >
> > File: index.php
> >
> > <?
> >
> > session_start();
> >
> > echo "<a href="logout.php?sid=". session_id()."">Close
> > session</a>";
> >
> > ?>
> >
> > File: logout.php
> >
> > <?
> >
> > session_unset();
> >
> > session_destroy();
> >
> > ?>
> >
> >
> >
> > When user click link all works fine but when user close window withouth
> > click link the session is not delete and all vars preserve they values.
> How
> > can I fix that? I use PHP 5.0.0 RC2 and Windows XP SP1.
>
> It's because the session is managed through cookies and they don't expire
> until the next load.
>
> You can:
>
> 1. Set the expiration time to time in the past using
> session_set_cookie_params();
> 2. Stop the cookies and use GET method.
>
> >
> >
> >
> > Regards
> >
> > Reynier Pérez Mira
> >
> > 3ero. Ing. Informática
> >
> > Entre más inteligente me siento, más me doy cuenta de lo ignorante que
> soy.
>
> --
>
> Cyberly yours,
> Petar Nedyalkov
> Devoted Orbitel Fan :-)
>
> PGP ID: 7AE45436
> PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
> PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436
>
>
>
--
The Disguised Jedi
disguised.jedi@gmail.com
Now you have my $0.02. Or .01 Pounds, .014 Euros, or $0.025 CAN. I'm
world-wide BABY!
PHP rocks!
"Knowledge is Power. Power Corrupts. Go to school, become evil"
Disclaimer: Any disclaimer attached to this message may be ignored. However,
I must say that the ENTIRE contents of this message are subject to other's
criticism, corrections, and speculations.
This message is Certified Virus Free