[FX.php List] Extending Session Expiration
Jonathan Schwartz
jonathan at eschwartz.com
Tue Jan 23 19:07:28 MST 2007
Hi Gary,
I've never messed with the system settings. I just set the session
as follows once the user logs in. This codes only gets executed once.
$_SESSION['sess_start_time']= time();
$_SESSION['sess_exp_time']=time() + 3600;
Then, whenever a user advances to a new page in session, I test for
expired session:
if(time() >= $_SESSION['sess_exp_time'] ){
Do this; //exit or some other action.
}
Works for me.
Jonathan
>Hi everyone,
>
>I'm trying to increase the session expiration time for my solution
>and I'm finding this is a complex issue without clear cut solutions.
>
>The context is a Filemaker/PHP site with complex forms that rely on
>about several session variables (ID of the organization, name of the
>organization, name of person entering data, etc.). Many of the forms
>take more time to fill than the 24 minutes that PHP defaults to
>before it may end your session through garbage collection. I don't
>have access to the server's php.ini file, as this is a shared
>hosting service. How do I extend the session life?
>
>I first tried session_set_cookie_params () with a time of 10800
>seconds -- three hours.
>That did not work. I guess it's not just about the length of time of
>the session cookie.
>
>On the php.net site, there are a number of discussions about this
>and they do not all point the same way. About the best I've seen
>came in comments general session handling posted last August. The
>commenter mentions three commands:
>
>ini_set("session.cache_expire","180");
>ini_set("session.gc_maxlifetime","3600");
>session_save_path("/my/own/path/without/url/sessions");
>
>I guess all three must be be invoked before session_start(). Do I
>make a new directory and save sessions there using the
>session_save_path command? I have to invoke all three commands on
>every page?
>
>Thanks for any insights....
>
>Gary Sprung
>
>--------
>Gary Sprung
>GNURPS Consulting
>
><mailto:gary at gnurps.com>gary at gnurps.com
>www.gnurps.com
>
>Landline: 720-565-9933
>Cell: 303-859-9331
>
>
>
>
>_______________________________________________
>FX.php_List mailing list
>FX.php_List at mail.iviking.org
>http://www.iviking.org/mailman/listinfo/fx.php_list
--
Jonathan Schwartz
FileMaker 8 Certified Developer
Associate Member, FileMaker Solutions Alliance
Schwartz & Company
jonathan at eschwartz.com
http://www.eschwartz.com
http://www.exit445.com
415-381-1852
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.iviking.org/pipermail/fx.php_list/attachments/20070123/e0b2e54c/attachment.html
More information about the FX.php_List
mailing list