note 80036 deleted from function.mail by tularis
| From: | tularis@php.net | Date: | Wed, 26 Dec 2007 11:39:37 +0000 |
| Subject: | note 80036 deleted from function.mail by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-134013@lists.php.net to get a copy of this message | ||
Note Submitter: SID TRIVEDI
----
<?php
/**********************************************
# TITLE : SIMPLE CATCHA
# CONSIDERATION :
#1)AUTO-BOTS CAN NOT DO ARITHMATIC ON STRINGS.
#2) FIRST LETTER OF ANSWER PREFERABLY SHOULD BE CAPITAL - HUMAN BEHAVIOUR.
# CAPTCHA: Telling Humans and Computers Apart Automatically
# A CAPTCHA is a program that protects websites against bots by generating and
# grading tests that humans can pass but current computer programs cannot.
# For example, humans can read distorted text as the one shown below, but current
# computer programs can't:
# IT HELPS :-
# 1) Automatic submission of the form by the auto-bots.
# 2) Worms and Spam. CAPTCHAs also offer a plausible solution against
# email worms and spam:
# The form will only be accept an email if there is a human in-front of
# the computer at other end.
**********************************************/
$numbers = array ("Zero"=>"0", "One" => "1",
"Two" => "2",
"Three" => "3", "Four" => "4",
"Five" => "5",
"Six" => "6", "Seven" => "7",
"Eight" => "8","Nine" => "9");
$answer = array ("0"=>"Zero", "1" => "One",
"2" => "Two",
"3" => "Three", "4" => "Four",
"5" => "Five",
"6" => "Six", "7" => "Seven",
"8" => "Eight",
"9" => "Nine", "10"=>"Ten",
"11" => "Eleven",
"12" => "Twelve","13" =>
"Thirteen");
$input1 = array("Nine", "Eight", "Seven", "Six",
"Five");
$input2 = array("plus", "minus");
$input3 = array("Four", "Three", "Two", "One",
"Zero");
$rand_keys1 = array_rand($input1, 2);
$rand_keys2 = array_rand($input2, 2);
$rand_keys3 = array_rand($input3, 2);
$num1 = $numbers[$input1[$rand_keys1[0]]];
$num2 = $numbers[$input3[$rand_keys3[1]]];
$oprtr = $input2[$rand_keys2[0]];
if ($oprtr === 'plus'){
$ans = $num1 + $num2;
}else{
$ans = $num1 - $num2;
}
$str = $input1[$rand_keys1[0]] .' '.$input2[$rand_keys2[0]].'
'.$input3[$rand_keys3[1]];
echo "$str\n<br>";
$ansr = $answer[$ans];
echo "Answer is : $ansr\n<br>";
/* Above script produces following browser (RANDOM) output:-
Eight plus Two
Answer is : Ten
*/
?>