streetfi8er Posted March 12, 2009 Share Posted March 12, 2009 i am creating an online exam form through php .. so what should i do if i wan the page to expire after a examinee has spent 3 hours on the page? Link to comment https://forums.phpfreaks.com/topic/149184-time-out-in-a-web-page/ Share on other sites More sharing options...
The Little Guy Posted March 12, 2009 Share Posted March 12, 2009 you could use sessions. $_SESSION['startime'] = microtime(TRUE); then when the user goes to submit the test, just do a check like this: $maxTime = 10800; // 3 hours (time in seconds) if((microtime(TRUE) - $_SESSION['startime']) > $maxTime){ echo 'You took too long'; }else{ echo 'Thank You! You are done!'; } Link to comment https://forums.phpfreaks.com/topic/149184-time-out-in-a-web-page/#findComment-783385 Share on other sites More sharing options...
redarrow Posted March 12, 2009 Share Posted March 12, 2009 save a time stamp in the database, use ajax to keep refreshing the page, if the time == 3hrs then submit current information and send them to a warning page, but let them see there current results. could be also doNE in php where they can not enter no more information in the database when the time has reached 3 hours. WHALE LITTLE GUY EXAMPLE IS GRATE AND SO EASY! Link to comment https://forums.phpfreaks.com/topic/149184-time-out-in-a-web-page/#findComment-783387 Share on other sites More sharing options...
Philip Posted March 13, 2009 Share Posted March 13, 2009 WHALE LITTLE GUY EXAMPLE IS GRATE AND SO EASY! Im glad you think so Link to comment https://forums.phpfreaks.com/topic/149184-time-out-in-a-web-page/#findComment-783428 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.