You are here

function honeypot_log_failure in Honeypot 6

Same name and namespace in other branches
  1. 8 honeypot.module \honeypot_log_failure()
  2. 7 honeypot.module \honeypot_log_failure()
  3. 2.0.x honeypot.module \honeypot_log_failure()

Log the failed submision with timestamp.

Parameters

string $form_id: Form ID for the rejected form submission.

string $type: String indicating the reason the submission was blocked. Allowed values:

  • honeypot: If honeypot field was filled in.
  • honeypot_time: If form was completed before the configured time limit.
1 call to honeypot_log_failure()
_honeypot_log in ./honeypot.module
Log blocked form submissions.

File

./honeypot.module, line 297
Honeypot module, for deterring spam bots from completing Drupal forms.

Code

function honeypot_log_failure($form_id, $type) {
  global $user;

  // Log failed submissions for authenticated users.
  if ($user->uid) {
    db_query('INSERT INTO {honeypot_user} (uid, timestamp) VALUES (%d, %d)', $user->uid, time());
  }
  else {
    flood_register_event('honeypot');
  }

  // Allow other modules to react to honeypot rejections.
  module_invoke_all('honeypot_reject', $form_id, $user->uid, $type);
}