limit the time in online quiz using php

  • Jomana
  • Born
  • Born
  • Jomana
  • Posts: 2

Post 3+ Months Ago

hey everyone

I found this website very helpful, so I hope you help me ..

I have develop an online MCQ quiz using PHP, MySQL, and some functions of JavaScript

I want to set the quiz in specific time for example in may 15 from 1:00 P.M to 2:00P.M

also I want to post results of quizzes of one student in one table

and how to assign the quiz to students of one course


Thanks in advance :D
  • Poly
  • Guru
  • Guru
  • User avatar
  • Posts: 1091
  • Loc: Same place you left me.

Post 3+ Months Ago

Hi,

This is very abstract since there is no information provided on specifics as to how everything is handled behind the scenes.

To give a broad overview, you will need to set the time in the database using a timestamp. You will need to account for the timezone as well. Reference this.

You will need to set a start time and an end time. Once you have both set, do a simple check when a student selects the quiz:

Code: [ Select ]
if($time <= $startTime or $time >= $endTime)
{
  throw new Exception('Quiz has not begun or has already expired.');
}
  1. if($time <= $startTime or $time >= $endTime)
  2. {
  3.   throw new Exception('Quiz has not begun or has already expired.');
  4. }


To assign to all students of specific course, you will need to know a little bit about how the courses and students are currently structured. I would assume you will need to assign the quiz to a course. You will need to know what the course ID is(assuming it uses ID's). Store that in a database column for access. Then you will need to check if the student has access to that course, before allowing them to view the quiz. Do another simple check like the one above, but instead compare if the student is in the course, instead of comparing times.

If you run into any specific errors, please post them and somebody will help you, but without more information its impossible to give you exact details.
  • Jomana
  • Born
  • Born
  • Jomana
  • Posts: 2

Post 3+ Months Ago

Thanks a lot for your help

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 65 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.