Re: sessions
| From: | Marek Kilimajer | Date: | Thu, 06 Mar 2003 12:51:52 +0000 |
| Subject: | Re: sessions | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-138455@lists.php.net to get a copy of this message | ||
The session files are removed by the php engine, this is what happens:
1. You load a page, its suffix is php, apache loads php engine to execute it
2. php engines decides if it is time to clean session cache - the probability is taken from session.gc_probability (in %)
3. If yes, it checks each session file's modification time, and if it is old, removes it
From this you can see that you need to load some php pages to have a chance to see the files removed. If you want them to be removed for sure, set session.gc_probability to 100 and load a php page.
Shaun van den Berg wrote:
Hi, sorry i can reply in newsgroups , something is wrong ! Anyway , im doing everything local on my machine , so when i test php in my browser i use apache to interpret it , i changed the php.ini file in my winnt directory - session.gc_maxlifetime to 15 secs (it was 1440) but the session variables in my tmp file (on my machine cause its local, file name is sess_3zdfa4blahblah) still exists after i close my browser without login off and i wait for 15 secondes , but nothing happens ? Whats wrong ! Thanks Shaun ----- Original Message ----- From: "Marek Kilimajer" <kilimajer@webglobe.sk> To: "Shaun van den Berg" <shaun@novtel.co.za> Cc: <php-general@lists.php.net> Sent: Thursday, March 06, 2003 12:08 PM Subject: Re: [PHP] sessionsThe session file will be deleted automatically by the garbage colector after certain amount of time, specified in php.ini bysession.gc_maxlifetimeShaun van den Berg wrote:toHi, Im working on a site where the user logs in , if username and password matches with uname and pword in database then he is a valid user. I then start a session with session_onstart() and have a variable for his username and for his permissions ! (these variables are stored on server) Once he entered the secrure area , there is a logoff button for the userlog off ! the logoff code looks like (<?php session_start(); $name = session_name(); session_unset(); session_destroy(); setcookie($name,"",-3600); print("<script language='javascript'>self.close();</script>"); ?> ) the above code deletes the cookie on the clients computer + the session variables on the server ! finally , here is my question ! If the user does not logoff , but simply closes the browser , the cookie on his computer will be deleted , but the session variables on the server will still be there ! How do i delete this ? Thanks a bunch ! Shaun -- Novtel Consulting Tel: +27 21 9822373 Fax: +27 21 9815846 Please visit our website: www.novtel.co.za