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: pgpohbo3m3AVw.pgp
Description: PGP signature

Reply via email to