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:[EMAIL PROTECTED]]
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: [EMAIL PROTECTED]
hm: [EMAIL PROTECTED]



******************************************************************
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to