function flood_register_event
flood_register_event($name, $window = 3600, $identifier = NULL)
Registers an event for the current visitor to the flood control mechanism.
Parameters
$name: The name of an event.
$window: Optional number of seconds before this event expires. Defaults to 3600 (1 hour). Typically uses the same value as the flood_is_allowed() $window parameter. Expired events are purged on cron run to prevent the flood table from growing indefinitely.
$identifier: Optional identifier (defaults to the current user's IP address).
File
- includes/common.inc, line 1288
- Common functions that many Drupal modules will need to reference.
Code
function flood_register_event($name, $window = 3600, $identifier = NULL) { if (!isset($identifier)) { $identifier = ip_address(); } db_insert('flood') ->fields(array( 'event' => $name, 'identifier' => $identifier, 'timestamp' => REQUEST_TIME, 'expiration' => REQUEST_TIME + $window, )) ->execute(); }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!common.inc/function/flood_register_event/7.x