Re: PHP and Sessions
| From: | Petar Nedyalkov | Date: | Mon, 18 Apr 2005 14:10:42 +0000 |
| Subject: | Re: PHP and Sessions | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-213272@lists.php.net to get a copy of this message | ||
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
Attachment: [application/pgp-signature]
Attachment: [application/pgp-signature]