online exam time issue

hi there

i have a problem with online exam time that will be manage during the exam by ajax.

in each ajax request, i will send the remain time and store it in a db table.

the problem is if i use short intervala for exam send request every one second, it’s so heavy for the server and if use longer intervals like 10 seconds gap between each ajax request, use can hit refresh and dont let time to change

what can i do?

thanks in advance.

You should not use ajax for that. User can disable JS or block ajax requests, and then exam time will not count at all. I think so you should just save time of start exam, and don’t monitor if user is on page, just compare start time with end time.

thanks

but what should i do if unexpectedly browser closed or internet connection fail and user want to continue his exam with remained time?

I think you could generate an exam token which is then stored in local storage (or something).

Then when the student submits, the token is checked.

You could implement a time limit on the token.

I think that’s a quite flexible way.

so if i want to check it in submit time, i can store it in db because during the exam i will not check it!

It will always be a choice between comfort and security. A more comfortable system will be more vulnerable to fraud, and more resistant to fraud will be less comfortable. It is up to you to decide what is more important, but I think it’s admin/examiner should decide whether someone can take the exam again and it should not be automated.