function system_block_ip_action

Blocks the current user's IP address.

Related topics

1 call to system_block_ip_action()
IPAddressBlockingTestCase::testDuplicateIpAddress in drupal/modules/system/system.test
Test duplicate IP addresses are not present in the 'blocked_ips' table.

File

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