Hi all,
I'm using some code snippets from the code library (games cat.) to build an exam/testing engine for my website mcsedriller.com. The author of the code told me I needed PHP4 so I switched to another provider which supports php4 and claims to have almost all modules compiled. I managed to create something workable from the snipplets except for one problem: sometimes it works sometimes it doesn't...
The main php file starts out like this:
<?php
include("multiquiz.php");
session_start();
session_register("quiz");
if (!$quiz || !$curr) { $quiz = new quiz "702102.xml");}
if (!$curr) { $curr = 0; }
?>
<head>
<title>...</title>
</head>
<body>
<br>
<?php
Tally quiztaker's answer to previous question.
if (!$choice) { $choice = array(); }
if ($curr) {$quiz->tally($curr, $choice);}
$curr++;
Have we reached the end of the quiz?
if ($curr <= $quiz->length()) {
Display the next question code...
} else {
Show the score code...
session_destroy();
}
?>
</body>
$curr is the number of questions, multiquiz.php contains the quiz class and others which are used to generate the quiz from the parsed xml file.
Sometimes it starts with showing the first question, sometimes it starts with the 'end' showing an end score with 0 point out of 0 questions... Is $curr empty? Or doesn't the session start or register? (don't have access to servers php logs, but I don't get an error message when I destroy the session... so it must be started)
(stripped example http://www.mcsedriller.com/70210/exam2)
How can it be that it works on and off...?
Any idea would be greatly appreciated! This is the only thing standing in the way from launching my site...