Previous Thread
Next Thread
Print Thread
Rate Thread
#313699 03/23/2007 10:49 PM
Joined: Oct 2006
Posts: 18
Newbie
Newbie
Joined: Oct 2006
Posts: 18
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']}





{$ubbt_lang['VER_PASS']}





";
}

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

?>


Thats it! Enjoy.


trosfrihed.dk
Custom Ubb 7.5.2
Sponsored Links

Link Copied to Clipboard
Donate Today!
Donate via PayPal

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.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Gizmo
Gizmo
Portland, OR, USA
Posts: 5,833
Joined: January 2000
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)