Previous Thread
Next Thread
Print Thread
Rate Thread
#313724 03/26/2007 6:59 PM
Joined: Oct 2006
Posts: 18
Newbie
Newbie
Joined: Oct 2006
Posts: 18
Hej
This post will describe how to install a captcha in newpost and replies, so its possible to allow anonymous posters, without open your forum for spambots. The capatcha will thus only have effect for anonumous posters. Registrated users can ignore captcha.

Its provided that you have uploaded:
audit.php
button.php

If you havent, you can download them here. You can read about the captcha and test it here http://php.webmaster-kit.com/

Modified files
addpost.php
addpost.php(language file)
newpost.php
newpost.php (language file)
newreply.php
newreply.php (language file)
newpost.tmpl
newreply.tmpl
addpost_prewiev.tmpl


Step 1.
open addpost.php(language file) and add the lines
Code

$ubbt_lang['NO_CAPTCHA'] = "Wrong digits";
$ubbt_lang['ENTER_DIGITS'] = "Enter digits if you're not logged in";

Step 2.
Open newpost.php( language file) and add the line
Code

$ubbt_lang['ENTER_DIGITS'] = "Enter digits if you're not logged in";

Step.3
Open newrely.php(language file) and add the line
Code

$ubbt_lang['ENTER_DIGITS'] = "Enter digits if you're not logged in";

Step.4
Open newpost.tmpl and newreply.tmpl and add the captcha and digit input box
Code


<br/>
<img width="120" height="30" src="button.php" border="1" />




<b>
{$ubbt_lang['ENTER_DIGITS']}
</b>


<input type="text" maxlenght="5" size="5" name="userdigit" class="formboxes" value="" />




Step.5
NOTE!In addpost_prewiev.tmpl, the captcha has to be put into 2 places, because you have 2 options. One option to send the post, and a option to edit the post. You may not exclude one of them, otherwise it will not work!
Code
<?  //UBBTREMARK
echo <<<UBBTPRINT

<table width="{$theme['tablewidth']}" align="center" cellpadding="1" cellspacing="1" class="tablesurround">
<tr>
<td>
<table cellpadding="{$theme['cellpadding']}" cellspacing="{$theme['cellspacing']}" width="100%" class="tableborders">
<tr>
<td class="tdheader">
{$ubbt_lang['PREV_POST']}
</td>
</tr>
</table>
</td>
</tr>
</table>

<table width="{$theme['tablewidth']}" align="center" cellpadding="1" cellspacing="1" class="tablesurround">
<tr>
<td>
{$template['form1']}
<table cellpadding="{$theme['cellpadding']}" cellspacing="{$theme['cellspacing']}" width="100%" class="tableborders">
<tr class="darktable">
<td>
{$ubbt_lang['POST_BODY']}
</td>
</tr>
<tr class="lighttable">
<td>





<table width="100%" align="center" cellpadding="1" cellspacing="1" class="tablesurround">
<tr>
<td>
<table cellpadding="{$theme['cellpadding']}" cellspacing="{$theme['cellspacing']}" width="100%" class="tableborders">
<tr>
<td class="subjecttable">
$iconurl $PrintSubject
</td>
</tr>
<tr class="lighttable">
<td>


$PrintBody

</td>
</tr>
</table>
</td>
</tr>
</table>

<input type="hidden" name="Subject" value="$FormSubject" />
<input type="hidden" name="Body" value="$FormBody" />
<input type="hidden" name="Parent" value="$Parent" />
<input type="hidden" name="Main" value="$Main" />
<input type="hidden" name="postername" value="$postername" />
<input type="hidden" name="Cat" value="$Cat" />
<input type="hidden" name="Reged" value="$Reged" />
<input type="hidden" name="Board" value="$Board" />
<input type="hidden" name="IP" value="$IP" />
<input type="hidden" name="what" value="$what" />
<input type="hidden" name="page" value="$page" />
<input type="hidden" name="view" value="$view" />
<input type="hidden" name="oldnumber" value="$oldnumber" />
<input type="hidden" name="sb" value="$sb" />
<input type="hidden" name="o" value="$o" />
<input type="hidden" name="mail" value="$mail" />
<input type="hidden" name="PStatus" value="$PStatus" />
<input type="hidden" name="Sticky" value="$Sticky" />
<input type="hidden" name="Icon" value="$Icon" />
<input type="hidden" name="frompreview" value="0" />
<input type="hidden" name="vc" value="$vc" />
<input type="hidden" name="fpart" value="$fpart" />
<input type="hidden" name="replyto" value="$replyto" />
<input type="hidden" name="convert" value="$convert" />
{$template['attachfile']}
{$template['fileinput']}




