You are here

function _login_security_add_event in Login Security 6

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

Save the login attempt in the tracking database: user name nd ip address.

Parameters

$name: user name to be tracked.

$ip: IP Address of the pair.

1 call to _login_security_add_event()
login_security_set_login_timestamp in ./login_security.module
Previous incarnations of this code put it in hook_submit or hook_user, but since Drupal core validation updates the login timestamp, we have to set the message before it gets updated with the current login instance.

File

./login_security.module, line 281
Login Security

Code

function _login_security_add_event($name, $ip) {

  //Each attempt is kept for future minning of advanced bruteforcing like multiple

  //IP or X-Forwarded-for usage and automated track data cleanup
  $event = new stdClass();
  $event->host = $ip;
  $event->name = $name;
  $event->timestamp = time();
  drupal_write_record('login_security_track', $event);
}