
January 17th, 2007, 05:15 AM
| | | how to delete session automatically after ther the time expires
hi frnds,
In my page, for every user login, it will create a session
file for them with thier name itself in the default session folder, Now
i want to do is, If a person is use idle for 10 minutes, automatically
his respective session file should be deleted. How is should be, plz
tell me some idea or give some sample code
Thanks
Dinesh... | 
January 17th, 2007, 07:55 AM
| | | Re: how to delete session automatically after ther the time expires balakrishnan.dinesh@gmail.com wrote: Quote:
hi frnds,
>
In my page, for every user login, it will create a session
file for them with thier name itself in the default session folder, Now
i want to do is, If a person is use idle for 10 minutes, automatically
his respective session file should be deleted. How is should be, plz
tell me some idea or give some sample code
>
Thanks
Dinesh...
| Hi,
Simply make the sessiontime-out 10 minutes.
You can set this in php.ini, or if php.ini is out of reach: set it manually
via ini_set.
Look for session.cookie_lifetime
About the deleting: You probably should not worry about that.
PHP will delete them itself.
How is this handled?
Each request to PHP, PHP will generate a random number and compare that to
what you defined in php.ini under:
- session.gc_probability
- session.gc_divisor
In my example, 1 in thousand times PHP will delete all old sessionfiles.
More explanation is given in php.ini and on www.php.net.
Regards,
Erwin Moller | 
January 17th, 2007, 08:05 AM
| | | Re: how to delete session automatically after ther the time expires
Erwin Moller wrote: Quote: balakrishnan.dinesh@gmail.com wrote:
> Quote:
>hi frnds,
>>
> In my page, for every user login, it will create a session
>file for them with thier name itself in the default session folder, Now
>i want to do is, If a person is use idle for 10 minutes, automatically
>his respective session file should be deleted. How is should be, plz
>tell me some idea or give some sample code
>>
>Thanks
>Dinesh...
| >
Hi,
>
Simply make the sessiontime-out 10 minutes.
You can set this in php.ini, or if php.ini is out of reach: set it
manually via ini_set.
>
Look for session.cookie_lifetime
>
About the deleting: You probably should not worry about that.
PHP will delete them itself.
How is this handled?
Each request to PHP, PHP will generate a random number and compare that to
what you defined in php.ini under:
- session.gc_probability
- session.gc_divisor
| Forgot the example. :P
session.gc_probability = 1
session.gc_divisor = 1000 Quote:
>
In my example, 1 in thousand times PHP will delete all old sessionfiles.
More explanation is given in php.ini and on www.php.net.
>
Regards,
Erwin Moller
| | 
January 17th, 2007, 10:15 AM
| | | Re: how to delete session automatically after ther the time expires
hi Erwin
I have change the session_lifetime in php.ini file which you
have said. But still the session files remains same, Another thing i
have noticed is, If give value as 5, then only two file are present in
the session folder and if i give the value as 30, some 10 or 15 file
are present in the session folder.at the sametime after the time
reached which as fixed as value for session lifetime, nothing is
happening, everythings remains same i.e, no session file are getting
deleted.
Rgrds
Dinesh... | 
January 17th, 2007, 01:35 PM
| | | Re: how to delete session automatically after ther the time expires balakrishnan.dinesh@gmail.com wrote: Quote:
hi Erwin
>
I have change the session_lifetime in php.ini file which you
have said. But still the session files remains same, Another thing i
have noticed is, If give value as 5, then only two file are present in
the session folder and if i give the value as 30, some 10 or 15 file
are present in the session folder.at the sametime after the time
reached which as fixed as value for session lifetime, nothing is
happening, everythings remains same i.e, no session file are getting
deleted.
>
Rgrds
Dinesh...
| Hi,
It is perfectly possible you have 30 old sessionfiles in your directory.
When using the settings in my example for gc.* they will only be garbage
collected once in thousand times.
Regards,
Erwin Moller |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | | | | What is Bytes?
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over network members.
|