function flood_register_event

cis7 common.inc flood_register_event($name, $window = 3600, $identifier = NULL)
cle7 common.inc flood_register_event($name, $window = 3600, $identifier = NULL)
elmsmedia7 common.inc flood_register_event($name, $window = 3600, $identifier = NULL)
icor7 common.inc flood_register_event($name, $window = 3600, $identifier = NULL)
meedjum_blog7 common.inc flood_register_event($name, $window = 3600, $identifier = NULL)
mooc7 common.inc 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).

5 calls to flood_register_event()
contact_personal_form_submit in modules/contact/contact.pages.inc
Form submission handler for contact_personal_form().
contact_site_form_submit in modules/contact/contact.pages.inc
Form submission handler for contact_site_form().
devel_init in sites/all/modules/ulmus/devel/devel.module
Implementation of hook_init().
email_mail_page_form_submit in sites/all/modules/ulmus/email/email.module
Process the site-wide contact page form submission.
user_login_final_validate in modules/user/user.module
The final validation handler on the login form.

File

includes/common.inc, line 1245
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();
}