PHP Classes

Expire cookies

Recommend this page to a friend!

      Access user Class  >  All threads  >  Expire cookies  >  (Un) Subscribe thread alerts  
Subject:Expire cookies
Summary:How doe the session make to expire?
Messages:4
Author:Sam Day
Date:2006-02-22 12:44:00
Update:2006-10-01 09:27:56
 

  1. Expire cookies   Reply   Report abuse  
Picture of Sam Day Sam Day - 2006-02-22 12:44:00
Hello,

I can't make my sessions expire when the uset logged in.

After 30 mins that the user no used my site I would like the session to expire that the user needs to log in again.

I saw a old thread here called "timed sessions" where Olaf say using the ini_set("session.gc_maxlifetime", "3600");

How doe I use this setting so the uset needs to log in after a 30 min he not access the site?

I added this setting to every page in the site after Session Start() but the user STILL access the pages even after 1 hr.

Thank YOU!

Sam.

  2. Re: Expire cookies   Reply   Report abuse  
Picture of Olaf Lederer Olaf Lederer - 2006-02-22 13:19:00 - In reply to message 1 from Sam Day
Sam,

Place this setting only inside the class file, there must be also a session_start() call. Place this setting above this command.

check also this information from the manual:

session.cookie_lifetime specifies the lifetime of the cookie in seconds which is sent to the browser. The value 0 means "until the browser is closed." Defaults to 0.

in your case its 30 min * 60 seconde

Olaf

  3. Re: Expire cookies   Reply   Report abuse  
Picture of C.S. C.S. - 2006-10-01 01:27:57 - In reply to message 2 from Olaf Lederer
But how to update cookie-lifetime when user refreshed site/still browsing ?

Background:
I have set cookie-lifetime to 60 minutes. After 30 minutes of reading an article, the user browses to the next one and reads this also 30 mins. When he wants to browse the next one, he is logged out (cause i check if cookie is there).

  4. Re: Expire cookies   Reply   Report abuse  
Picture of Olaf Lederer Olaf Lederer - 2006-10-01 09:27:56 - In reply to message 3 from C.S.
Hello,

There are too much ads on this (slow) site...if you visit my own site, there is on the page about this class a link to a special support forum, please ask your question there, I'm sure we can help.

Olaf