function honeypot_log_failure in Honeypot 7
Same name and namespace in other branches
- 8 honeypot.module \honeypot_log_failure()
- 6 honeypot.module \honeypot_log_failure()
- 2.0.x honeypot.module \honeypot_log_failure()
Log the failed submision with timestamp and hostname.
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 464 - Honeypot module, for deterring spam bots from completing Drupal forms.
Code
function honeypot_log_failure($form_id, $type) {
global $user;
db_insert('honeypot_user')
->fields(array(
'uid' => $user->uid,
'hostname' => ip_address(),
'timestamp' => REQUEST_TIME,
))
->execute();
// Allow other modules to react to honeypot rejections.
module_invoke_all('honeypot_reject', $form_id, $user->uid, $type);
// Trigger honeypot_reject action.
if (module_exists('trigger')) {
$aids = trigger_get_assigned_actions('honeypot_reject');
$context = array(
'group' => 'honeypot',
'hook' => 'honeypot_reject',
'form_id' => $form_id,
// Do not provide $user in context because it is available as a global.
'type' => $type,
);
// Honeypot does not act on any specific object.
$object = NULL;
actions_do(array_keys($aids), $object, $context);
}
// Trigger rules honeypot_reject event.
if (module_exists('rules')) {
rules_invoke_event('honeypot_reject', $form_id, $type);
}
}