Jump to content

Session management


bgsomers

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


Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.