You are here

function _login_security_remove_events in Login Security 7

Same name and namespace in other branches
  1. 8 login_security.module \_login_security_remove_events()
  2. 6 login_security.module \_login_security_remove_events()
  3. 2.x login_security.module \_login_security_remove_events()

Remove tracked events or expire old ones.

Parameters

string $name: If specified, events for this user name will be removed.

string $host: If specified, IP Address of the name-ip pair to be removed.

4 calls to _login_security_remove_events()
login_security_cron in ./login_security.module
Implements hook_cron().
login_security_user_login in ./login_security.module
Implements hook_user_login().
login_security_user_update in ./login_security.module
Implements hook_user_update().
login_security_validate in ./login_security.module
Implements hook_validate().

File

./login_security.module, line 313
Login Security

Code

function _login_security_remove_events($name = NULL, $host = NULL) {

  // Remove selected events.
  if (!empty($name)) {
    if (!empty($host)) {
      $result = db_delete('login_security_track')
        ->condition('name', $name)
        ->condition('host', $host)
        ->execute();
    }
    else {
      $result = db_delete('login_security_track')
        ->condition('name', $name)
        ->execute();
    }
  }
  else {

    // Calculate protection time window and remove expired events.
    $time = REQUEST_TIME - variable_get('login_security_track_time', LOGIN_SECURITY_TRACK_TIME) * 3600;
    _login_security_remove_all_events($time);
  }
}