Unexpected timeout

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
devesa
Forum Newbie
Posts: 10
Joined: Fri Sep 11, 2009 2:49 am

Unexpected timeout

Post by devesa »

Hello colleagues,

I have put these lines in the header of my php webpage:

Code: Select all

<?php ini_set('session.gc_maxlifetime',"50000");
         session_start(); ?>
But it takes less than an hour to logout automatically (I suposse for inactivity).
What am I doing wrong?

Thanks
User avatar
jazz090
Forum Contributor
Posts: 176
Joined: Sun Apr 12, 2009 3:29 pm
Location: England

Re: Unexpected timeout

Post by jazz090 »

this is the worst way to logout users automatically. what you need to do is set a timestamp on a db column and every time a user makes an action the requires authorisation, you update that field and simultaneous you check that timestamp against current time and if its been too long, then you log them out.
devesa
Forum Newbie
Posts: 10
Joined: Fri Sep 11, 2009 2:49 am

Re: Unexpected timeout

Post by devesa »

Thanks for your fast reply, but I didn't explain properly.

I really do not want them to log-out automatically. In fact this is a problem for me.
I want to set the automatic timeout as long as possible (that's why I set session.gc_maxlifetime to 50000).
But it doesn't log-out after 50000 seconds, but long befor (about an hour after log-in), and I do not know why...

Thanks!
Post Reply