4) $t = 1; $test_title = "What time is it?"; $bgcolor = ""; 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 (isset($_POST['check'])) { $data = $_POST['data']; $newdata = explode(":", base64_decode($data)); $answer = $newdata[0]; $variant = $newdata[1]; $questions = explode(",", $newdata[2]); } else { srand((float)microtime() * 1000000); $questions = array_rand($filenames, 4); shuffle($questions); $answer = rand(0, 3); $variant = ""; if (isset($variants[$filenames[$questions[$answer]]])) $variant = rand(1, $variants[$filenames[$questions[$answer]]]); if ($variant==1) $variant = ""; $data = "$answer:$variant:".implode(",", $questions); $data = base64_encode($data); } ?> \n

$test_title

\n"; print "

You have answered the question correctly.
Try to answer another question.\n"; exit("

Back to the Tests

"); } print "\n"; } else { print "\n"; } ?>

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[$questions[0]]; print substr($text, 0, 2).":".substr($text, 2, 2).($t==1?" ".substr($text, 4, 1).".m.":"")."
"; $text = $filenames[$questions[1]]; print substr($text, 0, 2).":".substr($text, 2, 2).($t==1?" ".substr($text, 4, 1).".m.":"")."
"; $text = $filenames[$questions[2]]; print substr($text, 0, 2).":".substr($text, 2, 2).($t==1?" ".substr($text, 4, 1).".m.":"")."
"; $text = $filenames[$questions[3]]; print substr($text, 0, 2).":".substr($text, 2, 2).($t==1?" ".substr($text, 4, 1).".m.":"")."
"; } print "

"; ?>


Back to the Tests