Revision: 3472
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at July 29, 2007 21:58 by tlp
Initial Code
<? $q = "What does seven * eight equal?"; $word_numbers = array("one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen"); $numbers = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13); $q = str_ireplace($word_numbers, $numbers, $q); $word_signs = array("plus", "minus", "times", "x", "divided"); $signs = array("+", "-", "*", "*", "/"); $q = str_ireplace($word_signs, $signs, $q); preg_match("!(\d{1,3}) ([^~]*?) (\d{1,3})!", $q, $out); $first_number = $out[1]; $second_number = $out[3]; switch($out[2]) { case '+' : $answer = $first_number+$second_number; break; case '-' : $answer = $first_number-$second_number; break; case '*' : $answer = $first_number*$second_number; break; case '/' : $answer = $first_number/$second_number; break; default : $answer = "Failed"; break; } echo $answer; ?>
Initial URL
Initial Description
Honestly, this is supposed to be a programming site. What person who would be creating a bot for this site wouldn't be able to crack the spambot protection? Here's my very ugly method of doing so.
Initial Title
Automate the Snipplr spambot protection
Initial Tags
Initial Language
PHP