<?PHP
##Included by snoopy.php to determine whether the subject gets a certificate.
##This will end up being more intensive than it is originally.

##Check how many of the questions he got right.  80% passes.
$query="select * from question where enrollee_id=$enrollee_id";
$res=mysql_query($query);
$nq=$nright=$nwrong=0;
while ($question=mysql_fetch_array($res))
{
  $nq++;
  if($question["correct"] == $question["subjectanswer"])
    $nright++;
  else
    $nwrong++;
}
if ($nright >= (0.8*$nq))
  $decide=1;
else
  $decide=0;
?>
