Jump to content

Archived

This topic is now archived and is closed to further replies.

bgsomers

Session management

Recommended Posts

I run the following

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

Later in the processing, I have

[code]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 ';
  }
[/code]
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


Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.