function httpbl_request_whitelist_validate in http:BL 6
Same name and namespace in other branches
- 5 httpbl.module \httpbl_request_whitelist_validate()
- 6.2 httpbl.module \httpbl_request_whitelist_validate()
- 7 httpbl.module \httpbl_request_whitelist_validate()
Validate session whitelist request. Ban the user if one of the 'forbidden' fields were filled.
File
- ./
httpbl.module, line 544 - Implementation of http:BL for Drupal. It provides IP-based blacklisting through http:BL and allows linking to a honeypot.
Code
function httpbl_request_whitelist_validate($form, &$form_state) {
$ip = ip_address();
$iplink = _httpbl_ipdata($ip);
if ($form_state['values']['block'] || $form_state['values']['leave']) {
if (variable_get('httpbl_cache', HTTPBL_CACHE_OFF)) {
_httpbl_cache_update($ip, 1, 86400);
watchdog('httpbl', '%ip failed session whitelist request, blacklisted for 24 hours.', array(
'%ip' => $ip,
), WATCHDOG_WARNING, $iplink);
print t('Whitelist request failed; your IP has been blacklisted for 24 hours.');
exit;
}
else {
watchdog('httpbl', '%ip failed session whitelist request.', array(
'%ip' => $ip,
), WATCHDOG_WARNING, $iplink);
print t('Whitelist request failed.');
exit;
}
}
if (variable_get('httpbl_log', FALSE)) {
watchdog('httpbl', '%ip tried a whitelist request', array(
'%ip' => $ip,
), WATCHDOG_NOTICE, $iplink);
}
}