reCaptcha for PunBB By: erik @ www.36invisible.com About: on another site that I'm helping to develop i've integrated Carnegie Mellon University's amazing reCaptcha script into PunBB (the forum software running on that site). reCAPTCHA channels the effort spent solving CAPTCHAs online into correcting OCR mistakes for scanned books. because the current release of PunBB is not plugin friendly, integrating reCaptcha isn't a one step process, but with barely effort it's completely doable. Here's how: ------------------------------- INSTALLING reCaptcha into PunBB ------------------------------- 1. Download the reCAPTCHA PHP Library ( http://code.google.com/p/recaptcha/downloads/list?q=label:phplib-Latest ) and extract recaptchalib.php into your root PunBB directory. 2. Sign up for an API key ( http://recaptcha.net/api/getkey?app=php ). 3. Edit your PunBB register.php file: ---- FIND: ---- define('PUN_ROOT', './'); require PUN_ROOT.'include/common.php'; ------------------------------- AND ADD THESE LINES _BELOW_ IT: ------------------------------- require_once('recaptchalib.php'); $publickey = "youpublickey"; $privatekey = "yourprivatekey"; ---- FIND: ---- else if (isset($_POST['form_sent'])) { ------------------------------- AND ADD THESE LINES _BELOW_ IT: ------------------------------- $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); ---- FIND: ---- Look for the block of code that begins with: // Validate username and passwords if (strlen($username) < 2) message($lang_prof_reg['Username too short']); -------------------------------------------------- AND ADD THESE LINES _BELOW_ THAT BLOCK OF CHECKS: ( below: message($lang_prof_reg['Username BBCode']); ) -------------------------------------------------- else if (!$resp->is_valid) { message("The reCAPTCHA wasn't entered correctly. Go back and try it again."); } ---- FIND: Near the bottom of the file, find: ----

------------------------------- AND ADD THESE LINES _ABOVE_ IT: -------------------------------
Are you human?
(above the submit button!) 5. That's it!