RE: [PHP] Ack! Cookie Problems!

From: Date: Thu, 22 Mar 2001 10:49:51 +0000
Subject: RE: [PHP] Ack! Cookie Problems!
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-45089@lists.php.net to get a copy of this message
Why not just set the session start time in a session variable and then test against that? Something like: session_start(); # This array contains all the session items if (!isset($sesh)) { $sesh = array(); session_register('sesh'); $sesh[start] = time(); } if ( $PHP_SELF == '/login') { if (login_ok()) { $sesh[start] = time(); } } elseif ( time()-$sesh[start] > 60 ) { headers("Location: /login"); exit; } -----Original Message----- From: Michael Champagne [mailto:mchampagne@capis.com] Sent: Thursday, March 22, 2001 1:25 AM To: PHP General Mailing List Subject: [PHP] Ack! Cookie Problems! Ok, I'm going through a cookie nightmare. I'm trying to create a session and then cut the user off from the session by setting the expiration of the cookie that I send out using session_set_cookie_params(). Here's my code: /* Start session and unset any previous session variables */ session_start(); session_unset(); session_set_cookie_params(time() + $cookie_expire * 60); // Parameter is in seconds The cookie never expires though! I set $cookie_expire to 1 (should expire in one minute) and I can keep right on accessing pages. BTW, all the pages do a session_start and check for a variable at the beginning and redirect to the login page if the var is not found. Does anyone know what's up with this? Thanks for your help in advance. -- Michael Champagne, Software Engineer Capital Institutional Services, Inc. wk: mchampagne@capis.com hm: mchamp@texas.net ****************************************************************** This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction, unless specifically agreed otherwise. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect the views or opinions of Capital Institutional Services, Inc. Capital Institutional Services, Inc. accepts no liability for any errors or omissions arising as a result of transmission. Use of this communication by other than intended recipients is prohibited. ****************************************************************** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#45089) next »