function login_user_block_ip in Login Security 7
Same name and namespace in other branches
- 8 login_security.module \login_user_block_ip()
- 5 login_security.module \login_user_block_ip()
- 6 login_security.module \login_user_block_ip()
- 2.x login_security.module \login_user_block_ip()
Create a Deny entry for the IP address.
If IP address is not especified then block current IP.
1 call to login_user_block_ip()
- login_security_validate in ./
login_security.module - Implements hook_validate().
File
- ./
login_security.module, line 376 - Login Security
Code
function login_user_block_ip($variables) {
// There is no need to check if the host has been banned, we can't get here
// twice.
$block = new stdClass();
$block->ip = $variables['@ip'];
drupal_write_record('blocked_ips', $block);
watchdog('login_security', 'Banned IP address @ip due to security configuration.', $variables, WATCHDOG_NOTICE, l(t('view/delete blocked IPs'), "admin/config/people/ip-blocking"));
// Using form_set_error because it may disrupt current form submission.
form_set_error('void', login_security_t(variable_get('login_security_host_hard_banned', LOGIN_SECURITY_HOST_HARD_BANNED), $variables));
}