sudeepk Posted May 31, 2010 Share Posted May 31, 2010 Iam making a quiz page for which i want people to answer it in given time of 3 minutes. Is it possible that i can get the time spent on the page right after opening it. So that i can make sure, they submitted in time and no one got answers from google. Can i trace ip of the comp? So that i can find if same person is not posting again. I get "10-05-31 02:15:10" in place of ip when used $ip = $_SERVER['REMOTE_ADDR']; If there are easier ways, plz let me know. Link to comment https://forums.phpfreaks.com/topic/203451-a-quiz-page-time/ Share on other sites More sharing options...
jcbones Posted May 31, 2010 Share Posted May 31, 2010 <?php //page time: session_start(); if(!isset($_SESSION['time'])) { $_SESSION['time'] = time(); } else { if(isset($_SESSION['failed'])) { echo 'You have failed to complete this test in a timely manner.'; } elseif((time() - $_SESSION['time']) > 180) { echo 'Timer has run out!'; unset($_SESSION['time']); $_SESSION['failed'] = 1; } } Or, something along those lines. Link to comment https://forums.phpfreaks.com/topic/203451-a-quiz-page-time/#findComment-1065845 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.