Question about Sessions!

From my understanding of session, the session will be destroyed if the
browser is closed or the user initiates a command to destroy it. (a
button "log out"). Is there a way to set a time variable on sessions.
Say to 20 minutes of idle time or must a user log out?

Matt G

--
Matthew Gonzales
IT Professional Specialist
Enterprise Information Technology Services
University of Georgia
Email: matt323 [at] uga.edu <mailto:matt323 [at] uga.edu>
Phone: (706)542-9538

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Matthew Gonzales [ Mi, 23 April 2008 18:49 ] [ ID #1948848 ]

Re: Question about Sessions!

http://us3.php.net/manual/en/ref.session.php

When you create the session, add your own variable called
$_SESSION["last_page_load_time"].

if ($_SESSION["last_page_load_time"] < time() - 20 * 60)
{
// don't time out, keep the session going...
$_SESSION["last_page_load_time"] = time();
}
else
{
// delete cookies
// unset session variables
// destroy session
}

The above will completely control the 20-minute window from your end. Not the
best, I'm sure, but it'll work every time.

~~~

As a side note, I'd encourage you to read Jeff Atwood's article on sessions.

http://www.codinghorror.com/blog/archives/001100.html

Matthew Gonzales wrote:
> From my understanding of session, the session will be destroyed if the
> browser is closed or the user initiates a command to destroy it. (a
> button "log out"). Is there a way to set a time variable on sessions.
> Say to 20 minutes of idle time or must a user log out?
>
> Matt G
>

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Jarrett Meyer [ Mi, 23 April 2008 19:18 ] [ ID #1948849 ]
PHP » gmane.comp.php.windows » Question about Sessions!

Vorheriges Thema: Fwd: php-windows Digest 23 Apr 2008 16:49:27 -0000 Issue 3460
Nächstes Thema: Step by step Installing PHP on windows IIS server( with images )