=0 and c_1 element Z and c_2 element Z and c_3 element Z // So we pick random integer values for c1, c2, and c3 (c3 > 0) and from them we can determine integers a, b, and c, such that a*a + b*b = c*c function randomTrio() { return array(rand(1, 12), rand(0, 12), rand(1, 16)); } function abValuesForTrio($trio) { list ($c1, $c2, $c3) = $trio; $a = abs(2*$c1*$c2*$c3); $b = abs($c1*($c2*$c2 - $c3*$c3)); return array($a, $b); } function hypotenuseForTrio($trio) { list ($c1, $c2, $c3) = $trio; $c = $c1*($c2*$c2 + $c3*$c3); return $c; } function randomIntegerEquationForPythagorean() { $c1 = rand(1, 12); $c2 = rand(0, 12); $c3 = rand(1, 16); $a = abs(2*$c1*$c2*$c3); $b = abs($c1*($c2*$c2 - $c3*$c3)); return array($a, $b); } $kNameClass = ""; $kEmailClass = ""; $kSubjectClass = ""; $kMessageClass = ""; $kCaptchaClass = "captcha"; $needCaptcha = false; $date = localtime(time(),false); $yearTest = ($date[5] + 1900) % 100; $lastYearDigit = $date[5] % 10; $captchaAB = array(); $captchaA = ""; $captchaB = ""; $captchaTest = ""; $trio = array(0,0,0); if ($_SERVER['REQUEST_METHOD'] == 'POST') { if ("$_POST[creq]" != "") { $needCaptcha = true; $captchaTrio = explode(",", "$_POST[creq123]", 3); $trio = array(intval($captchaTrio[0]), intval($captchaTrio[1]), intval($captchaTrio[2])); list($captchaA, $captchaB) = abValuesForTrio($trio); $captchaTest = hypotenuseForTrio($trio); } $subject = preg_replace("/\\\/", "", "$_POST[subject]"); $comments = preg_replace("/\\\/", "", "$_POST[Comments]"); if ("$comments" == "" || "$_POST[email]" == "" || "$_POST[realname]" == "" || "$_POST[recipient]" == "" || ("$_POST[captcha]" == "" && $needCaptcha)) { echo "
\nPlease fill out all required fields."; if ("$comments" == "") $kMessageClass = 'class="fixthis"'; if ("$_POST[email]" == "") $kEmailClass = 'class="fixthis"'; if ("$_POST[realname]" == "") $kNameClass = 'class="fixthis"'; if ("$_POST[captcha]" == "" && $needCaptcha) $kCaptchaClass = 'fixthis'; } elseif (!preg_match("/^[^@]+@([\w\d\-]+\.)+[\w\d]+$/", "$_POST[email]")) { echo "
\nPlease correct your email address."; $kEmailClass = 'class="fixthis"'; } elseif ($needCaptcha && "$_POST[captcha]" != "$captchaTest") { echo "
\nPlease fill out the correct value in the final field (hint: your phone likely has a calculator on it)."; $kCaptchaClass = 'fixthis'; } else if (!$needCaptcha) { echo "
\nPlease fill out the final field."; $needCaptcha = true; $trio = randomTrio(); list($captchaA, $captchaB) = abValuesForTrio($trio); $kCaptchaClass = 'fixthis'; } else if (preg_match("/http:/", "$comments")) { echo "Sorry, your request to send email has been denied."; } else { require_once(dirname(__FILE__)."/../php/sendmail.php"); $posted_form_fields = join(' ', array_keys($_POST)); $agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '(no user agent set!)'; $ff_info = "[Software contact form fields posted: $posted_form_fields (normal ones are: creq realname email recipient subject Comments captcha)\nUser agent: $agent]\n\n"; $result = SendEmail($_POST['email'], $_POST['realname'], $_POST['recipient'], "Dan Wright", "banasmoo.com comment form: $subject", $ff_info.$comments, true); $className = ("0" == $result) ? "success" : "failure"; echo "
\n"; if ($result == 0 && strlen($result) < 2) { echo "Your message has been sent! Thank-you."; $comments = ""; // do not include comments in form -- they may hit Send again and again! $subject = ""; if ($needCaptcha) { // Generate a new captcha so they can't cache the page and resubmit. $trio = randomTrio(); list($captchaA, $captchaB) = abValuesForTrio($trio); } } else if ($result == -1) echo "Sorry, your request to send email has been denied."; else if ($result == -2) { ?>Sorry, your recipient is not recognized or has not been approved. Please contact the webmaster.Sorry, something didn't work right. Want to try again?
Please verify your email address.
The status code was . \n"; } ?>

Fill out this form to send email to the banasmoo support team. We'll normally get back to you within a day or two.

">
>Your name:
>Your email:
>Subject:
  
>Message:
This form attracts spam-sending robots.
To help keep them at bay, please enter the square root of 2 + 2 below: