function httpbl_request_whitelist_validate in http:BL 7
Same name and namespace in other branches
- 5 httpbl.module \httpbl_request_whitelist_validate()
- 6.2 httpbl.module \httpbl_request_whitelist_validate()
- 6 httpbl.module \httpbl_request_whitelist_validate()
Validate session whitelist request. Ban the user if the 'forbidden' field was filled in.
File
- ./
httpbl.module, line 486 - 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, HTTPBL_LIST_BLACK, variable_get('httpbl_blacklist_offset', 31536000));
$return_date = format_interval(variable_get('httpbl_blacklist_offset', 31536000), $granularity = 2, $langcode = NULL);
if (variable_get('httpbl_log', HTTPBL_LOG_MIN)) {
watchdog('httpbl', '%ip failed session whitelist request, blacklisted for %return_date.', array(
'%ip' => $ip,
'%return_date' => $return_date,
), WATCHDOG_WARNING, $iplink);
}
print t('Whitelist request failed; your IP has been blacklisted for ' . $return_date . '.');
exit;
}
else {
if (variable_get('httpbl_log', HTTPBL_LOG_MIN)) {
watchdog('httpbl', '%ip failed session whitelist request.', array(
'%ip' => $ip,
), WATCHDOG_WARNING, $iplink);
}
print t('Whitelist request failed.');
exit;
}
}
if (variable_get('httpbl_log', HTTPBL_LOG_MIN)) {
watchdog('httpbl', '%ip tried a whitelist request', array(
'%ip' => $ip,
), WATCHDOG_NOTICE, $iplink);
}
}