cleansedbb
Technical User
Hello all, I am trying to get the following to work. What it's supossed to do is read in the $SESS_time and give me
the var that should be $time1 but everytime I do it changes
on refresh. i.e. $SESS_time = time();
how do you lock time(); to not refresh on reload?
the following works if I hard code in $time1.
Thanks for the replys
<?
$expire = "10800"; // expire in 3 hours
$time = time(); // time in UTC format
$time1 = '1055990009'; // time of session start $newtime = ($time1 + $expire); // time of expiration
$expiring = ($newtime - $time); // count down to expire
while ($done != 'yes')
{
$hours = ($expiring/(60*60)); // determine hours from seconds
$M = explode('.', $hours); // take remainder to create minutes
$M[1] = ".$M[1]"; // add decimal to allow for multiplication
$min = (($M[1])*(60)); // create minutes
$S = explode('.',$min); // same as above for seconds
$S[1] = ".$S[1]"; // add decimal to allow for multiplication
$sec = (($S[1])*(60)); // create seconds
$done = 'yes';
}
$A = explode('.', $hours); // get first digit w/o .90000
$B = explode('.', $min); // get first digit w/o .90000
$C = explode('.', $sec); // get first digit w/o .90000
$thistime = sprintf("%02d:%02d:%02d", $A[0], $B[0], $C[0]); // set time format 00:00:00
echo "Time Remaining in Session: ";
echo $thistime;
?>
the var that should be $time1 but everytime I do it changes
on refresh. i.e. $SESS_time = time();
how do you lock time(); to not refresh on reload?
the following works if I hard code in $time1.
Thanks for the replys
<?
$expire = "10800"; // expire in 3 hours
$time = time(); // time in UTC format
$time1 = '1055990009'; // time of session start $newtime = ($time1 + $expire); // time of expiration
$expiring = ($newtime - $time); // count down to expire
while ($done != 'yes')
{
$hours = ($expiring/(60*60)); // determine hours from seconds
$M = explode('.', $hours); // take remainder to create minutes
$M[1] = ".$M[1]"; // add decimal to allow for multiplication
$min = (($M[1])*(60)); // create minutes
$S = explode('.',$min); // same as above for seconds
$S[1] = ".$S[1]"; // add decimal to allow for multiplication
$sec = (($S[1])*(60)); // create seconds
$done = 'yes';
}
$A = explode('.', $hours); // get first digit w/o .90000
$B = explode('.', $min); // get first digit w/o .90000
$C = explode('.', $sec); // get first digit w/o .90000
$thistime = sprintf("%02d:%02d:%02d", $A[0], $B[0], $C[0]); // set time format 00:00:00
echo "Time Remaining in Session: ";
echo $thistime;
?>