You are here

function captcha_after_global_flood_is_allowed in CAPTCHA After 7

Same name and namespace in other branches
  1. 6 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_query("SELECT COUNT(*) FROM {flood} WHERE event = :name AND timestamp > :time", array(
    ':name' => $name,
    ':time' => REQUEST_TIME - 3600,
  ))
    ->fetchField();
  return $number < $threshold ? TRUE : FALSE;
}