11) $t = 1; if ($t==11) $test_title = "Combined Writing Conventions Test 3"; else $test_title = "Writing Conventions Test 3"; $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', 24, '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("ketaabam", "ketaabi", "ketaab_ast", "ketaabim", "ketaabid", "ketaaband"); $translation[1] = array("I am a book", "you are a book", "he/she/it is a book", "we are a book / we are books", "you are a book / you are books", "they are a book / they are books"); $atranslation[1] = array("my book", "your book", "his/her/its book", "our book", "your book", "their book"); $answers[1] = array("کتابم", "کتابت", "کتابش", "کتابمان", "کتابتان", "کتابشان"); $answerst[1] = array("ketaabam", "ketaabat", "ketaabash", "ketaabemaan", "ketaabetaan", "ketaabeshaan"); $questions[2] = array("خانه‌ام", "خانه‌ای", "خانه است", "خانه‌ایم", "خانه‌اید", "خانه‌اند"); $questionst[2] = array("khaane-am", "khaane-i", "khaane_ast", "khaane-im", "khaane-id", "khaane-and"); $translation[2] = array("I am a house", "you are a house", "he/she/it is a house", "we are a house / we are houses", "you are a house / you are houses", "they are a house / they are houses"); $atranslation[2] = array("my house", "your house", "his/her/its house", "our house", "your house", "their house"); $answers[2] = array("خانه‌ام", "خانه‌ات", "خانه‌اش", "خانه‌مان", "خانه‌تان", "خانه‌شان"); $answerst[2] = array("khaane-am", "khaane-at", "khaane-ash", "khaane-maan", "khaane-taan", "khaane-shaan"); $questions[3] = array("پایم", "پایی", "پاست", "پاییم", "پایید", "پایند"); $questionst[3] = array("paayam", "paayi", "paast", "paayim", "paayid", "paayand"); $translation[3] = array("I am a foot", "you are a foot", "he/she/it is a foot", "we are a foot / we are feet", "you are a foot / you are feet", "they are a foot / they are feet"); $atranslation[3] = array("my foot", "your foot", "his/her/its foot", "our foot", "your foot", "their foot"); $answers[3] = array("پایم", "پایت", "پایش", "پایمان", "پایتان", "پایشان"); $answerst[3] = array("paayam", "paayat", "paayash", "paayemaan", "paayetaan", "paayeshaan"); $questions[4] = array("ایرانی‌ام", "ایرانی‌ای", "ایرانیست", "ایرانی‌ایم", "ایرانی‌اید", "ایرانی‌اند"); $questionst[4] = array("iraani-am", "iraani-i", "iraanist", "iraani-im", "iraani_id", "iraani-and"); $translation[4] = array("I am an Iranian", "you are an Iranian", "he/she/is an Iranian", "we are Iranian(s)", "you are (an) Iranian(s)", "they are Iranian(s)"); $atranslation[4] = array("my Iranian", "your Iranian", "his/her/its Iranian", "our Iranian", "your Iranian", "their Iranian"); $answers[4] = array("ایرانی‌ام", "ایرانی‌ات", "ایرانی‌اش", "ایرانی‌مان", "ایرانی‌تان", "ایرانی‌شان"); $answerst[4] = array("iraani-am", "iraani-at", "iraani-ash", "iraaniyemaan", "iraani-ye_taan", "iraaniyeshaan"); $questions[5] = array("عمویم", "عمویی", "عموست", "عموییم", "عمویید", "عمویند"); $questionst[5] = array("amuyam", "amui", "amust", "amuim", "amuid", "amuyand"); $translation[5] = array("I am an uncle", "you are an uncle", "he/she/it is an uncle", "we are an uncle / we are uncles", "you are an uncle / you are uncles", "they are an uncle / they are uncles"); $atranslation[5] = array("my uncle", "your uncle", "his/her/its uncle", "our uncle", "your uncle", "their uncle"); $answers[5] = array("عمویم", "عمویت", "عمویش", "عمویمان", "عمویتان", "عمویشان"); $answerst[5] = array("amuyam", "amuyat", "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, 5); $question = rand(0, 5); array_splice($ans_ind, $question, 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

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

Please convert

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

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

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

to \"".$atranslation[$test][$question]."\""; } else { print "

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

to \"".$translation[$test-5][$question]."\""; } 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