p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

beginning_php thread: sessions never timing out


Message #1 by "Trey Carroll" <treycarroll@y...> on Fri, 21 Feb 2003 19:20:44
I have been using sessions with a site I'm creating.  The problem is that 
they never seem to time out.   Maybe I'm using them wrong.   I just put a 
session_start(); at the top of each page.  I expected the pages to give a 
session expired msg after about 20 minutes but this is never happening.  I 
can leave the machine on the site for hours after logging in and come back 
and click a link and it is still live.  (All pages have the session_start
(); at the top.)

I finally just modified some code from an article on custom sessions to do 
what I want it to do(timeout after 20 minutes).  For future reference 
though, what do you need to do to cause a page to timeout?

Thanks,
Trey
Message #2 by "Gellings, C.O." <gellingsco@p...> on Sat, 22 Feb 2003 00:31:20 +0100
The sessions do not expire. You cab set in the php.ini file the 
session.cookie_lifetime, which will expire after the time set if not 0. You 
can set the session cookie also bij session_set_cookie_params(int 
lifetime[, string path[,string domain[,bool secure]]])
if you do not want the cookie each time you can query if the session cookie 
has been set.

maybe this will bring you some enlightenment, or have a look at 
http://www.php.net/manual/en/function.session-set-cookie-params.php

Carl


  Return to Index