You are here

function system_block_ip_action in Drupal 7

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.

File

modules/system/system.module, line 3385
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,
  ));
}