getUser() != $user->getId()) { header("Location: //".$_SERVER['HTTP_HOST']); exit(); } $res = $result->getResult(); foreach($res as $p=>$r) { $_POST[$p] = $r; } $_POST['mark'] = 1; } elseif (isset($_REQUEST['results']) && is_object($user)) { $results = $user->getResults(); } if (isset($_POST['mark'])) { unset($_POST['mark']); $score['total'] = $score['correct'] = $score['wrong'] = 0; foreach($_POST as $i=>$q) { $question = Question::getById($i); $answer = Answer::getById($q); if(!is_object($question) || !is_object($answer)) continue; if($answer->isCorrect()) { $score['correct']++; } else { $output .= "".$question->getQuestion()."
"; $corAnswer = $question->getCorrectAnswer(); $output .= "Your Answer: ".$answer->getAnswer()."
Correct Answer: ".$corAnswer->getAnswer().'

'; $score['wrong']++; } $score['total']++; } if(is_object($user)) { $user->storeResult($_POST, $score); } } else { define('QUESTION_COUNT', isset($_GET['questions'])?intval($_GET['questions']):"60"); $questions = Question::getQuestions(QUESTION_COUNT); } ?> NZART - Practice Exam
Result History. Welcome Back ".$_SESSION['username'].".
Logout"; } else { echo "
Login or Register
"; } ?>
New Exam: 10 Questions (Random) - 60 Questions (Full Exam) -

Score ".(($score['correct']/$score['total'])*100)."% (".$score['correct']."/".$score['total'].")"; echo $output; } elseif (isset($results)) { $day = []; foreach ($results as $i=>$result) { $score = $result->getScore(); $date = date("Y-m-d", $result->getTime()); $day[$date][] = date("h:i a", $result->getTime())." - Score ".(($score['correct']/$score['total'])*100)."% (".$score['correct']."/".$score['total']."). ". "View Result
"; $day[$date]['total'][] = ($score['correct'] / $score['total']) * 100; } foreach ($day as $t=>$da) { echo "
".$t." - "; $total = 0; foreach($da['total'] as $t) { $total = $total+$t; } $total = round(($total/count($da['total'])),2); echo $total."% Average
"; unset($da['total']); foreach($da as $c=>$d) { echo $d; } } } else { if(!is_object($user)) { ?> Please Login to track results.
Questions

$q) { echo ""; echo ""; echo ""; echo ""; if(!empty($q->getImage())) { echo ""; echo ""; echo ""; } foreach($q->answers as $x=>$ans) { echo ""; echo ""; echo ""; echo ""; } echo ""; } ?>
".($i+1)."".$q->getQuestion()."
getImage())."'>
".($letters[$x].". ".$ans->getAnswer())."