You are here

function mip_address in Login Security 5

Helper function to get the IP Address viewing the page.

3 calls to mip_address()
login_security_user in ./login_security.module
Implementation of hook_user().
login_security_validate in ./login_security.module
Implementation of form validate. This functions does more than just validating, but it's main Intention is to break the login form flow.
_login_security_get_variables_by_name in ./login_security.module
Helper function to get the variable array for the messages.

File

./login_security.module, line 395
Login Security

Code

function mip_address() {
  static $ip_address = NULL;
  if (!isset($ip_address)) {
    $ip_address = $_SERVER['REMOTE_ADDR'];
    if (variable_get('reverse_proxy', 0) && array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER)) {

      // If there are several arguments, we need to check the most
      // recently added one, ie the last one.
      $ip_address = array_pop(explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']));
    }
  }
  return $ip_address;
}