Re: Sessions - Ini settings and timeout
| From: | Holografix | Date: | Thu, 18 Oct 2007 11:27:06 +0000 |
| Subject: | Re: Sessions - Ini settings and timeout | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-263293@lists.php.net to get a copy of this message | ||
Hi.
Thank you very much Casey. I followed this suggestion as Zoltán also
suggested and it's working nice.
Best regards,
holo
"Casey" <heavyccasey@gmail.com> wrote in message
news:169A6F49-BF41-498A-BAC0-32E4E95BC8BE@gmail.com...
> You could set $_SESSION['lasttime'] to time() and check it on every page.
>
>
>
> On Oct 17, 2007, at 3:58 AM, "Holografix" <holografix@gmail.com> wrote:
>
>> I have some questions about sessions timeout and sessions ini settings.
>>
>> In php.ini I have session.gc_maxlifetime = 30 (for testing purpose only)
>> ,
>> session.gc_probability = 1 and session.gc_divisor = 100 (didn't touch
>> this
>> values)
>>
>> I have two simple pages
>>
>>
>> page1.php
>> ---------
>> session_start();
>> $_SESSION["test"] = "TEST";
>> <a href="page2.php">test timeout</a>
>>
>>
>> page2.php
>> =========
>> session_start();
>> if (!isset($_SESSION["test"]) ) {
>> echo "no session"; die();
>> }
>> print_r($_SESSION);
>>
>>
>> I open page1.php in the browser and only click in the link after waiting
>> more than 30 seconds (session.gc_maxlifetime).
>> After this period what should happen with $_SESSION["test"] in
>> page2.php?
>>
>> In php, session.gc_maxlifetime: ; After this number of seconds, stored
>> data
>> will be seen as 'garbage' and
>> ; cleaned up by the garbage collection process.
>>
>> I need to understand this and get a way to automaticly logout a user
>> after n
>> minutes of inactivity.
>>
>> My environment:
>> Windows XP PRO SP2, apache 2.2.4, php 5.2.4 (apache module), mysql
>> 5.4.5
>>
>>
>> Best regards
>> holo
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>