🙂
3 minutes is 180 seconds.
you can have a variable in the SESSION called $sesstime
now in any page this variable can be tested
maybe there is a better way, but here is my idea
<?php
// any page /////////////////////////////////////////////////////////////////
// this first sessionage check should of course be an include
// if it is used frequently by several pages
session_start( 'sess_id' ); // or whatever you use for starting session_id
$nowtime = time(); // current time in seconds - unix timestamp
if ( isset( $_SESSION[ 'sesstime' ] )) {
$lasttime = $_SESSION[ 'sesstime' ];
$sessionage = $nowtime - $lasttime;
if ( $sessionage >= 180 ) {
// end session, it has been for more than 3 minutes
// session_destroy or whatever
}
else {
$sessionleft = 180 - $sessionage;
echo "You have only $sessionleft seconds left of your 3 minutes.<br>You better hurry up!";
}
else {
// sesstime was not set before
$_SESSION[ 'sesstime' ] = $nowtime;
}
////////////////////////////////////////
// here comes page real contents
?>
Depending on what you want this time control to do
you should change, modify this.
maybe even use more than one time variable stored in $_SESSION
Hope you can use any of this.
Otherwise I am sure some other readers can use part of this code
/halojoy
trying one of his ideas with Vampirev
🆒