11) $t = 1; if ($t==11) $test_title = "Combined Writing Conventions Test (spoken style)"; else $test_title = "Writing Conventions Test (spoken style)"; $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', 25, '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("sketaabam", "sketaabi", "sketaabe", "sketaabim", "sketaabid", "sketaaban"); $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("sketaab_hastam", "sketaab_hasti", "sketaab_hastesh", "sketaab_hastim", "sketaab_hastid", "sketaab_hastan"); $questions[2] = array("خونه‌ام", "خونه‌ای", "خونه اس", "خونه‌ایم", "خونه‌اید", "خونه‌ان"); $questionst[2] = array("skhunam", "skhunei", "skhunas", "skhuneim", "skhuneid", "skhunan"); $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("skhune_hastam", "skhune_hasti", "skhune_hastesh", "skhune_hastim", "skhune_hastid", "skhune_hastan"); $questions[3] = array("پایم", "پایی", "پاس", "پاییم", "پایید", "پاین"); $questionst[3] = array("spaayam", "spaayi", "spaas", "spaayim", "spaayid", "spaayan"); $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("spaa_hastam", "spaa_hasti", "spaa_hastesh", "spaa_hastim", "spaa_hastid", "spaa_hastan"); $questions[4] = array("ایرونی‌ام", "ایرونی‌ای", "ایرونیه", "ایرونی‌ایم", "ایرونی‌اید", "ایرونی‌ان"); $questionst[4] = array("siruniyam", "siruni", "siruniye", "sirunim", "sirunid", "siruniyan"); $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("siruni_hastam", "siruni_hasti", "siruni_hastesh", "siruni_hastim", "siruni_hastid", "siruni_hastan"); $questions[5] = array("عمویم", "عمویی", "عموه", "عموییم", "عمویید", "عموین"); $questionst[5] = array("samuyam", "samui", "samue", "samuim", "samuid", "samuyan"); $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("samu_hastam", "samu_hasti", "samu_hastesh", "samu_hastim", "samu_hastid", "samu_hastan"); $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