bot-safer contact form

This commit is contained in:
Ralf Becker 2008-05-07 13:12:33 +00:00
parent 84a9f87127
commit 0c586d9ff0

View File

@ -37,7 +37,9 @@ class addressbook_contactform
if (is_array($content)) if (is_array($content))
{ {
if (isset($content['captcha_result']) && $content['captcha'] != $content['captcha_result']) if (isset($content['captcha_result']) && $content['captcha'] != $content['captcha_result'] || // no correct captcha OR
time() - $content['start_time'] < 10 && // bot indicator (less then 10 sec to fill out the form and
!$GLOBALS['egw_info']['etemplate']['java_script']) // javascript disabled)
{ {
$tpl->set_validation_error('captcha',lang('Wrong - try again ...')); $tpl->set_validation_error('captcha',lang('Wrong - try again ...'));
} }
@ -121,6 +123,7 @@ class addressbook_contactform
$content['show'][$name] = true; $content['show'][$name] = true;
} }
} }
$preserv['start_time'] = time();
} }
$content['addr_format'] = $GLOBALS['egw_info']['user']['preferences']['addressbook']['addr_format']; $content['addr_format'] = $GLOBALS['egw_info']['user']['preferences']['addressbook']['addr_format'];