when student logs in and presses start, store timestamp in mysql. Use thenan ajax call, which is called every minute to countdown the time on page. PhP checks when the info is submitted what the time is and compares it against timestamp. Naturally, you will not let someone log in and log outl as soon as user timestamp is registered, there is no updating