php forum
php mysql forum
php mysql smarty
 
Topic Options
#313724 - 03/26/07 06:59 PM CAPTCHA newpost & reply
arentzen Offline
Newbie

Registered: 10/05/06
Posts: 19
Loc: Denmark

   CAPTCHA newpost & reply to Del.icio.us Add to del.icio.us
  Digg CAPTCHA newpost & reply Digg it
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!
_________________________
Peter Arentzen
trosfrihed.dk

Top
#313726 - 03/26/07 07:57 PM Re: CAPTCHA newpost & reply [Re: arentzen]
Gizmo Administrator Offline
Wizard

Registered: 01/10/00
Posts: 5123
Loc: Portland, OR, USA
Looks great, good job smile
_________________________
UBB.Dev - Where you too can render your UBB install completely useless...
UGN Security, Elite Web Gamers & VNC Web Design Owner

Top


Moderator:  Ian_W 
Who's Online
0 Registered (), 25 Guests and 6 Spiders online.
Key: Admin, Global Mod, Mod
Shout Box

Latest Posts
Team UBBDev Rides Again!
by AllenAyres
Today at 01:36 PM
Blogs, love em or hate em?
by AllenAyres
10/07/08 02:05 PM
What do you use to edit the files
by Ian_W
10/05/08 03:33 PM
BeyondCompare v3.00
by Ian_W
10/05/08 03:32 PM
Glossy Black Theme with Image Reflection
by Gizmo
10/05/08 02:17 PM
ShareThis
by Gizmo
09/28/08 05:06 AM
[7.3] Viewing MySQL logfiles made easier
by AllenAyres
09/27/08 09:57 PM
New Mods
[7.3] Viewing MySQL logfiles made easier
by blaaskaak
09/24/08 05:39 PM
[7.3.1] add search to showmembers page
by blaaskaak
09/07/08 04:50 AM
Multiple Identity Detector
by
12/30/06 06:39 PM
Newest Members
Kevs, pisa666, ghengis317, NitroX, Dogan
13346 Registered Users
Top Posters Last 30 Days
AllenAyres 11
blaaskaak 7
Ian_W 4
tackaberry 4
Mike L_dup1 4
Gizmo 4
Chris Bale 4

 

 

 
fusionbb message board php hacks