Welcome Guest, Not a member yet? Register   Sign In
Timer
#1

[eluser]ronnie_nsu[/eluser]
Hi Guys
I am about to build an exam simulator app with php/ci/mysql.What I am wondering about is how would I implement and what should the the best way in terms of security to implement the clock/timer for an exam.Just to make it cleat suppose a student is sitting for an exam through the simulator and the exam duration is say 2 hours/120 mins. How do I handle the timing of the exam...i mean i have these following questions in mind...

1. How to keep track of time..(i believe i send a pulse to the server as ajax reuest each second or minute to keep the session alive...right>> or u guys know any better way)
2.how do detect if he had ended the exam before completing it..i mean in the middle of exam he just closed the browser....(is making use of browsers onunload would be a reliable choice...what if he restarts the computer...)

if u guys can give your thought/opinions on this matter..i would greatly appreciate.

Thanks
#2

[eluser]Nick Husher[/eluser]
You can do the keep-session-alive part without javascript by using a hidden iframe set to autorefresh every 30 seconds or so.

Code:
<meta http-equiv="refresh" content="30" />

Put that in the view that's loaded into an iFrame (height: 0px width: 0px) and it should hit the same page every 30 seconds as long as the page is alive.

To answer your second question, if the session maintainer mechanism (whatever means you choose, ajax or iframe) doesn't check in after CHECK_IN_DURATION * 2 or whatever, kill their session. Make sure that it does it on both sides by alerting the user that their connection with the central exam server has been compromised and an action item to reestablish that connection.

Really, the only things your interested in is the start time and exam duration, right? Any time a set of answers is submitted to the server, you check to see if the current time is before the start_time + exam_duration.
#3

[eluser]ronnie_nsu[/eluser]
THanks very much Nick.
#4

[eluser]ggoforth[/eluser]
At the start of the exam I would save the date and time in your database. Then on each subsequent page request check the current time against the time saved in the database and ensure that the current time isn't greater than the saved time + 2 hours ( or what ever the duration of the test is). If it is, the exam has ended and should be ended. If not proceed with your normal exam logic.
#5

[eluser]ronnie_nsu[/eluser]
[quote author="ggoforth" date="1251679585"]At the start of the exam I would save the date and time in your database. Then on each subsequent page request check the current time against the time saved in the database and ensure that the current time isn't greater than the saved time + 2 hours ( or what ever the duration of the test is). If it is, the exam has ended and should be ended. If not proceed with your normal exam logic.[/quote]

cooool good idea..Thank u!




Theme © iAndrew 2016 - Forum software by © MyBB