# b2 image validation hack * by Cyberian 75 Last updated 30.08.06 Source: http://www.michaelpark.net//b2hacks/imgvalidate.txt Questions: http://board.michaelpark.net/viewtopic.php?t=53 This will produce four random digits on an image like the Anti Spam Image for WordPress, prompting your visitors to type them into a box, before the comment is verified for posting. This hack renders b2word verifier OBSOLETE. Please update your files. 1. Save the following in a separate file named b2comments.post_image.php: //BEGINNING OF PHP CODE //END OF PHP CODE Here, you can change the colors of text ($textcolor) and background ($bgcolor). Background is transparent; if you want otherwise, you have to use the "imagefill" (us2.php.net/manual/en/function.imagefill.php) function instead of the "imagecolortransparent" function. Colors are in RGB. See http://www.tayloredmktg.com/rgb/ for more colors. 2. Then in your comments files; e.g., "b2comments.php", add the following on the very top and right afer the opening php tag: //BEGINNING OF PHP CODE //generate a random number $random = rand(1000, 9999); //set a cookie with the random number that expires in 5 minutes setcookie("random_num_validate", $random, time()+600); //END OF PHP CODE 3. Then put the following where you want the image to appear in the form: Validation: » ...and put the following on the top... $comment = (empty($HTTP_COOKIE_VARS["comment"])) ? "comment" : stripslashes($HTTP_COOKIE_VARS["comment"]); ...then change the textarea field to... ...... 4. Finally in "b2comments.post.php" file, add the following on the very top right after the php opening tag: //BEGINNING OF PHP CODE go back'; exit ("

$goback"); } else { setcookie("random_num_validate", "", time()-600); setcookie("comment", "", time()-600); } ?> //END OF PHP CODE Enjoy! :)