Captcha with Audio for Dolphin 7

lancashiredates posted 17th of April 2010 in Community Voice. 1 comment.

If you need to integrate this with Dolphin 6 Look Here

For Dolphin 7 You can swap the current Captcha for a third party one with Captcha Refresh and Audio.

I have done this with Securimage from http://www.phpcaptcha.org/

You can set it to play audio via flash or by clicking an image that plays a wav file.

I used Securimage V 2.0.1 for this tutorial.

Step 1.

Upload Securimage files to a folder called /captcha/ in your main dolphin directory.

Step 2. Set Cookie for D7

Edit /captcha/securimage.php

Find: around line 1000

function generateCode($len)

{

$code = '';

for($i = 1, $cslen = strlen($this->charset); $i <= $len; ++$i) {

$code .= $this->charset{rand(0, $cslen - 1)};

}

return $code;

}

Replace with:

function generateCode($len)

{

$code = '';

for($i = 1, $cslen = strlen($this->charset); $i <= $len; ++$i) {

$code .= $this->charset{rand(0, $cslen - 1)};

}

$hashtext = md5($code);

setcookie('strSec', $hashtext, 0, '/');

return $code;

}

Step 3. Show Captcha Code in D7 Join Form

Edit /templates/base/scripts/BxBaseFormView.php

Find: around line 217

$sButtonAdd = <<<BLAH

<img src="$sReloadImgUrl" class="reload_button" alt="$sReloadText" title="$sReloadText"

onclick="var \$img = $(this).siblings('.input_wrapper').children('.form_input_captcha').children('img.captcha'); \$img.attr('src', \$img.attr('src').split('?')[0] + '?r=' + Math.random());" />

BLAH;


Replace with:

$sPlayFile = BX_DOL_URL_ROOT . 'captcha/securimage_play.php';

$sPlayIcon = BX_DOL_URL_ROOT . 'captcha/images/audio_icon.gif';

$sButtonAdd = <<<BLAH

<a style="border-style: none;float:left;" href="$sPlayFile" title="Audible Version of CAPTCHA"><img src="$sPlayIcon" alt="Audio Version" style="border:none" alt="this.blur()" /></a>

<img src="$sReloadImgUrl" class="reload_button" alt="$sReloadText" title="$sReloadText"

onclick="var \$img = $(this).siblings('.input_wrapper').children('.form_input_captcha').children('img.captcha'); \$img.attr('src', \$img.attr('src').split('?')[0] + '?r=' + Math.random());" />

BLAH;

Then find around line 1034

$sSimgUrl = BX_DOL_URL_ROOT . 'simg/simg.php';

And replace with

$mtime= md5(time());

$sSimgUrl = BX_DOL_URL_ROOT . 'captcha/securimage_show.php?sid=' . $mtime;

Step 4. stop the old Captcha from overwriting the Cookie

Edit /simg/simg.php

Remove or Comment these lines: around line 36


$hashtext = md5($textstr);
setcookie('strSec', $hashtext, 0, '/');

Thats it

This was done on Dolphin V 7.0

Check it out here Truck Buddies

For instruction in txt format click here

Dave

 
Recommended by
 
 
Comments
·Oldest
·Top
Please login to post a comment.
Both of your Captcha modifications would be good posts in the tips n tricks area of the forums.
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.
PET:0.051470994949341