$fntClass = 'pers'; if (isset ( $_POST ['fontclass'] )) { $fntClass = $_POST ['fontclass']; } //#################################### // Sending a letter to the instructor if (isset ( $_POST ['sendinfo'] )) { $stname = htmlspecialchars ( $_POST ['stname'] ); $email = htmlspecialchars ( $_POST ['email'] ); $trans = (isset ( $_GET ['trans'] )) ? 'transliterated' : ''; 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', 16, 'A', '');"; mysql_query ( $sql ); } $subject = "Combined Test for Joining and Disjoining Letters"; $mailtext = "This is the letter from the $subject. {$_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"; } $uri = base64_encode ( $uri ); $header = "From: $email\n" . "MIME-Version: 1.0\n" . "Content-Type: text/plain; charset=\"windows-1252\"\n" . "Content-Transfer-Encoding: 7bit\n"; $sent = mail ( $mailto, "Persian Test System - $subject", $mailtext, $header ); $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 - Combined Test for Joining and Disjoining Letters", $mailtext, $header); exit ( "
" . ($sent ? "Your results have successfully been sent to your Instructor!" : $error) . " 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 ();
}
?>
Question out of Please join these 0 letters by typing them on your keyboard from right to left:
Back to the Persian Tests
" );
}
$letters_array = array ();
// The "vaared" letters--letters that are always unconnected to the left
$letters_array[1] = array('و', 'ا', 'ر', 'د', 'ز', 'ژ', 'ذ'); // vaav, alef, re, daal, ze, zhe, zaal
// letters with a left-stretch in final position
$letters_array[2] = array('ب', 'پ', 'ف', 'ت', 'ث', 'ک', 'گ'); // be, pe, fe, te, se, kaaf, gaaf
// letters with a left-downward swing in final position
$letters_array[3] = array('س', 'ش', 'ص', 'ض', 'ل', 'ق', 'ن', 'ط', 'ظ'); // sin, shin, saad, zaad, laam, qaaf, nun
// one letter with the simplest, one with the most elegant arbesque:
$letters_array[4] = array('م', 'ی'); // mim, ye
// letters with inward swing in final position
$letters_array[5] = array('ج', 'چ', 'ح', 'خ', 'ع', 'غ'); // jim, che, he (hotti), khe, `ayn, ghayn
// *he (havvaz)*
$letters_array[6] = array('ه');
$letters = array();
for ($i=1; $i<=6; $i++) {
$letters = array_merge($letters, $letters_array[$i]);
}
srand((float)microtime() * 1000000);
$wrong = false;
if (isset($_POST['data'])) {
$data = $_POST['data'];
$newdata = explode(";", base64_decode($data));
$qletters = explode(",", $newdata[0]);
$textname = $newdata[1];
$counter = intval($_POST['counter']);
$type = intval($_POST['type']);
if ($type==1) {
if (isset($_POST[$textname])) {
if ($_POST[$textname]!=implode("", $qletters)) {
$wrong = true;
}
} else {
$wrong = true;
}
} else {
for ($i=0; $iCombined Test for Joining and Disjoining Letters
\n";
print "Combined Test for Joining and Disjoining Letters