11) $t = 1; if ($t==11) $test_title = "Combined Writing Conventions Test"; else $test_title = "Writing Conventions Test"; $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', 22, '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 / I am books", "you are a book / you are books", "he/she/it is a book / he/she/it is books", "we are a book / we are books", "you are a book / you are books", "they are a book / they are books"); $answers[1] = array("کتاب هستم", "کتاب هستی", "کتاب هست", "کتاب هستیم", "کتاب هستید", "کتاب هستند"); $answerst[1] = array("ketaab_hastam", "ketaab_hasti", "ketaab_hast", "ketaab_hastim", "ketaab_hastid", "ketaab_hastand"); $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 / I am houses", "you are a house / you are houses", "he/she/it is a house / he/she/it is houses", "we are a house / we are houses", "you are a house / you are houses", "they are a house / they are houses"); $answers[2] = array("خانه هستم", "خانه هستی", "خانه هست", "خانه هستیم", "خانه هستید", "خانه هستند"); $answerst[2] = array("khaane_hastam", "khaane_hasti", "khaane_hast", "khaane_hastim", "khaane_hastid", "khaane_hastand"); $questions[3] = array("پایم", "پایی", "پاست", "پاییم", "پایید", "پایند"); $questionst[3] = array("paayam", "paayi", "paast", "paayim", "paayid", "paayand"); $translation[3] = array("I am a foot / I am feet", "you are a foot / you are feet", "he/she/it is a foot / he/she/it is feet", "we are a foot / we are feet", "you are a foot / you are feet", "they are a foot / they are feet"); $answers[3] = array("پا هستم", "پا هستی", "پا هست", "پا هستیم", "پا هستید", "پا هستند"); $answerst[3] = array("paa_hastam", "paa_hasti", "paa_hast", "paa_hastim", "paa_hastid", "paa_hastand"); $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)"); $answers[4] = array("ایرانی هستم", "ایرانی هستی", "ایرانی هست", "ایرانی هستیم", "ایرانی هستید", "ایرانی هستند"); $answerst[4] = array("iraani_hastam", "iraani_hasti", "iraani_hast", "iraani_hastim", "iraani_hastid", "iraani_hastand"); $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"); $answers[5] = array("عمو هستم", "عمو هستی", "عمو هست", "عمو هستیم", "عمو هستید", "عمو هستند"); $answerst[5] = array("amu_hastam", "amu_hasti", "amu_hast", "amu_hastim", "amu_hastid", "amu_hastand"); $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 the stand-alone form of \"to be\"

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

Please convert the suffix form of \"to be\"

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

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

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

to the stand-alone form of \"to be\""; } else { print "

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

to the suffix form of \"to be\""; } 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