captcha was computed when validating... not really useful

This commit is contained in:
real_nowhereman 2008-02-28 11:32:32 +00:00
parent cb2982c6f9
commit 52aaf6ea3c

View File

@ -25,34 +25,19 @@ function plugin_aaspam_validate($bool) {
// get the value and reset last saved, so that // get the value and reset last saved, so that
// an attacker can't use the old one for multiple posting // an attacker can't use the old one for multiple posting
$val = sess_remove('aaspam'); $v = sess_remove('aaspam');
// we get the array stored in session: // we get the array stored in session:
// if it evaluated to false value (e.g. is null) test fails // if it evaluated to false value (e.g. is null) test fails
if (!$val) if (!$v)
return false; return false;
// we import the array keys into current scope
extract($val);
// execute the operation
switch($op) {
case '+' :
$v = $v1+$v2;
break;
case '-' :
$v = $v1-$v2;
break;
case '*' :
$v = $v1*$v2;
break;
}
// we test the result wether match user input // we test the result wether match user input
if (!($ret = $_POST['aaspam']==$v)) { if (!($ret = $_POST['aaspam']==$v)) {
global $_FP_SMARTY; global $smarty;
$lang = lang_load('plugin:accessibleantispam'); $lang = lang_load('plugin:accessibleantispam');
$_FP_SMARTY->append('error', $lang['plugin']['accessibleantispam']['error']); $smarty->append('error', $lang['plugin']['accessibleantispam']['error']);
} }
@ -87,8 +72,22 @@ function plugin_aaspam_comment_form() {
} }
// save an array like this array(operand, operation, operand) // execute the operation
sess_add('aaspam', compact('v1','op','v2')); switch($op) {
case '+' :
$v = $v1+$v2;
break;
case '-' :
$v = $v1-$v2;
break;
case '*' :
$v = $v1*$v2;
break;
}
sess_add('aaspam', $v);
// load plugin strings // load plugin strings
// they're located under plugin.PLUGINNAME/lang/LANGID/ // they're located under plugin.PLUGINNAME/lang/LANGID/