11) $t = 1; if ($t==11) $test_title = "Combined Writing Conventions Test 2"; else $test_title = "Writing Conventions Test 2"; $bgcolor = ""; //#################################### // Sending a letter to the instructor if (isset($_POST['sendinfo'])) { $stname = htmlspecialchars($_POST['stname']); $email = htmlspecialchars($_POST['email']); if ($_POST['univer']=='University of Texas at Austin') { include "vars.php"; $link = mysql_connect("localhost", $login, $pass) or die("Could not connect: " . mysql_error()); mysql_select_db($db) or die("Could not select database"); $sql = "INSERT INTO test_results (`date`, `name`, `email`, `othertest_id`, `grade`, `comment`) VALUES ('".date('Y-m-d H:i:s')."', '$stname', '$email', 23, 'A', '');"; mysql_query($sql); } $mailtext = "This is the letter from the $test_title page. {$_POST['stname']} from {$_POST['univer']} has successfully answered all the questions of this test! His/her e-mail is {$_POST['email']} Best regards, Persian Test System {$_SERVER['HTTP_REFERER']}"; $uri = $_SERVER['HTTP_REFERER']; $header = "From: {$_POST['email']}\n" ."MIME-Version: 1.0\n" ."Content-Type: text/plain; charset=\"windows-1252\"\n" ."Content-Transfer-Encoding: 7bit\n"; if ($_POST['univer']=='University of Michigan') { $mb = 0; $mailto = "aghaeib@umich.edu"; } elseif ($_POST['univer']=='South Orange County Community College District') { $mb = 1; $mailto = "monird@cox.net"; } elseif ($_POST['univer']=='UT Informal Class') { $mb = 2; $mailto = "blake.atwood@gmail.com"; } else { $mb = 3; $mailto = "connieb@gmail.com"; } $subject = $test_title; $uri = base64_encode($uri); $error = "Sorry. This service is unavailable right now. Try to send a e-mail later."; /* $PostData = "mb=$mb&sbj=$subject&stname=$stname&email=$email&uri=$uri"; $len = strlen($PostData); $fp = fsockopen("students.washington.edu", 80, $errno, $errstr, 30); if ($fp) { fputs($fp, "POST /irina/tests/emailer.php HTTP/1.1 User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1;.NET CLR 1.1.4322; .NET CLR 2.0.50215) Host: students.washington.edu Connection: close Content-Type: application/x-www-form-urlencoded Content-Length: $len $PostData"); $page = ""; while (!feof($fp)) $page .= fgets($fp, 128); fclose($fp); if (substr($page, strlen($page)-6)=="SENDOK") { $sent = true; $error = ""; } // echo ""; } */ // 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 - $test_title", $mailtext, $header); exit(" $test_title

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

