Hej This post introduce you how to install a captcha in Ubbthreads v. 6, in new user registration. If you have problems with spambots registrations, this post could help you.
Step.1 Open newuser.php(language file) and add the line
Code
$ubbt_lang['CAPTCHA'] = "Enter digits";
Step.2 Open adduser.php(language file) and add the line
Code
$ubbt_lang['NO_CAPTCHA'] = "Wrong digits";
Step.3 Open adduser.php and add the following red marked code
// ------------------------------------------------------------ // If all required info is not filled in, then we can't proceed // Redigeret Okt.06 af arentzen - og marts 07 if((!$Username)||(!$Password)||(!$Email)||(!eregi("@",$Email))||(!eregi("\.",$Email)) ||(!$userdigit)||($agree != "yes")){ $html -> not_right($ubbt_lang['ALL_FIELDS'],$Cat); }
Step.4 Scroll further down the same page and add following red marked code.
// ------------------------------------------------------------ // Captcha - af Arentzen marts 07 include "audit.php"; if(audit()){ } else { $html -> not_right($ubbt_lang['NO_CAPTCHA'],$Cat); } // -------------------------------------- // Check to see if this is the first user $query = " SELECT COUNT(U_Number) FROM w3t_Users "; $sth = $dbh -> do_query($query); list ($firstuser) = $dbh -> fetch_array($sth); $dbh -> finish_sth($sth); $Groups = $config['newusergroup'];
Step 5. Open newuser_signup.tmpl and add the captcha and input box.
Step 6. To make the captcha works correct without an errormessage when running the script first time, its nessesary to install a " dummy" to reset the captcha. Open newuser.php and add the following red marked code in bottom of page. //--------------------------------------------------------------------------- // Reset captcha ved registrering - af Arentzen include "audit.php"; if(!audit()){ }
// ---------------------------------------------------------------------- // If we are allowing the user to create their own password, then we give // them a form if ($config['userpass']) { $choosepassword = " {$ubbt_lang['OPT_PASS']}
Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.
Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.