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
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.
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.