<img width="120" height="30" src="button.php" border="1" />




<b>
{$ubbt_lang['ENTER_DIGITS']}
</b>


<input type="text" maxlenght="5" size="5" name="userdigit" class="formboxes" value="" />



<input type="submit" value="{$ubbt_lang['TEXT_CONT']}" class="buttons" />

</td>
</tr>
</table>
</form>
</td>
</tr>
</table>







<table width="{$theme['tablewidth']}" align="center" cellpadding="1" cellspacing="1" class="tablesurround">
<tr>
<td>
<table cellpadding="{$theme['cellpadding']}" cellspacing="{$theme['cellspacing']}" width="100%" class="tableborders">
<tr class="darktable">
<td>
{$ubbt_lang['EDIT_MORE']}
</td>
</tr>
<tr class="lighttable">
<td>
{$template['form2']}
{$ubbt_lang['SUBJECT_TEXT']}


<input type="text" name="Subject" value="$Subject" class="formboxes" />


<!-- The following 2 template vars are defined in addpost.php -->
<!-- This is necessary because post icons are a config option -->

{$ubbt_lang['POST_TEXT']}


<textarea cols="$TextCols" rows="$TextRows" class="formboxes" wrap="soft" name="Body">$Body</textarea>







<input type="hidden" name="postername" value="$postername" />
<input type="hidden" name="Cat" value="$Cat" />
<input type="hidden" name="Reged" value="$Reged" />
<input type="hidden" name="Board" value="$Board" />
<input type="hidden" name="what" value="$what" />
<input type="hidden" name="page" value="$page" />
<input type="hidden" name="view" value="$view" />
<input type="hidden" name="Main" value="$Main" />
<input type="hidden" name="Parent" value="$Parent" />
<input type="hidden" name="sb" value="$sb" />
<input type="hidden" name="o" value="$o" />
<input type="hidden" name="fpart" value="$fpart" />
<input type="hidden" name="vc" value="$vc" />
<input type="hidden" name="replyto" value="$replyto" />
<input type="hidden" name="oldnumber" value="$oldnumber" />
<input type="hidden" name="convert" value="$convert" />

<!-- The following template var is defined in addpost.php -->
<!-- This is necessary because it is not always displayed -->
{$template['emailoption']}
<input type="checkbox" name="preview" value="1" $Pselected class="formboxes" />
{$ubbt_lang['DO_PREVIEW']}
{$template['canattach']}
.



<img width="120" height="30" src="button.php" border="1" />




<b>
{$ubbt_lang['ENTER_DIGITS']}
</b>


<input type="text" maxlenght="5" size="5" name="userdigit" class="formboxes" value="" />




<input type="submit" value="{$ubbt_lang['TEXT_CONT']}" class="buttons" />
</form>


</td>
</tr>
</table>
</td>
</tr>
</table>
UBBTPRINT;
/* UBBTREMARK */ ?>

Step.6
Open addpost.php and add the code just before these lines
// -----------------------------------------------------
// Now if we are doing a preview of the post, we do this


Code

//------------------------------------------------------------
// Captcha - af Arentzen
if( ($config['anonnames']) && (!$Username) ) {
include "audit.php";
if(audit()){
}
else {
$html -> not_right($ubbt_lang['NO_CAPTCHA'],$Cat);
}
}

Step.7
Open newpost.php and newreply.php and put in a "dummy code" in the middle of the scripts, so you dont get error message when executing the scripts.
Code

//---------------------------------------------------------------------------
// Reset captcha ved besvarelse - af Arentzen
if( ($config['anonnames']) && (!$Username) ){
include "audit.php";
if(!audit()){
}
}

Then we are finish. You should now be able to open your forum for anonymous without collecting spamposts from spambots...
Please leave a comment if you have trouble understanding or further modifications to this guide.

Enjoy!


trosfrihed.dk
Custom Ubb 7.5.2
Sponsored Links
Joined: Jan 2000
Posts: 5,833
Likes: 20
UBBDev / UBBWiki Owner
Time Lord
UBBDev / UBBWiki Owner
Time Lord
Joined: Jan 2000
Posts: 5,833
Likes: 20
Looks great, good job smile


UBB.Dev - Putting Dev into UBB.threads
Company: VNC Web Services - UBB.threads Scripts and Scripting, Install and Upgrade Services, Site and Server Maintenance.
Forums: A Gardeners Forum, Scouters World, and UGN Security
UBB.Threads: My UBB Themes, My UBB Scripts

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
isaac
isaac
California
Posts: 1,157
Joined: July 2001
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
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)