You are here: Re: how to delete session automatically after ther the time expires « PHP Programming Language « IT news, forums, messages
Re: how to delete session automatically after ther the time expires

Posted by Erwin Moller on 01/17/07 07:45

balakrishnan.dinesh@gmail.com wrote:

> 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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация