php forum
php mysql forum
php mysql smarty
 
Topic Options
#313699 - 03/23/07 10:49 PM CAPTCHA newuser
arentzen Offline
Newbie

Registered: 10/05/06
Posts: 22
Loc: Denmark
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.

First of all, all credits regarding this captcha should be given to http://php.webmaster-kit.com/. You can download the captcha here

New files to be uploaded
- button.php
- audit.php

Modified files
- newuser.php
- newuser.php(language file)
- adduser.php
- adduser.php (language file)
- newuser_signup.tmpl

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.
Code:
<img width="120" height="30" src="button.php" border="1" />
<br />
<br />
{$ubbt_lang['CAPTCHA']}
<br />
<input maxlenght="5" size="5" name="userdigit" type="text" value="" />
<br />
<br />


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']}<br />
<input type=\"password\" name=\"Loginpass\" class=\"formboxes\" />
<br /><br />
{$ubbt_lang['VER_PASS']}<br />
<input type=\"password\" name = \"Verify\" class=\"formboxes\" />
<br /><br />
";
}

include("$thispath/templates/$tempstyle/newuser_signup.tmpl");
$html -> send_new_footer();

?>


Thats it! Enjoy.
_________________________
www.trosfrihed.dk
Custom Ubb 7.5.2

Top



Moderator:  Ian_W 
Latest Posts
[7.2.1] - Naked shoutbox
by bellaonline
05/05/12 05:00 PM
[7.x] Stop Forum Spam Integration v0.4
by bellaonline
05/05/12 03:53 PM
Shout Box

(Views)Popular Topics
Known public proxy servers 1689885
Integrated Index Page (IIP) 5.3.1 555705
Finished-[6.5.2] Games Arcade Deluxe v1.9 501236
Integrated Index Page (IIP) 5.1.1 415112
TLD Bv2.1 Released - Threads Links Directory 396822
[6.0x] Who's Online 4.0.0 [Finished] 389412
Finished-[6.5.1] Integrated Index Page (IIP) 6.5 330423
Q & A 298663
Slash UBB 266936
[6.3.x] [beta] Hit Hack 2.0 227970
Forum Stats
13621 Members
59 Forums
37191 Topics
295716 Posts

Max Online: 686 @ 06/28/07 07:04 AM

 

 

 
fusionbb message board php hacks