"; } */ // header("Location: http://students.washington.edu/irina/tests/emailer.php?mb=$mb&sbj=$subject&stname=$stname&email=$email&uri=$uri"); // exit(); $sent = mail($mailto, "Persian Test System - $subject", $mailtext, $header); exit(' '.$test_title.'

'.($sent?"Your results have successfully been sent to your Instructor!":$error)."

Back to the Persian Tests "); } $user_answers = ''; $correct_answers = ''; $correct = 0; if (isset($_POST['data'])) { $data = $_POST['data']; $newdata = explode(":", base64_decode($data)); $answer = $newdata[0]; $variant = $newdata[1]; $answers = explode(",", $newdata[2]); $questions = explode(",", $newdata[3]); $question = $newdata[4]; if (isset($_POST['R1'])) { if (intval($_POST['R1'])-1==$answer) { $correct++; $correct_answers .= '1'; } else { $correct_answers .= '0'; } $user_answers .= $_POST['R1']; } else { $user_answers .= '0'; $correct_answers .= '0'; } if ($correct) { $question++; } } else { $questions = array(); for ($i=1; $i<=$total; $i++) { $questions[$i-1] = ceil($i/10); } shuffle($questions); $question = 1; $correct = 1; } $t = $questions[$question-1]; switch ($t) { case 1: $filenames = array("0100am", "0100pm", "0200am", "0200pm", "0300am", "0300pm", "0400am", "0400pm", "0500am", "0500pm", "0600am", "0600pm", "0700am", "0700pm", "0800am", "0800pm", "0900am", "0900pm", "1000am", "1000pm", "1100am", "1100pm", "1200am", "1200pm"); $variants = array("0100pm" => 2, "0200am" => 2, "0200pm" => 2, "0300am" => 2, "0300pm" => 2, "0400pm" => 2, "0500am" => 4, "0600am" => 2, "0700am" => 3, "0700pm" => 2, "0800pm" => 2, "1200pm" => 2); break; case 2: $filenames = array("0130", "0230", "0330", "0430", "0530", "0630", "0730", "0830", "0930", "1030", "1130", "1230"); break; case 3: $filenames = array("0115", "0215", "0315", "0415", "0515", "0615", "0715", "0815", "0915", "1015", "1115", "1215"); break; case 4: $filenames = array("0145", "0245", "0345", "0445", "0545", "0645", "0745", "0845", "0945", "1045", "1145", "1245"); $variants = array("0145" => 2, "0245" => 2, "1045" => 2); break; default: break; } if ($correct && $question<=$total) { srand((float)microtime() * 1000000); $answers = array_rand($filenames, 4); shuffle($answers); $answer = rand(0, 3); $variant = ""; if (isset($variants[$filenames[$answers[$answer]]])) $variant = rand(1, $variants[$filenames[$answers[$answer]]]); if ($variant==1) $variant = ""; $data = "$answer:$variant:".implode(",", $answers).":".implode(",", $questions).":$question"; $data = base64_encode($data); } ?> \n"; } else { print "\n"; } ?>

$total) { print "

You have answered all $total questions correctly. Fill the form and click the button to send the results to your instructor:

\n"; include("emailform.php"); exit(); } else { print "

Question $question out of $total"; } ?>

You are wrong! Please try again!"; } print "

Please click to hear the time in Persian and then select the right answer from the choices below.

ساعت چنده؟"; ?>

*/ print ""; print ""; print ""; print "
"; $text = $filenames[$answers[0]]; print substr($text, 0, 2).":".substr($text, 2, 2).($t==1?" ".substr($text, 4, 1).".m.":"")."
"; $text = $filenames[$answers[1]]; print substr($text, 0, 2).":".substr($text, 2, 2).($t==1?" ".substr($text, 4, 1).".m.":"")."
"; $text = $filenames[$answers[2]]; print substr($text, 0, 2).":".substr($text, 2, 2).($t==1?" ".substr($text, 4, 1).".m.":"")."
"; $text = $filenames[$answers[3]]; print substr($text, 0, 2).":".substr($text, 2, 2).($t==1?" ".substr($text, 4, 1).".m.":"")."
"; } print "

"; ?>


Back to the Tests