billybrag
Sep 12th 2006, 3:15 pm
hi all i have done this captcha (text only) in php and wondered if anyone could help me turn it into coldfusion.
It could be of use to a few people
**************php*******************************
function captcha() {
$numbers = array("zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine");
$rand = array_rand($numbers,2);
$result=$rand[0]+$rand[1];
$question = "<b>".$numbers[$rand[0]]."</b> plus <b>".$numbers[$rand[1]]."</b>";
$out .= '<label for="captcha">Please enter the result into the box below:(Answer in numbers only)<br /> '.$question.' equals</label> <input type="text" name="captcha"id="captcha">';
$out .= '<INPUT TYPE=hidden NAME=val1 VALUE='.$numbers[$rand[0]].'>';
$out .= '<INPUT TYPE=hidden NAME=val2 VALUE='.$numbers[$rand[1]].'>';
$out .= '<INPUT TYPE=hidden NAME=result VALUE='.$result.'>';
return $out;
}
**********************end php***********************
It could be of use to a few people
**************php*******************************
function captcha() {
$numbers = array("zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine");
$rand = array_rand($numbers,2);
$result=$rand[0]+$rand[1];
$question = "<b>".$numbers[$rand[0]]."</b> plus <b>".$numbers[$rand[1]]."</b>";
$out .= '<label for="captcha">Please enter the result into the box below:(Answer in numbers only)<br /> '.$question.' equals</label> <input type="text" name="captcha"id="captcha">';
$out .= '<INPUT TYPE=hidden NAME=val1 VALUE='.$numbers[$rand[0]].'>';
$out .= '<INPUT TYPE=hidden NAME=val2 VALUE='.$numbers[$rand[1]].'>';
$out .= '<INPUT TYPE=hidden NAME=result VALUE='.$result.'>';
return $out;
}
**********************end php***********************