"; } */ // 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 - $testname", $mailtext, $header); exit(" $testname

".($sent?"Your results have successfully been sent to your Instructor!":$error)."

Back to the Persian Tests "); } $numbers = array('۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹'); $operators = array('+', '-', '×', '÷'); $operations = array('جمع', 'تفریق', 'ضرب', 'تقسیم'); $wrong = false; if (isset($_POST['data'])) { $data = $_POST['data']; $data2 = explode(",", base64_decode($data)); $num1 = $data2[0]; $num2 = $data2[1]; $operator = $data2[2]; $counter = intval($_POST['counter']); $num1_str = "$num1"; $num2_str = "$num2"; $mult = $num1*$num2; $mult_str = "$mult"; for ($i=0; $i<10; $i++) { $num1_str = str_replace("$i", $numbers[$i], $num1_str); $num2_str = str_replace("$i", $numbers[$i], $num2_str); $mult_str = str_replace("$i", $numbers[$i], $mult_str); } $answer = $_POST['answer']; for ($i=0; $i<10; $i++) { $answer = str_replace($numbers[$i], "$i", $answer); } if ($operator==3) $correct = $num1; elseif ($operator==2) $correct = $num1 * $num2; else eval("\$correct = $num1".$operators[$operator]."$num2;"); $correct_str = "$correct"; for ($i = 0; $i<10; $i++) { $correct_str = str_replace("$i", $numbers[$i], $correct_str); } $wrong = ($correct!=$answer); } else { $counter = 1; } if (!$wrong) { srand((float)microtime() * 1000000); $operator = rand(0, 3); if ($operator==1) { $num1 = rand(0, 20); $num2 = rand(0, $num1); } else { if ($operator==0) $start = 0; else $start = 1; $num1 = rand($start, 10); $num2 = rand($start, 10); } $data = "$num1,$num2,$operator"; $data = base64_encode($data); } $num1_str = "$num1"; $num2_str = "$num2"; $mult = $num1*$num2; $mult_str = "$mult"; for ($i=0; $i<10; $i++) { $num1_str = str_replace("$i", $numbers[$i], $num1_str); $num2_str = str_replace("$i", $numbers[$i], $num2_str); $mult_str = str_replace("$i", $numbers[$i], $mult_str); } ?> 50) { print "

$testname

\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(); } } } ?>

(فارسی)

Question out of 50

= ?

Type the correct digit(s):

[switch to Times New Roman font]




Back to the Persian Tests