2010-08-25, 17:19:12
GREAT PLUGIN, haven't installed it yet
The dynamic CAPTCHA from Brian is also used by CMS sNews (see below) i've been using for years.
But since yesterday i've changed to GetSimple !
The dynamic CAPTCHA from Brian is also used by CMS sNews (see below) i've been using for years.
But since yesterday i've changed to GetSimple !
Code:
// MATH CAPTCHA
function mathCaptcha() {
$x = rand(1, 9);
$y = rand(1, 9);
$_SESSION[_SITE.'mathCaptcha-digit'] = $x + $y;
$math = '
<p><label for="calc">
* '.l('math_captcha').':
</label><br />';
$math .= $x.' + '.$y.' = ';
$math .= '
<input type="text" name="calc" id="calc" />
</p>';
return $math;
}
// CHECK MATH CAPTCHA RESULT
function checkMathCaptcha() {
$result = false;
$testNumber = isset($_SESSION[_SITE.'mathCaptcha-digit']) ? $_SESSION[_SITE.'mathCaptcha-digit'] : 'none';
unset($_SESSION[_SITE.'mathCaptcha-digit']);
if (is_numeric($testNumber) && is_numeric($_POST['calc']) && ($testNumber == $_POST['calc'])) {
$result = true;
}
return $result;
}