treehouse : what would you like to learn today?
Web Design Web Development iOS Development

make time for view page !

  • I make online Exams system with php and mysql

    I want to make visitor to see page of exam for certain time for example 30min

    and after 30 min (page die of redirect to main page)

  • You could redirect with JavaScript but that may be only half a solution as you can always turn JS off.

    If your exams consist of multiple short questions you could store exam start time in a session and show questions one at a time, maybe using AJAX or simply separate pages. On the back end at each question request you check the time elapsed and die if expired. Combine this with a time left timer and a JavaScript redirect to redirect mid way through questions. If JS is off and they submit a question after 30 minutes has passed then you simply discard the answer to that single question. I hope that helps.