include "vars.php"; include("../pvc/conjugate.php"); include("engformgenerator.php"); $isSpoken = isset($_GET['spoken']); $isPersScript = !isset($_GET['trans']); if ($isPersScript) { if ($isSpoken) $modal_verbs = array(array("خواست", "خوا", "khā", "want", 324), array("تونست", "تون", "tun", "be able", 323), array("بایست", "بای", "bāy", "have", 414)); else $modal_verbs = array(array("خواست", "خواه", "khāh", "want", 123), array("توانست", "توان", "tavān", "be able", 163), array("بایست", "بای", "bāy", "have", 99)); } else { if ($isSpoken) $modal_verbs = array(array("khāst", "khā", "khā", "want", 324), array("tunest", "tun", "tun", "be able", 323), array("bāyest", "bāy", "bāy", "have", 414)); else $modal_verbs = array(array("khāst", "khāh", "khāh", "want", 123), array("tavānest", "tavān", "tavān", "be able", 163), array("bāyest", "bāy", "bāy", "have", 99)); } $modalTest = -1; if (isset($_GET['modal'])) { $modalTest = intval($_GET['modal']); } if ($modalTest>(count($modal_verbs)-1) || $modalTest<0) $modalTest = -1; $title = "Combined Test on Modal Verbs in the Past (".($modalTest==-1?"personal modal verbs":"modal verb \"".$modal_verbs[$modalTest][3].($modalTest==2?" to":"")."\"").", 1 agent, ".($isSpoken?"spoken":"written")." style, ".($isPersScript?"Persian script":"transcription").")"; $bodyParams = ($isSpoken?'text="#FFFFFF" bgcolor="#808080"':'text="#000000" bgcolor="#FFFF00"'); $total = 50; //#################################### // Sending a letter to the instructor if (isset($_POST['sendinfo'])) { $link = mysql_connect("localhost", $login, $pass) or die("Could not connect: " . mysql_error()); mysql_select_db($db) or die("Could not select database"); $stname = htmlspecialchars($_POST['stname']); $email = htmlspecialchars($_POST['email']); // if ($_POST['univer']=='University of Texas at Austin') { // $sql = "INSERT INTO test_results (`date`, `name`, `email`, `othertest_id`, `grade`, comment) // VALUES ('".date('Y-m-d H:i:s')."', '$stname', '$email', 36, 'A', '');"; // mysql_query($sql); // } $mailtext = "This is the letter from the $title. $stname from {$_POST['univer']} has successfully answered all the questions of this test! His/her e-mail is $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 = $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 - $title", $mailtext, $header); exit('
'.($sent?"Your results have successfully been sent to your Instructor!":$error)." You have answered all $total questions correctly. Fill the form and click the button to send the results to your instructor: \n";
include("emailform.php");
exit();
} else {
print " Question $question out of $total";
}
print " ";
if (isset($_POST['check']) && $correct==0) {
print " You are wrong! ";
}
?>
Please translate to Persian:
Back to the Persian Verb Conjugator
if ($id) print "
Back to the Persian Tests
");
}
function GetQuestion($person, $negative, $verb) {
global $isPersScript;
$persons = array(1 => 'I', 'You', 'He/she/it', 'We', 'You', 'They');
$persons2 = array(1 => 'me', 'you', 'him/her/it', 'us', 'you', 'them');
// $be = array(1 => 'am', 'are', 'is', 'are', 'are', 'are');
$be = array(1 => 'was', 'were', 'was', 'were', 'were', 'were');
$words = explode(' ', $verb); // if there is a preposition after the verb
if ($verb=='be possible for')
$question = 'It ';
else
$question = $persons[$person].' ';
if ($negative) {
if ($words[0]=='be') {
if ($verb=='be possible for')
$question .= $be[3] . " not";
else
$question .= $be[$person] . " not";
} elseif ($words[0]=='must') {
$question .= $words[0] . " not";
} else {
$question .= "did not $words[0]";
}
} else {
if ($words[0]=='be') {
if ($verb=='be possible for')
$question .= $be[3];
else
$question .= $be[$person];
} else {
$question .= verbPast($words[0]);
}
}
for ($i=1; $i