#!/usr/bin/perl require('./initiate.pl'); require('./quirex-lib.pl'); require('./showquiz.pl'); require('./showrecord.pl'); #### use CGI ':standard'; print header; srand(time+getpid); flock(TEMP, 2); open(TEMP, $template) or error("Cannot open $template: $!"); while (my $line = ) { if ($line =~ /(.*)(.*)/i) { print $1; if (param('quiz') ne "") { if (&QuizExists(param('quiz'))) { if (param('action') eq "done") { if (param('name') eq "" || param('email') eq "") { &error('Both your Name and Email are required to take the quiz.'); } else { &CheckAnswers(param('quiz')); } } elsif (param('show') ne "") { &ShowRecords(param('quiz'), param('show')); } elsif (uc($ENV{'REQUEST_METHOD'}) eq "GET") { &ShowQuiz(param('quiz')); } else { if (param('name') eq "" || param('email') eq "") { &ShowQuizList('Both your Name and Email are required to take the quiz.'); } else { &ShowQuiz(param('quiz')); } } } else { &ShowQuizList(); } } else { &ShowQuizList(); } print $2; } else { print $line; } } close(TEMP); flock(TEMP, 8);