Best of joomla gives you news, joomla templates, tutorials and websites about Joomla , FireBoard and FireMessage official page.
| No account yet?   |
The FireBoard forum component development is still going on. In order to get better, FireBoard will be moved from the Best of Joomla website.
During this transition period, the forum in Best of Joomla will be closed to new posts.
Welcome, Guest
Please Login or Register.    Lost Password?
FireBoard Manual Latest release discussions Download FireBoard
reCaptcha in Fireboard (1 viewing) (1) Guest
TOPIC: reCaptcha in Fireboard
#55112
reCaptcha in Fireboard 5 Months, 1 Week ago  
Well, I found nowhere on the Internet a reCaptcha implementation into Fireboard, so I tried to make one myself.
I'm not a programmer, so I don't know if I did it in a secure way, but it works!!!

REMEMBER: by applying this modification, the built-in captcha will be overwritten.

Here's how to do it:
download the latest PHP library for reCaptcha - recaptcha.net/plugins/php/

upload the recaptchalib.php included in the PHP library to the directory "/components/com_fireboard/template/default/plugin/captcha/"

edit the file "fb_write.html.php" in your selected template (otherwise in the default template) and find this code:
Code:

<?php
// Begin captcha . Thanks Adeptus 
if ($fbConfig['captcha'] == 1 && $my->id < 1) { ?>
        <tr class = "<?php echo $boardclass; ?>sectiontableentry1">
            <td class = "fb_leftcolumn">&nbsp;<strong><?php echo _FB_CAPDESC; ?></strong>&nbsp;</td>
            <td align="left" valign="middle" height="35px">&nbsp;<input name="txtNumber" type="text" id="txtNumber" value="" class="button" style="vertical-align:top" size="15">          
<img src="<?php echo JB_DIRECTURL ;?>/template/default/plugin/captcha/randomImage.php" alt="" />
 </td>
         </tr>    
        <?php
}
// Finish captcha 
?>


replace it with
Code:

<?php
// Begin reCaptcha
if ($fbConfig['captcha'] == 1 && $my->id < 1) { ?>
        <tr class = "<?php echo $boardclass; ?>sectiontableentry1">
       <td class = "fb_leftcolumn">&nbsp;<strong><?php echo _FB_CAPDESC; ?></strong>&nbsp;</td>
       <td align="left" valign="middle">

<?php require_once($mosConfig_absolute_path.'/components/com_fireboard/template/default/plugin/captcha/recaptchalib.php');
$publickey = "REPLACE_THIS_WITH_YOUR_PUBLIC_KEY";
echo recaptcha_get_html($publickey);
?>
 </td>
         </tr>    
        <?php
}
// Finish reCaptcha 
?>


Then edit the file "post.php" in your selected template (otherwise in the default template) and find this code:
Code:

// Begin captcha
if ($fbConfig['captcha'] == 1 && $my->id < 1) {
    session_start();
    $number = $_POST['txtNumber'];

    if ($message != NULL)
    {
        if (md5($number) != $_SESSION['image_random_value'])
        {
            $mess = _FB_CAPERR;
            echo "<script language='javascript' type='text/javascript'>alert('" . $mess . "')</script>";
            echo "<script language='javascript' type='text/javascript'>window.history.back()</script>";
            return;
            die();
            //break;
        }
    }
}

// Finish captcha


replace it with
Code:

// Begin reCaptcha
if ($fbConfig['captcha'] == 1 && $my->id < 1) {
require_once($mosConfig_absolute_path.'/components/com_fireboard/template/default/plugin/captcha/recaptchalib.php');
$privatekey = "REPLACE_THIS_WITH_YOUR_PRIVATE_KEY";

if ($_POST["submit"]) {
$resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], mosGetParam( $_POST, 'recaptcha_challenge_field' ), mosGetParam( $_POST, 'recaptcha_response_field') );
if (!$resp->is_valid)
{
mosRedirect( sefRelToAbs('index.php?option=com_fireboard&amp;Itemid='. $Itemid .'&amp;func=post&amp;do=reply&amp;catid='. $catid) );
}
}
}
// Finish reCaptcha


I also edited "message.php" and replaced:
Code:

                                 <?php
// Begin captcha . Thanks Adeptus 
if ($fbConfig['captcha'] == 1 && $my->id < 1) { ?>
<?php echo _FB_CAPDESC.'&nbsp;'?>
<input name="txtNumber" type="text" id="txtNumber" value="" style="vertical-align:middle" size="10">&nbsp;
<img src="<?php echo JB_DIRECTURL ;?>/template/default/plugin/captcha/randomImage.php" alt="" /><br />
<?php
}
// Finish captcha 
?>


with
Code:

                                 <?php
// Begin reCaptcha 
if ($fbConfig['captcha'] == 1 && $my->id < 1) { ?>
<strong><?php echo _FB_CAPDESC; ?></strong>&nbsp;</td>
<?php require_once($mosConfig_absolute_path.'/components/com_fireboard/template/default/plugin/captcha/recaptchalib.php');
                                $publickey = "REPLACE_THIS_WITH_YOUR_PUBLIC_KEY";
                                echo recaptcha_get_html($publickey);
                                ?>
<?php
}
// Finish reCaptcha 
?>


but it worked also without this last replacement. As I said, I don't know nothing about the security of such modifications.

In the above replacements don't forget to REPLACE the "REPLACE_THIS_WITH_YOUR_PRIVATE_KEY" and "REPLACE_THIS_WITH_YOUR_PUBLIC_KEY" with you private/public keys you got from reCaptcha.

That should do it.

If anyone more capable in programming sees any errors or bad codings in the above code - please post correction. Also welcome would be a modification that would remember the written message if the code entered is wrong - now it just displays the form again.
bobysolo (User)
Fresh Boarder
Posts: 4
graphgraph
User Offline Click here to see the profile of this user
Logged Logged
 
Last Edit: 2008/08/04 03:37 By bobysolo. Reason: Preview is not working!
 
 
Go to top