I have a program in PHP and I want to print to the screen how much time the user has until their session expires. I want it to update when they reload the page.
For
You can set a cookie with the UNIX time and compare with that.
setcookie("start", time(), time ()+3600); // saves a cookie with current UNIX time for one hour
Read about setcookie here http://php.net/manual/en/function.setcookie.php
If you never used it before, be sure to read the begining carefully.
And compare time like:
If (isset($_COOKIE["start"]) and $_COOKIE["start"]+3600<time()){
echo (time()-$_COOKIE["start"])/60 . " minutes left";
}Else{
Echo "times up";
}