Adding CAPTCHA to Joomla Forum
05.03.07 by
Peter
After a great deal of messing about, I’ve managed to add CAPTCHA (image based verification that you are a human and not a spam bot) to Joomlaboard forum 1.1.5 in the GEOSS Registry Site. Here’s how I did it:
- Downloaded and install Walter Cedric’s Security Image component
- Update the form display code:
components/com_joomlaboard/write.html.php
<tr>
<td colspan="2" style="text-align: center;">
<?php include ($mosConfig_absolute_path.'/administrator/components/com_securityimages/client.php'); ?>
<?php echo insertSecurityImage("security"); ?><br />
<?php echo getSecurityImageText("security"); ?>
</td>
</tr>
<tr>
<td colspan="2" style="text-align: center;">
<input type="submit" class="button" name="submit" value="<?php echo _GEN_CONTINUE;?>" onclick="return submitForm()" onmouseover="helpline('submit')" />
<input type="button" class="button" value="<?php echo _PREVIEW;?>" onclick="Preview('<?php echo JB_JCSSURL;?>', '<?php echo JB_DIRECTURL;?>', '<?php echo $sbConfig['template'];?>', '<?php echo $sbConfig['disemoticons'];?>')" onmouseover="helpline('preview')" />
<input type="button" class="button" value="<?php echo _GEN_CANCEL;?>" onclick="javascript:window.history.back();" onmouseover="helpline('cancel')" />
</td>
</tr> - Update the form processing code:
components/com_joomlaboard/post.php
<?php
$parent=(int)$parentid;
$message = isset($_POST['message']) ? trim($_POST['message']) : '';
include ($mosConfig_absolute_path.'/administrator/components/com_securityimages/server.php');
$checkSecurity = checkSecurityImage($_POST['security_refid'], $_POST['security_try']);
if ($checkSecurity!=true)
{
echo _POST_WRONG_CAPTCHA;
}
else if (empty($sb_authorname))
{
echo _POST_FORGOT_NAME;
} - Update the language file:
administrator/components/com_joomlaboard/language/english.php
DEFINE('_POST_WRONG_CAPTCHA','Sorry, the characters you entered did not match the characters in the CAPTCHA image at the bottom of the form. Please try again.');
At the time this artical was written, we were running Joomla 1.0.12


I use this something like this on my Joomlaboards –
I am not trying out Fireboard (which is a PORT of Joomlaboard)
and am wondering how tricky this would be to integrate
into FIREBOARD.
probably not very…
care to assist me?
Hi Colin,
We might try out Fireboard soon. In the mean time I thought that perhaps i can help by sharing the thought process that we went through to get Walter’s CAPTCHA to work.
For the CAPTCHA to work you fundamentally need to change 2 files. The file that displays the input form and the file that processes it.
The file that displays the form needs the following added:
< ?php include ($mosConfig_absolute_path.’/administrator/components/com_securityimages/client.php’); ?>
< ?php echo insertSecurityImage(â€securityâ€); ?>
< ?php echo getSecurityImageText(â€securityâ€); ?>
This will display the image and associated form elements. Does this go in com_fireboard/template/default/fb_write.html.php?
The file that processes the code will need something to this effect:
include ($mosConfig_absolute_path.’/administrator/components/com_securityimages/server.php’);
$checkSecurity = checkSecurityImage($_POST[’security_refid’], $_POST[’security_try’]);
if ($checkSecurity!=true) {
// the captcha is wrong. Tell the user that they got the wrong captcha here and dont process the form
}
This will test the captcha results to see if they match or not. If they don’t then you don’t want the form to be processed and you should let the user know. We handled this in Joomlaboard by refering to a string in the language file and printing that string. Does this go in com_fireboard/source/fb_bb.js.php in the submitForm function?
-p