Back to the Persian Tests "); } $questions[1] = array("کتابِ من", "کتابِ تو", "کتابِ او", "کتابِ آن", "کتابِ ما", "کتابِ شما", "کتابِ آنها"); $questionst[1] = array("ketaab-e_man", "ketaab-e_to", "ketaab-e_u", "ketaab-e_aan", "ketaab-e_maa", "ketaab-e_shomaa", "ketaab-e_aanhaa"); $translation[1] = array("my book", "your book", "his/her book", "its book", "our book", "your book", "their book"); $answers[1] = array("کتابم", "کتابت", "کتابش", "کتابش", "کتابمان", "کتابتان", "کتابشان"); $answerst[1] = array("ketaabam", "ketaabat", "ketaabash", "ketaabash", "ketaabemaan", "ketaabetaan", "ketaabeshaan"); $questions[2] = array("خانهٔ من", "خانهٔ تو", "خانهٔ او", "خانهٔ آن", "خانهٔ ما", "خانهٔ شما", "خانهٔ آنها"); $questionst[2] = array("khaane-ye_man", "khaane-ye_to", "khaane-ye_u", "khaane-ye_aan", "khaane-ye_maa", "khaane-ye_shomaa", "khaane-ye_aanhaa"); $translation[2] = array("my house", "your house", "his/her house", "its house", "our house", "your house", "their house"); $answers[2] = array("خانه‌ام", "خانه‌ات", "خانه‌اش", "خانه‌اش", "خانه‌مان", "خانه‌تان", "خانه‌شان"); $answerst[2] = array("khaane-am", "khaane-at", "khaane-ash", "khaane-ash", "khaane-maan", "khaane-taan", "khaane-shaan"); $questions[3] = array("پای من", "پای تو", "پای او", "پای آن", "پای ما", "پای شما", "پای آنها"); $questionst[3] = array("paa-ye_man", "paa-ye_to", "paa-ye_u", "paa-ye_aan", "paa-ye_maa", "paa-ye_shomaa", "paa-ye_aanhaa"); $translation[3] = array("my foot", "your foot", "his/her foot", "its foot", "our foot", "your foot", "their foot"); $answers[3] = array("پایم", "پایت", "پایش", "پایش", "پایمان", "پایتان", "پایشان"); $answerst[3] = array("paayam", "paayat", "paayash", "paayash", "paayemaan", "paayetaan", "paayeshaan"); $questions[4] = array("ایرانیِ من", "ایرانیِ تو", "ایرانیِ او", "ایرانیِ آن", "ایرانیِ ما", "ایرانیِ شما", "ایرانیِ آنها"); $questionst[4] = array("iraani-ye_man", "iraani-ye_to", "iraani-ye_u", "iraani-ye_aan", "iraani-ye_maa", "iraani-ye_shomaa", "iraani-ye_aanhaa"); $translation[4] = array("my Iranian", "your Iranian", "his/her Iranian", "its Iranian", "our Iranian", "your Iranian", "their Iranian"); $answers[4] = array("ایرانی‌ام", "ایرانی‌ات", "ایرانی‌اش", "ایرانی‌اش", "ایرانی‌مان", "ایرانی‌تان", "ایرانی‌شان"); $answerst[4] = array("iraani-am", "iraani-at", "iraani-ash", "iraani-ash", "iraaniyemaan", "iraani-ye_taan", "iraaniyeshaan"); $questions[5] = array("عموی من", "عموی تو", "عموی او", "عموی آن", "عموی ما", "عموی شما", "عموی آنها"); $questionst[5] = array("amu-ye_man", "amu-ye_to", "amu-ye_u", "amu-ye_aan", "amu-ye_maa", "amu-ye_shomaa", "amu-ye_aanhaa"); $translation[5] = array("my uncle", "your uncle", "his/her uncle", "its uncle", "our uncle", "your uncle", "their uncle"); $answers[5] = array("عمویم", "عمویت", "عمویش", "عمویش", "عمویمان", "عمویتان", "عمویشان"); $answerst[5] = array("amuyam", "amuyat", "amuyash", "amuyash", "amuyemaan", "amuyetaan", "amuyeshaan"); $wrong = false; if (isset($_POST['check'])) { $counter = intval($_POST['counter']); $data = $_POST['data']; $newdata = explode(":", base64_decode($data)); $question = $newdata[0]; $answer = $newdata[1]; $ans_ind = explode(",", $newdata[2]); $test = $newdata[3]; } else { $counter = 1; } ?> $max) { print "

$test_title

\n"; print "

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

\n"; include("emailform.php"); exit(); } } else { print "\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"; $wrong = true; } } else { print "\n"; } if (!$wrong) { srand((float)microtime() * 1000000); $ans_ind = range(0, 6); $question = rand(0, 6); array_splice($ans_ind, $question, 1); if ($question==2) { array_splice($ans_ind, $question, 1); } elseif ($question==3) { array_splice($ans_ind, $question-1, 1); } elseif ($question<2) { array_splice($ans_ind, 1, 1); } elseif ($question>3) { array_splice($ans_ind, 2, 1); } shuffle($ans_ind); array_pop($ans_ind); array_pop($ans_ind); $ans_ind[] = $question; shuffle($ans_ind); for ($i=0; $i<$ans_ind; $i++) { if ($ans_ind[$i]==$question) { $answer = $i; break; } } if ($t==11) $test = rand(1, 10); else $test = $t; $data = "$question:$answer:".implode(",", $ans_ind).":$test"; $data = base64_encode($data); } ?>

Question $counter out of $max

"?>

You are wrong! Please try again!"; } if ($test>5) { print "

Please convert from Personal Suffix of Possession

".$answers[$test-5][$question];//."
[ ".str_replace(" ", "_", $answers[$test-5][$question]).".mp3 ]"; } else { print "

Please convert from Ezāfe

".$questions[$test][$question];//."
[ ".str_replace(" ", "_", $questions[$test][$question]).".mp3 ]"; } ?>

*/ if ($test<=5) { print "

meaning \"".$translation[$test][$question]."\"

to Personal Suffix of Possession"; } else { print "

meaning \"".$translation[$test-5][$question]."\"

to Ezāfe"; } print ""; print ""; print ""; print "
". ($test>5?$questions[$test-5][$ans_ind[0]]:$answers[$test][$ans_ind[0]])."
". ($test>5?$questions[$test-5][$ans_ind[1]]:$answers[$test][$ans_ind[1]])."
". ($test>5?$questions[$test-5][$ans_ind[2]]:$answers[$test][$ans_ind[2]])."
". ($test>5?$questions[$test-5][$ans_ind[3]]:$answers[$test][$ans_ind[3]])."
"; } print "

"; ?>


Back to the Tests