You are here

function captcha_after_global_flood_is_allowed in CAPTCHA After 6

Same name and namespace in other branches
  1. 7 captcha_after.module \captcha_after_global_flood_is_allowed()

Helper function.

Removed hostname check from Drupal core's flood_is_allowed function.

1 call to captcha_after_global_flood_is_allowed()
captcha_after_show_captcha in ./captcha_after.module
Tests current form on captcha after threashold settings.

File

./captcha_after.module, line 109
Show CAPTCHA protection on selected forms after specified number of unsuccessful form submit attempts has been made.

Code

function captcha_after_global_flood_is_allowed($name, $threshold) {
  $number = db_result(db_query("SELECT COUNT(*) FROM {flood} WHERE event = '%s' AND timestamp > %d", $name, time() - 3600));
  return $number < $threshold ? TRUE : FALSE;
}