";
28 | $sql = "INSERT INTO Student_Result VALUES ($studentId, $examId, $score, $noOfQuestions, '$submitTime') ON DUPLICATE KEY UPDATE score=$score, submitTime='$submitTime';";
29 | echo $sql;
30 | $result = mysqli_query($conn, $sql);
31 |
32 | if (!$result) {
33 | echo "There was an error processing your result: " . mysqli_error($conn);
34 | // die('Connect Error: ' . mysqli_connect_error());
35 | // header("location: ../index.php");
36 |
37 | } else {
38 | header("location: ../index.php#results");
39 | }
40 | ;
41 | }
--------------------------------------------------------------------------------
/helpers/connect.php:
--------------------------------------------------------------------------------
1 | connect_error) {
11 | die("Connection failed: " . $conn->connect_error);
12 | }
13 |
--------------------------------------------------------------------------------
/helpers/init.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/helpers/logout.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
17 |
18 |
19 |
20 |
21 |
22 |
23 | Home
24 |
25 |
27 |
28 |
29 |
30 |
40 |
41 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/models/cbt_dump.sql:
--------------------------------------------------------------------------------
1 | -- MySQL dump 10.13 Distrib 5.7.31, for Linux (x86_64)
2 | --
3 | -- Host: localhost Database: CBT
4 | -- ------------------------------------------------------
5 | -- Server version 5.7.31-0ubuntu0.18.04.1
6 |
7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10 | /*!40101 SET NAMES utf8 */;
11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12 | /*!40103 SET TIME_ZONE='+00:00' */;
13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
17 |
18 | --
19 | -- Table structure for table `Administrator`
20 | --
21 |
22 | DROP TABLE IF EXISTS `Administrator`;
23 | /*!40101 SET @saved_cs_client = @@character_set_client */;
24 | /*!40101 SET character_set_client = utf8 */;
25 | CREATE TABLE `Administrator` (
26 | `username` varchar(255) NOT NULL DEFAULT 'admin',
27 | `firstName` char(100) NOT NULL DEFAULT 'Admin',
28 | `lastName` char(100) NOT NULL DEFAULT 'Admin',
29 | `imageUrl` varchar(255) DEFAULT '/images/admin.png',
30 | `pw` varchar(255) NOT NULL DEFAULT '$2y$10$B9gGv1ohRO.KubkLY1gyGuwmc0.SNdBYMME8cYsuvVDpC6YdBwNny',
31 | PRIMARY KEY (`username`)
32 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
33 | /*!40101 SET character_set_client = @saved_cs_client */;
34 |
35 | --
36 | -- Dumping data for table `Administrator`
37 | --
38 |
39 | LOCK TABLES `Administrator` WRITE;
40 | /*!40000 ALTER TABLE `Administrator` DISABLE KEYS */;
41 | INSERT INTO `Administrator` VALUES ('admin','Admin','Admin','/images/admin.png','$2y$10$B9gGv1ohRO.KubkLY1gyGuwmc0.SNdBYMME8cYsuvVDpC6YdBwNny');
42 | /*!40000 ALTER TABLE `Administrator` ENABLE KEYS */;
43 | UNLOCK TABLES;
44 |
45 | --
46 | -- Table structure for table `Course`
47 | --
48 |
49 | DROP TABLE IF EXISTS `Course`;
50 | /*!40101 SET @saved_cs_client = @@character_set_client */;
51 | /*!40101 SET character_set_client = utf8 */;
52 | CREATE TABLE `Course` (
53 | `courseId` int(11) NOT NULL AUTO_INCREMENT,
54 | `courseTitle` varchar(255) NOT NULL,
55 | `courseCode` varchar(50) NOT NULL,
56 | PRIMARY KEY (`courseId`)
57 | ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
58 | /*!40101 SET character_set_client = @saved_cs_client */;
59 |
60 | --
61 | -- Dumping data for table `Course`
62 | --
63 |
64 | LOCK TABLES `Course` WRITE;
65 | /*!40000 ALTER TABLE `Course` DISABLE KEYS */;
66 | INSERT INTO `Course` VALUES (1,'Electromagnetic Wave Theory','EEG 509'),(2,'Database Management','CPE 502'),(3,'Signals and Systems','EEG 203'),(4,'Computer Networking Fundamentals','CPE 510');
67 | /*!40000 ALTER TABLE `Course` ENABLE KEYS */;
68 | UNLOCK TABLES;
69 |
70 | --
71 | -- Table structure for table `Course_Examiner`
72 | --
73 |
74 | DROP TABLE IF EXISTS `Course_Examiner`;
75 | /*!40101 SET @saved_cs_client = @@character_set_client */;
76 | /*!40101 SET character_set_client = utf8 */;
77 | CREATE TABLE `Course_Examiner` (
78 | `id` int(11) NOT NULL AUTO_INCREMENT,
79 | `username` varchar(255) DEFAULT NULL,
80 | `courseId` int(11) DEFAULT NULL,
81 | PRIMARY KEY (`id`),
82 | KEY `username` (`username`),
83 | KEY `courseId` (`courseId`),
84 | CONSTRAINT `Course_Examiner_ibfk_1` FOREIGN KEY (`username`) REFERENCES `Examiner` (`username`),
85 | CONSTRAINT `Course_Examiner_ibfk_2` FOREIGN KEY (`courseId`) REFERENCES `Course` (`courseId`)
86 | ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;
87 | /*!40101 SET character_set_client = @saved_cs_client */;
88 |
89 | --
90 | -- Dumping data for table `Course_Examiner`
91 | --
92 |
93 | LOCK TABLES `Course_Examiner` WRITE;
94 | /*!40000 ALTER TABLE `Course_Examiner` DISABLE KEYS */;
95 | INSERT INTO `Course_Examiner` VALUES (1,'jane_osoba',1),(2,'jane_osoba',2),(3,'ayo_ph',1),(4,'ayo_ph',2),(5,'ayo_ph',4);
96 | /*!40000 ALTER TABLE `Course_Examiner` ENABLE KEYS */;
97 | UNLOCK TABLES;
98 |
99 | --
100 | -- Table structure for table `Course_Student`
101 | --
102 |
103 | DROP TABLE IF EXISTS `Course_Student`;
104 | /*!40101 SET @saved_cs_client = @@character_set_client */;
105 | /*!40101 SET character_set_client = utf8 */;
106 | CREATE TABLE `Course_Student` (
107 | `id` int(11) NOT NULL AUTO_INCREMENT,
108 | `username` varchar(15) DEFAULT NULL,
109 | `courseId` int(11) DEFAULT NULL,
110 | PRIMARY KEY (`id`),
111 | KEY `username` (`username`),
112 | KEY `courseId` (`courseId`),
113 | CONSTRAINT `Course_Student_ibfk_1` FOREIGN KEY (`username`) REFERENCES `Student` (`username`),
114 | CONSTRAINT `Course_Student_ibfk_2` FOREIGN KEY (`courseId`) REFERENCES `Course` (`courseId`)
115 | ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
116 | /*!40101 SET character_set_client = @saved_cs_client */;
117 |
118 | --
119 | -- Dumping data for table `Course_Student`
120 | --
121 |
122 | LOCK TABLES `Course_Student` WRITE;
123 | /*!40000 ALTER TABLE `Course_Student` DISABLE KEYS */;
124 | INSERT INTO `Course_Student` VALUES (1,'150408502',1),(2,'150408502',2),(3,'150408502',3),(4,'130408502',2);
125 | /*!40000 ALTER TABLE `Course_Student` ENABLE KEYS */;
126 | UNLOCK TABLES;
127 |
128 | --
129 | -- Table structure for table `Exam`
130 | --
131 |
132 | DROP TABLE IF EXISTS `Exam`;
133 | /*!40101 SET @saved_cs_client = @@character_set_client */;
134 | /*!40101 SET character_set_client = utf8 */;
135 | CREATE TABLE `Exam` (
136 | `examId` int(11) NOT NULL AUTO_INCREMENT,
137 | `instruction` varchar(255) DEFAULT NULL,
138 | `timeDuration` time NOT NULL,
139 | `activated` tinyint(1) NOT NULL DEFAULT '0',
140 | `createdAt` datetime NOT NULL,
141 | `lastModified` datetime NOT NULL,
142 | `courseId` int(11) DEFAULT NULL,
143 | PRIMARY KEY (`examId`),
144 | KEY `courseId` (`courseId`),
145 | CONSTRAINT `Exam_ibfk_1` FOREIGN KEY (`courseId`) REFERENCES `Course` (`courseId`)
146 | ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
147 | /*!40101 SET character_set_client = @saved_cs_client */;
148 |
149 | --
150 | -- Dumping data for table `Exam`
151 | --
152 |
153 | LOCK TABLES `Exam` WRITE;
154 | /*!40000 ALTER TABLE `Exam` DISABLE KEYS */;
155 | INSERT INTO `Exam` VALUES (1,' Attempt all questions. You have 1 hour. If your time runs out, your answers are submitted automatically.','00:45:00',1,'0000-00-00 00:00:00','2019-12-31 04:05:38',1),(2,'Answer just 1 question in 45 minutes. If your time runs out, your answers are submitted automatically.','00:45:00',0,'0000-00-00 00:00:00','0000-00-00 00:00:00',2),(3,'You have 25 minutes. Do what you can. If your time runs out, your answers are submitted automatically.','00:25:00',0,'0000-00-00 00:00:00','0000-00-00 00:00:00',3),(4,' Answer just one question','00:10:00',1,'2019-12-06 17:33:42','2019-12-06 17:33:42',4);
156 | /*!40000 ALTER TABLE `Exam` ENABLE KEYS */;
157 | UNLOCK TABLES;
158 |
159 | --
160 | -- Table structure for table `Examiner`
161 | --
162 |
163 | DROP TABLE IF EXISTS `Examiner`;
164 | /*!40101 SET @saved_cs_client = @@character_set_client */;
165 | /*!40101 SET character_set_client = utf8 */;
166 | CREATE TABLE `Examiner` (
167 | `username` varchar(255) NOT NULL,
168 | `firstName` char(100) NOT NULL,
169 | `lastName` char(100) NOT NULL,
170 | `imageUrl` varchar(255) DEFAULT NULL,
171 | `gender` varchar(50) DEFAULT NULL,
172 | `pw` varchar(255) NOT NULL,
173 | PRIMARY KEY (`username`)
174 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
175 | /*!40101 SET character_set_client = @saved_cs_client */;
176 |
177 | --
178 | -- Dumping data for table `Examiner`
179 | --
180 |
181 | LOCK TABLES `Examiner` WRITE;
182 | /*!40000 ALTER TABLE `Examiner` DISABLE KEYS */;
183 | INSERT INTO `Examiner` VALUES ('ayo_ph','Ayo','Popoola-Herbert','/images/examiner_male.png','male','$2y$10$7s3vhwb/S5k4TgDIvnud3eLVTKaE9XospRMiXHna.3eF8FX5JlLbe'),('jane_osoba','Jane','Osoba','/images/examiner_female.png','female','$2y$10$7s3vhwb/S5k4TgDIvnud3eLVTKaE9XospRMiXHna.3eF8FX5JlLbe');
184 | /*!40000 ALTER TABLE `Examiner` ENABLE KEYS */;
185 | UNLOCK TABLES;
186 |
187 | --
188 | -- Table structure for table `Question`
189 | --
190 |
191 | DROP TABLE IF EXISTS `Question`;
192 | /*!40101 SET @saved_cs_client = @@character_set_client */;
193 | /*!40101 SET character_set_client = utf8 */;
194 | CREATE TABLE `Question` (
195 | `questionId` int(11) NOT NULL AUTO_INCREMENT,
196 | `question` text NOT NULL,
197 | `option1` varchar(255) NOT NULL,
198 | `option2` varchar(255) NOT NULL,
199 | `option3` varchar(255) NOT NULL,
200 | `option4` varchar(255) NOT NULL,
201 | `option5` varchar(255) DEFAULT NULL,
202 | `answer` varchar(255) NOT NULL,
203 | `examId` int(11) DEFAULT NULL,
204 | PRIMARY KEY (`questionId`),
205 | KEY `examId` (`examId`),
206 | CONSTRAINT `Question_ibfk_1` FOREIGN KEY (`examId`) REFERENCES `Exam` (`examId`)
207 | ) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=latin1;
208 | /*!40101 SET character_set_client = @saved_cs_client */;
209 |
210 | --
211 | -- Dumping data for table `Question`
212 | --
213 |
214 | LOCK TABLES `Question` WRITE;
215 | /*!40000 ALTER TABLE `Question` DISABLE KEYS */;
216 | INSERT INTO `Question` VALUES (1,'What is Kirchoff\'s Voltage Law?','The sum of all voltages is zero.','It states that the total current around a closed loop must be zero.','It states that the total voltage around a closed loop must be zero.','A and C above','None of the above','It states that the total voltage around a closed loop must be zero.',1),(2,'What is Kirchoff\'s Current Law?','The sum of all voltages is zero.','It states that the total current around a closed loop must be zero.','It states that the total voltage around a closed loop must be zero.','A and C above','None of the above','It states that the total voltage around a closed loop must be zero.',1),(3,'What is Kirchoff\'s Voltage Law?','The sum of all voltages is zero.','It states that the total current around a closed loop must be zero.','It states that the total voltage around a closed loop must be zero.','A and C above','None of the above','It states that the total voltage around a closed loop must be zero.',1),(4,'What is Kirchoff\'s Current Law?','The sum of all voltages is zero.','It states that the total current around a closed loop must be zero.','It states that the total voltage around a closed loop must be zero.','A and C above','None of the above','It states that the total voltage around a closed loop must be zero.',1),(5,'What is Kirchoff\'s Voltage Law?','The sum of all voltages is zero.','It states that the total current around a closed loop must be zero.','It states that the total voltage around a closed loop must be zero.','A and C above','None of the above','It states that the total voltage around a closed loop must be zero.',1),(6,'What is Kirchoff\'s Current Law?','The sum of all voltages is zero.','It states that the total current around a closed loop must be zero.','It states that the total voltage around a closed loop must be zero.','A and C above','None of the above','It states that the total voltage around a closed loop must be zero.',1),(7,'What is Kirchoff\'s Voltage Law?','The sum of all voltages is zero.','It states that the total current around a closed loop must be zero.','It states that the total voltage around a closed loop must be zero.','A and C above','None of the above','It states that the total voltage around a closed loop must be zero.',1),(8,'Normalization solves the problem of?','Data redundancy','Insert anomaly','Delete anomaly','Update anomaly','All of the above','All of the above',2),(9,'MySQL is a type of _____ database?','relational','non-relational','object-oriented','heirachical','MongoDB','relational',2),(10,'Normalization solves the problem of?','Data redundancy','Insert anomaly','Delete anomaly','Update anomaly','All of the above','All of the above',2),(11,'MySQL is a type of _____ database?','relational','non-relational','object-oriented','heirachical','MongoDB','relational',2),(12,'Normalization solves the problem of?','Data redundancy','Insert anomaly','Delete anomaly','Update anomaly','All of the above','All of the above',2),(13,'MySQL is a type of _____ database?','relational','non-relational','object-oriented','heirachical','MongoDB','relational',2),(14,'Normalization solves the problem of?','Data redundancy','Insert anomaly','Delete anomaly','Update anomaly','All of the above','All of the above',2),(15,'MySQL is a type of _____ database?','relational','non-relational','object-oriented','heirachical','MongoDB','relational',2),(16,'Which of the following is an even signal?','x(t)=sin(wt)','y(t)=sin(wt+2)','z(t)=cos(wt)','A and B above','None of the above','z(t)=cos(wt)',3),(17,'How is the discrete time impulse function defined in terms of the step function?','d[n] = u[n+1] – u[n]','d[n] = u[n] – u[n-2]','d[n] = u[n] – u[n-1]','d[n] = u[n+1] – u[n-1]','d[n] = u[n+1] – u[n-12]','d[n] = u[n] – u[n-1]',3),(18,'A system with memory which anticipates future values of input is called _________ ','Non-causal System ','Non-anticipative System','Causal System','Static System ','Stable system','Non-causal System',3),(19,'Determine the nature of the system: y(n)=x(-n).','Causal','Non-causal','Causal for all positive values of n','Non-causal for negative values of n','None of the above','Non-causal',3),(20,'Which of the following is an even signal?','x(t)=sin(wt)','y(t)=sin(wt+2)','z(t)=cos(wt)','A and B above','None of the above','z(t)=cos(wt)',3),(21,'How is the discrete time impulse function defined in terms of the step function?','d[n] = u[n+1] – u[n]','d[n] = u[n] – u[n-2]','d[n] = u[n] – u[n-1]','d[n] = u[n+1] – u[n-1]','d[n] = u[n+1] – u[n-12]','d[n] = u[n] – u[n-1]',3),(22,'A system with memory which anticipates future values of input is called _________ ','Non-causal System ','Non-anticipative System','Causal System','Static System ','Stable system','Non-causal System',3),(23,'Determine the nature of the system: y(n)=x(-n).','Causal','Non-causal','Causal for all positive values of n','Non-causal for negative values of n','None of the above','Non-causal',3),(24,' What is an electric field?','A force surrounding a charge','An area with grass around electricity','A field with an electric fence','A force to reckon with','None of the above','A force surrounding a charge',4);
217 | /*!40000 ALTER TABLE `Question` ENABLE KEYS */;
218 | UNLOCK TABLES;
219 |
220 | --
221 | -- Table structure for table `Student`
222 | --
223 |
224 | DROP TABLE IF EXISTS `Student`;
225 | /*!40101 SET @saved_cs_client = @@character_set_client */;
226 | /*!40101 SET character_set_client = utf8 */;
227 | CREATE TABLE `Student` (
228 | `username` varchar(15) NOT NULL,
229 | `firstName` char(100) NOT NULL,
230 | `lastName` char(100) NOT NULL,
231 | `imageUrl` varchar(255) DEFAULT NULL,
232 | `gender` varchar(50) DEFAULT NULL,
233 | `pw` varchar(255) NOT NULL,
234 | PRIMARY KEY (`username`)
235 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
236 | /*!40101 SET character_set_client = @saved_cs_client */;
237 |
238 | --
239 | -- Dumping data for table `Student`
240 | --
241 |
242 | LOCK TABLES `Student` WRITE;
243 | /*!40000 ALTER TABLE `Student` DISABLE KEYS */;
244 | INSERT INTO `Student` VALUES ('130408016','Feyisola','Adelaja','/images/student_female_2.jpg','female','$2y$10$pnqojnaPkOnCB4B79PFNrexxO2GRhV6PrcgP/1yayZNQ1DFXI48z6'),('130408502','Omi','Obi','/images/student_male.jpg','male','$2y$10$7s3vhwb/S5k4TgDIvnud3eLVTKaE9XospRMiXHna.3eF8FX5JlLbe'),('150408502','Karen','Okonkwo','/images/student_female_3.jpg','female','$2y$10$7s3vhwb/S5k4TgDIvnud3eLVTKaE9XospRMiXHna.3eF8FX5JlLbe');
245 | /*!40000 ALTER TABLE `Student` ENABLE KEYS */;
246 | UNLOCK TABLES;
247 |
248 | --
249 | -- Table structure for table `Student_Result`
250 | --
251 |
252 | DROP TABLE IF EXISTS `Student_Result`;
253 | /*!40101 SET @saved_cs_client = @@character_set_client */;
254 | /*!40101 SET character_set_client = utf8 */;
255 | CREATE TABLE `Student_Result` (
256 | `studentId` varchar(255) NOT NULL,
257 | `examId` int(11) NOT NULL,
258 | `score` int(11) NOT NULL,
259 | `scoreOverall` int(11) NOT NULL,
260 | `submitTime` datetime NOT NULL,
261 | PRIMARY KEY (`studentId`,`examId`),
262 | KEY `examId` (`examId`),
263 | CONSTRAINT `Student_Result_ibfk_1` FOREIGN KEY (`studentId`) REFERENCES `Student` (`username`),
264 | CONSTRAINT `Student_Result_ibfk_2` FOREIGN KEY (`examId`) REFERENCES `Exam` (`examId`)
265 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
266 | /*!40101 SET character_set_client = @saved_cs_client */;
267 |
268 | --
269 | -- Dumping data for table `Student_Result`
270 | --
271 |
272 | LOCK TABLES `Student_Result` WRITE;
273 | /*!40000 ALTER TABLE `Student_Result` DISABLE KEYS */;
274 | INSERT INTO `Student_Result` VALUES ('150408502',1,4,7,'2019-12-31 04:04:44');
275 | /*!40000 ALTER TABLE `Student_Result` ENABLE KEYS */;
276 | UNLOCK TABLES;
277 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
278 |
279 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
280 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
281 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
282 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
283 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
284 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
285 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
286 |
287 | -- Dump completed on 2020-10-21 13:26:22
288 |
--------------------------------------------------------------------------------
/models/course-examiner.csv:
--------------------------------------------------------------------------------
1 | username, courseId
2 | "jane_osoba",1
3 | "jane_osoba",2
4 | "ayo_ph",1
5 | "ayo_ph",2
6 | "ayo_ph",4
--------------------------------------------------------------------------------
/models/course-student.csv:
--------------------------------------------------------------------------------
1 | matricNo, courseId
2 | "150408502",1
3 | "150408502",2
4 | "150408502",3
5 | "130408502",2
--------------------------------------------------------------------------------
/models/courses.csv:
--------------------------------------------------------------------------------
1 | courseTitle,courseCode
2 | "Electromagnetic Wave Theory","EEG 509"
3 | "Database Management","CPE 502"
4 | "Signals and Systems","EEG 203"
5 | "Computer Networking Fundamentals","CPE 510"
--------------------------------------------------------------------------------
/models/examination.csv:
--------------------------------------------------------------------------------
1 | instruction,timeDuration,activated,createdAt,lastModified,courseId
2 | "Attempt all questions. You have 1 hour. If your time runs out, your answers are submitted automatically.","01:00:00",TRUE,NOW(),NOW(),1
3 | "Answer just 1 question in 45 minutes. If your time runs out, your answers are submitted automatically.","00:45:00",TRUE,NOW(),NOW(),2
4 | "You have 25 minutes. Do what you can. If your time runs out, your answers are submitted automatically.","00:25:00",TRUE,NOW(),NOW(),3
--------------------------------------------------------------------------------
/models/examiners.csv:
--------------------------------------------------------------------------------
1 | username,firstName,lastName,imageUrl,gender,password
2 | "jane_osoba","Jane","Osoba","/images/examiner_female.png","female","$2y$10$7s3vhwb/S5k4TgDIvnud3eLVTKaE9XospRMiXHna.3eF8FX5JlLbe"
3 | "ayo_ph","Ayo","Popoola-Herbert","/images/examiner_male.png","male","$2y$10$7s3vhwb/S5k4TgDIvnud3eLVTKaE9XospRMiXHna.3eF8FX5JlLbe"
4 |
--------------------------------------------------------------------------------
/models/questions.csv:
--------------------------------------------------------------------------------
1 | question,option1,option2,option3,option4,option5,answer,examId
2 | "What is Kirchoff\'s Voltage Law?","The sum of all voltages is zero.","It states that the total current around a closed loop must be zero.","It states that the total voltage around a closed loop must be zero.","A and C above","None of the above","It states that the total voltage around a closed loop must be zero.",1
3 | "What is Kirchoff\'s Current Law?","The sum of all voltages is zero.","It states that the total current around a closed loop must be zero.","It states that the total voltage around a closed loop must be zero.","A and C above","None of the above","It states that the total voltage around a closed loop must be zero.",1
4 | "What is Kirchoff\'s Voltage Law?","The sum of all voltages is zero.","It states that the total current around a closed loop must be zero.","It states that the total voltage around a closed loop must be zero.","A and C above","None of the above","It states that the total voltage around a closed loop must be zero.",1
5 | "What is Kirchoff\'s Current Law?","The sum of all voltages is zero.","It states that the total current around a closed loop must be zero.","It states that the total voltage around a closed loop must be zero.","A and C above","None of the above","It states that the total voltage around a closed loop must be zero.",1
6 | "What is Kirchoff\'s Voltage Law?","The sum of all voltages is zero.","It states that the total current around a closed loop must be zero.","It states that the total voltage around a closed loop must be zero.","A and C above","None of the above","It states that the total voltage around a closed loop must be zero.",1
7 | "What is Kirchoff\'s Current Law?","The sum of all voltages is zero.","It states that the total current around a closed loop must be zero.","It states that the total voltage around a closed loop must be zero.","A and C above","None of the above","It states that the total voltage around a closed loop must be zero.",1
8 | "What is Kirchoff\'s Voltage Law?","The sum of all voltages is zero.","It states that the total current around a closed loop must be zero.","It states that the total voltage around a closed loop must be zero.","A and C above","None of the above","It states that the total voltage around a closed loop must be zero.",1
9 | "Normalization solves the problem of?","Data redundancy","Insert anomaly","Delete anomaly","Update anomaly","All of the above","All of the above",2
10 | "MySQL is a type of _____ database?","relational","non-relational","object-oriented","heirachical","MongoDB","relational",2
11 | "Normalization solves the problem of?","Data redundancy","Insert anomaly","Delete anomaly","Update anomaly","All of the above","All of the above",2
12 | "MySQL is a type of _____ database?","relational","non-relational","object-oriented","heirachical","MongoDB","relational",2
13 | "Normalization solves the problem of?","Data redundancy","Insert anomaly","Delete anomaly","Update anomaly","All of the above","All of the above",2
14 | "MySQL is a type of _____ database?","relational","non-relational","object-oriented","heirachical","MongoDB","relational",2
15 | "Normalization solves the problem of?","Data redundancy","Insert anomaly","Delete anomaly","Update anomaly","All of the above","All of the above",2
16 | "MySQL is a type of _____ database?","relational","non-relational","object-oriented","heirachical","MongoDB","relational",2
17 | "Which of the following is an even signal?","x(t)=sin(wt)","y(t)=sin(wt+2)","z(t)=cos(wt)","A and B above","None of the above","z(t)=cos(wt)",3
18 | "How is the discrete time impulse function defined in terms of the step function?","d[n] = u[n+1] – u[n]","d[n] = u[n] – u[n-2]","d[n] = u[n] – u[n-1]","d[n] = u[n+1] – u[n-1]","d[n] = u[n+1] – u[n-12]","d[n] = u[n] – u[n-1]",3
19 | "A system with memory which anticipates future values of input is called _________ ","Non-causal System ","Non-anticipative System","Causal System","Static System ","Stable system","Non-causal System",3
20 | "Determine the nature of the system: y(n)=x(-n).","Causal","Non-causal","Causal for all positive values of n","Non-causal for negative values of n","None of the above","Non-causal",3
21 | "Which of the following is an even signal?","x(t)=sin(wt)","y(t)=sin(wt+2)","z(t)=cos(wt)","A and B above","None of the above","z(t)=cos(wt)",3
22 | "How is the discrete time impulse function defined in terms of the step function?","d[n] = u[n+1] – u[n]","d[n] = u[n] – u[n-2]","d[n] = u[n] – u[n-1]","d[n] = u[n+1] – u[n-1]","d[n] = u[n+1] – u[n-12]","d[n] = u[n] – u[n-1]",3
23 | "A system with memory which anticipates future values of input is called _________ ","Non-causal System ","Non-anticipative System","Causal System","Static System ","Stable system","Non-causal System",3
24 | "Determine the nature of the system: y(n)=x(-n).","Causal","Non-causal","Causal for all positive values of n","Non-causal for negative values of n","None of the above","Non-causal",3
--------------------------------------------------------------------------------
/models/schema.sql:
--------------------------------------------------------------------------------
1 | CREATE DATABASE IF NOT EXISTS CBT;
2 | USE CBT;
3 |
4 | -- SET FOREIGN_KEY_CHECKS = 0;
5 | -- DROP TABLE Student;
6 | -- DROP TABLE Administrator;
7 | -- DROP TABLE Examiner;
8 | -- DROP TABLE Course_Examiner;
9 | -- DROP TABLE Course_Student;
10 | -- DROP TABLE Course;
11 | -- DROP TABLE Exam;
12 | -- DROP TABLE Question;
13 | -- DROP TABLE Student_Result;
14 |
15 |
16 |
17 | -- Create the required tables
18 |
19 | CREATE TABLE IF NOT EXISTS Student (
20 | username VARCHAR(15) PRIMARY KEY NOT NULL,
21 | firstName CHAR(100) NOT NULL,
22 | lastName CHAR(100) NOT NULL,
23 | imageUrl VARCHAR(255),
24 | gender VARCHAR(50),
25 | pw VARCHAR(255) NOT NULL -- password
26 | );
27 |
28 |
29 | CREATE TABLE IF NOT EXISTS Administrator (
30 | username VARCHAR(255) PRIMARY KEY NOT NULL DEFAULT "admin",
31 | firstName CHAR(100) NOT NULL DEFAULT "Admin",
32 | lastName CHAR(100) NOT NULL DEFAULT "Admin",
33 | imageUrl VARCHAR(255) DEFAULT "/images/admin.png",
34 | pw VARCHAR(255) NOT NULL DEFAULT "$2y$10$B9gGv1ohRO.KubkLY1gyGuwmc0.SNdBYMME8cYsuvVDpC6YdBwNny" -- password
35 | );
36 |
37 |
38 | CREATE TABLE IF NOT EXISTS Examiner (
39 | username VARCHAR(255) PRIMARY KEY NOT NULL,
40 | firstName CHAR(100) NOT NULL,
41 | lastName CHAR(100) NOT NULL,
42 | imageUrl VARCHAR(255),
43 | gender VARCHAR(50),
44 | pw VARCHAR(255) NOT NULL -- password
45 |
46 | );
47 |
48 |
49 | CREATE TABLE IF NOT EXISTS Course (
50 | courseId INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
51 | courseTitle VARCHAR(255) NOT NULL,
52 | courseCode VARCHAR(50) NOT NULL
53 | );
54 |
55 | CREATE TABLE IF NOT EXISTS Exam (
56 | examId INT PRIMARY KEY AUTO_INCREMENT,
57 | instruction VARCHAR(255),
58 | timeDuration TIME NOT NULL,
59 | activated BOOLEAN DEFAULT FALSE NOT NULL,
60 | createdAt DATETIME NOT NULL,
61 | lastModified DATETIME NOT NULL,
62 | courseId INT,
63 | FOREIGN KEY (courseId) REFERENCES Course(courseId)
64 | );
65 |
66 | CREATE TABLE IF NOT EXISTS Question (
67 | questionId INT PRIMARY KEY AUTO_INCREMENT,
68 | question TEXT NOT NULL,
69 | option1 VARCHAR(255) NOT NULL,
70 | option2 VARCHAR(255) NOT NULL,
71 | option3 VARCHAR(255) NOT NULL,
72 | option4 VARCHAR(255) NOT NULL,
73 | option5 VARCHAR(255), -- optional
74 | answer VARCHAR(255) NOT NULL,
75 | examId INT,
76 | FOREIGN KEY (examId) REFERENCES Exam(examId)
77 | );
78 |
79 |
80 | CREATE TABLE IF NOT EXISTS Student_Result (
81 | studentId VARCHAR(255) NOT NULL,
82 | examId INT NOT NULL,
83 | score INT NOT NULL,
84 | scoreOverall INT NOT NULL,
85 | submitTime DATETIME NOT NULL,
86 | FOREIGN KEY (studentId) REFERENCES Student(username),
87 | FOREIGN KEY (examId) REFERENCES Exam(examId),
88 | PRIMARY KEY (studentId, examId)
89 | );
90 |
91 |
92 |
93 | -- Intermediary table for Course and Student
94 | CREATE TABLE IF NOT EXISTS Course_Student (
95 | id INT PRIMARY KEY AUTO_INCREMENT,
96 | username VARCHAR(15) ,
97 | courseId INT,
98 | FOREIGN KEY (username) REFERENCES Student(username),
99 | FOREIGN KEY (courseId) REFERENCES Course(courseId)
100 | );
101 |
102 | -- Intermediary table for Course and Examiner
103 | CREATE TABLE IF NOT EXISTS Course_Examiner (
104 | id INT PRIMARY KEY AUTO_INCREMENT,
105 | username VARCHAR(255),
106 | courseId INT,
107 | FOREIGN KEY (username) REFERENCES Examiner(username),
108 | FOREIGN KEY (courseId) REFERENCES Course(courseId)
109 | );
110 |
111 | SHOW TABLES;
112 |
113 | -- DESCRIBE Student;
114 | -- DESCRIBE Administrator;
115 | -- DESCRIBE Examiner;
116 | -- DESCRIBE Course_Examiner;
117 | -- DESCRIBE Course_Student;
118 | -- DESCRIBE Course;
119 | -- DESCRIBE Exam;
120 | -- DESCRIBE Question;
121 | -- DESCRIBE Student_Result;
122 |
123 |
124 | -- Load Student Data from CSV file
125 | LOAD DATA
126 | LOCAL INFILE "/home/kars/Downloads/cbe-software/models/students.csv"
127 | INTO TABLE Student
128 | FIELDS TERMINATED BY ","
129 | OPTIONALLY ENCLOSED BY '"'
130 | LINES TERMINATED BY "\n"
131 | IGNORE 1 ROWS;
132 | -- SELECT * FROM Student;
133 |
134 | -- Load Examiner Data from CSV file
135 | LOAD DATA
136 | LOCAL INFILE "/home/kars/Downloads/cbe-software/models/examiners.csv"
137 | INTO TABLE Examiner
138 | FIELDS TERMINATED BY ","
139 | OPTIONALLY ENCLOSED BY '"'
140 | LINES TERMINATED BY "\n"
141 | IGNORE 1 ROWS;
142 | -- SELECT * FROM Examiner;
143 |
144 | INSERT INTO Administrator VALUES ();
145 | -- SELECT * FROM Administrator;
146 |
147 | -- Load Course Data from CSV file
148 | LOAD DATA
149 | LOCAL INFILE "/home/kars/Downloads/cbe-software/models/courses.csv"
150 | INTO TABLE Course
151 | FIELDS TERMINATED BY ","
152 | OPTIONALLY ENCLOSED BY '"'
153 | LINES TERMINATED BY "\n"
154 | IGNORE 1 ROWS
155 | (courseTitle, courseCode);
156 | -- SELECT * FROM Course;
157 |
158 | -- Load Exam Data from CSV file
159 | LOAD DATA
160 | LOCAL INFILE "/home/kars/Downloads/cbe-software/models/examination.csv"
161 | INTO TABLE Exam
162 | FIELDS TERMINATED BY ","
163 | OPTIONALLY ENCLOSED BY '"'
164 | LINES TERMINATED BY "\n"
165 | IGNORE 1 ROWS
166 | (instruction, timeDuration, activated, createdAt, lastModified, courseId)
167 | ;
168 | -- SELECT * FROM Exam;
169 |
170 | -- Load Question Data from CSV file
171 | LOAD DATA
172 | LOCAL INFILE "/home/kars/Downloads/cbe-software/models/questions.csv"
173 | INTO TABLE Question
174 | FIELDS TERMINATED BY ","
175 | OPTIONALLY ENCLOSED BY '"'
176 | LINES TERMINATED BY "\n"
177 | IGNORE 1 ROWS
178 | (question,option1,option2,option3,option4,option5,answer,examId);
179 | -- SELECT * FROM Question;
180 |
181 | LOAD DATA
182 | LOCAL INFILE "/home/kars/Downloads/cbe-software/models/course-examiner.csv"
183 | INTO TABLE Course_Examiner
184 | FIELDS TERMINATED BY ","
185 | OPTIONALLY ENCLOSED BY '"'
186 | LINES TERMINATED BY "\n"
187 | IGNORE 1 ROWS
188 | (username, courseId );
189 | -- SELECT * FROM Course_Examiner;
190 |
191 | LOAD DATA
192 | LOCAL INFILE "/home/kars/Downloads/cbe-software/models/course-student.csv"
193 | INTO TABLE Course_Student
194 | FIELDS TERMINATED BY ","
195 | OPTIONALLY ENCLOSED BY '"'
196 | LINES TERMINATED BY "\n"
197 | IGNORE 1 ROWS
198 | (username, courseId );
199 | -- SELECT * FROM Course_Student;
200 |
201 |
202 |
203 | -- The courses a student is offering
204 | SELECT Course.courseCode, courseTitle, instruction, timeDuration, activated, createdAt, lastModified, Exam.courseId
205 | FROM Course, Course_Student, Exam
206 | WHERE Course.courseId = Course_Student.id AND Course.courseId = Exam.courseId ;
207 |
--------------------------------------------------------------------------------
/models/students.csv:
--------------------------------------------------------------------------------
1 | username,firstName,lastName,imageUrl,gender,password
2 | "150408502","Karen","Okonkwo","/images/student_female_3.jpg","female","$2y$10$7s3vhwb/S5k4TgDIvnud3eLVTKaE9XospRMiXHna.3eF8FX5JlLbe"
3 | "130408502","Omi","Obi","/images/student_male.jpg","male","$2y$10$7s3vhwb/S5k4TgDIvnud3eLVTKaE9XospRMiXHna.3eF8FX5JlLbe"
4 | "130408016","Feyisola","Adelaja","/images/student_female_2.jpg","female","$2y$10$pnqojnaPkOnCB4B79PFNrexxO2GRhV6PrcgP/1yayZNQ1DFXI48z6"
--------------------------------------------------------------------------------
/views/admin_home.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Admin
8 |
9 |
11 |
12 |
13 |
14 |
15 |
16 |