Add Captcha Mod in sNews
Tested with sNews 1.6
Posted by Firdaus Maulana for sNews Forum
Captcha source : http://gscripts.net
Preview in sNews :

Download all Support files ( captcha_support_files.zip ) first : :
- captcha.php
- fontsarialbd.ttf
- fontsVeraBd.ttf
- fontsverdanab.ttf
1. Copy all support files to snews-root
2. Modified mathCaptcha function with :
-----------------------------------------------------------------------
function mathCaptcha($input='', $sum='') {
if ( isset($_REQUEST['inputcode'])) {
if (md5($_REQUEST['inputcode']) == $_SESSION['__vimg_code__']) { // Check Captcha
$math = true;
}else{
$math = false;
} //endif check captcha
}else {
$sum = time();
$math = '<p><label for="calc">* '.l('math_captcha').':</label><br />';
$math .= '<img id="__code__" src="captcha.php?id=".$sum." style="border:1px solid #000000" /><br/>';
$math .= 'Captcha code ( case sensitive ) <input type="text" name="inputcode" size="5" maxlength="5" /></p>';
} //endif $_REQUEST
return $math;
}
-----------------------------------------------------------------------
3. Remove is_numeric function under //COMMENTS and $doublecheck = retrieve('id', ..... with :
-----------------------------------------------------------------------
if ($ip == $_SERVER['REMOTE_ADDR'] && (time() - $now) > 4 && $comment && $name && $post_article_id && mathCaptcha($_POST['calc'], $_POST['sum']) && !isset($doublecheck)) {
-----------------------------------------------------------------------
4.Change captcha related variable under #SITE LANGUAGE VARIABLES with
-----------------------------------------------------------------------
$l['math_captcha'] = 'Perform Captcha code to avoid spam';
$l['err_Login'] = 'Wrong username and/or password and/or Captcha.';
-----------------------------------------------------------------------
18.06.2008. 18:36
This article hasn't been commented yet.
Write a comment
* = required field