Jump to content


Photo

Session management


  • Please log in to reply
No replies to this topic

#1 bgsomers

bgsomers
  • Members
  • PipPip
  • Member
  • 17 posts

Posted 29 July 2006 - 09:02 PM

I run the following

session_start(); # create session to be resumed in file input.php
$_SESSION["StartTime"] = time();
# if(isset($_SESSION["StartTime"])) { echo 's'; }
and the display alway contains a small 's', indicating that
$_SESSION["StartTime"] has been stored.

Later in the processing, I have

session_start(); # resume session created in file new.html
$mintime = 15;
$check = time();
$duration = ($check - $_SESSION["StartTime"]);
$admin01 = 'duration was: '.$duration;
$admin02 = 'check time was: '.$check;
$admin03 = 'start time if retrieved: '.$_SESSION;
if (!empty($_SESSION)) 
{ $admin04 = print_r($_SESSION,true);
  }
else 
{ $admin04 = 'the session variable $_SESSION has not been retrieved ';
  }
Less than half the time, this leads to
- duration was: 2
- check time was: 1154188904
- start time if retrieved: Array
- Array
(
    [StartTime] => 1154188902
)
indicating that $_SESSION["StartTime"] has been retrieved, and all is well.

But more than half of the time, it leads to
- duration was: 1154186069
- check time was: 1154186069
- start time if retrieved: Array
- the session variable $_SESSION has not been retrieved

indicating that the array element $_SESSION["StartTime"] was empty.

How can this data be passed part of the time, but not all of the time?

Bruce







0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users