function system_block_ip_action

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 3397

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,
    ));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.