Blocks the current user's IP address.

Related topics

1 call to system_block_ip_action()
IPAddressBlockingTestCase::testDuplicateIpAddress in modules/system/system.test
Test duplicate IP addresses are not present in the 'blocked_ips' table.
1 string reference to 'system_block_ip_action'
system_action_info in modules/system/system.module
Implements hook_action_info().

File

modules/system/system.module, line 3397
Configuration system that lets administrators modify the workings of the site.

Code

function system_block_ip_action() {
  $ip = ip_address();
  db_merge('blocked_ips')
    ->key(array(
    'ip' => $ip,
  ))
    ->fields(array(
    'ip' => $ip,
  ))
    ->execute();
  watchdog('action', 'Banned IP address %ip', array(
    '%ip' => $ip,
  ));
}