Forum Moderators: coopster

Message Too Old, No Replies

Help about session - logon once or forever

         

asdasddd

1:58 am on Jan 5, 2005 (gmt 0)

10+ Year Member



I want to implement logon once or forever which depends on the vistor's choice. Someone told me just modify my php.ini like below:

session.use_cookies = 1
session.cookie_lifetime = 999999999
session.gc_maxlifetime = 999999999;

But when I have done this, all the cookied send to lient will never be expired. If some body only want to logon once, this will not work properly. Another question is, when someone logon and closed his browser without click to logout, the session file on the server will never be removed by gc. If the cookie on client was deleted by himself, then the session file is useless, how can I
remove this session file?

Thanks for your help!
Have a great day!

coopster

11:58 am on Jan 5, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, asdasddd.

This is one of those cases where you may want to control session management yourself [php.net] and define your own garbage collection routines based on a partiular date or timestamp or something as well as checking an entry for that particular session name/user.

It's either that or write a different script or cron job to walk through your *session directory* every so often and pick and choose which files to remove. That would require parsing the serialized data though. I tend to think that managing them via a database and SQL statements would be a bit easier.

Nonetheless, it will be a nice project and a bit of work to get refined the way you would like.

asdasddd

12:39 pm on Jan 5, 2005 (gmt 0)

10+ Year Member



Thanks for your help, and I think it's more difficult than I think. Maybe I should deal with it via database. Is there any suggestion from you?

Thanks, have a great day! Nice to see you.^()^