session expiration

Hi,

i would like to ask how to set the session expiration.

on my site when a user logs in, i assign it to $_SESSION['username']

and on each page i check if (isset($_SESSION['username']) if not i
redirect it back to login page.

my problem is it seems like it expires very fast when there's no
activity, how can i make it in such a way it won't expire unless the
user logs out?

regards
Ron

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
ron [ Di, 28 September 2010 04:06 ] [ ID #2048180 ]

Re: session expiration

On 28 September 2010 03:06, Ron <nhadie [at] gmail.com> wrote:
> Hi,
>
> i would like to ask how to set the session expiration.
>
> on my site when a user logs in, i assign it to $_SESSION['username']
>
> and on each page i check if (isset($_SESSION['username']) if not i redirect
> it back to login page.
>
> my problem is it seems like it expires very fast when there's no activity,
> how can i make it in such a way it won't expire unless the user logs out?
>
> regards
> Ron

On each page do you have session_start();

You can extend the session duration using session_cache_expire(). Make
sure you call session_cache_expire() before you call session_start().

--
Richard Quadling
Twitter : EE : Zend
[at] RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Richard Quadling [ Di, 28 September 2010 11:22 ] [ ID #2048181 ]
PHP » gmane.comp.php.database » session expiration

Vorheriges Thema: products order
Nächstes Thema: formatting a word doc using php ?