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: 18
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.
_________________________
Peter Arentzen
trosfrihed.dk

Top


Moderator:  Ian_W 
Top Posters Last 30 Days
AllenAyres 82
Gizmo 29
sirdude 25
Zarzal 23
blaaskaak 12
willing 5
swebs 4
Who's Online
0 Registered (), 51 Guests and 14 Spiders online.
Key: Admin, Global Mod, Mod
Shout Box

Latest Posts
User Authentication Class
by sirdude
Yesterday at 06:11 PM
Multiple Identity Detector
by Myke
Yesterday at 05:45 AM
FlashChat with UBB.Threads 7.0.2
by Gizmo
Yesterday at 12:30 AM
Nice Ajax Chat
by Thelockman
07/06/08 09:07 AM
[7.x] UBB.Post Templates v0.1
by sirdude
07/05/08 12:48 PM
Team UBBDev Rides Again!
by AllenAyres
07/04/08 10:56 PM
[7.3.x] ubb.links
by AllenAyres
07/03/08 06:15 PM
New Mods
Protect users emails
by Basil Fawlty
06/29/08 08:44 AM
[7.3.x] Scheduled board close for backup
by blaaskaak
06/26/08 04:01 AM
[7.3+] CustomTag - Audo Embedding
by Gizmo
06/24/08 07:52 PM
[7.3.x] ubb.links
by AllenAyres
06/20/08 11:50 PM
[7.3] Dissallow quotes more then 3 levels deep
by blaaskaak
06/09/08 09:01 AM
Newest Members
nunny, lpzie, DoubleDutch, ryzilla, M4D
13305 Registered Users

 

 

 
fusionbb message board php hacks