flood_is_allowed

  1. drupal
    1. drupal6
    2. drupal7
Versionen
drupal6 – drupal7 flood_is_allowed($name, $threshold)

Check if the current visitor (hostname/IP) is allowed to proceed with the specified event.

The user is allowed to proceed if he did not trigger the specified event more than $threshold times per hour.

Übergabeparameter

$name The name of the event.

$threshold The maximum number of the specified event per hour (per visitor).

Rückgabewert

True if the user did not exceed the hourly threshold. False otherwise.

Code

includes/common.inc, line 1041

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

Kommentare

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen