static function MoAuthUtilities::get_client_ip in Google Authenticator / 2 Factor Authentication - 2FA 8.2
Same name and namespace in other branches
- 8 src/MoAuthUtilities.php \Drupal\miniorange_2fa\MoAuthUtilities::get_client_ip()
Return value
array|false|string Function to get the client IP address
1 call to MoAuthUtilities::get_client_ip()
File
- src/
MoAuthUtilities.php, line 305 - This file is part of miniOrange 2FA module.
Class
Namespace
Drupal\miniorange_2faCode
static function get_client_ip() {
$ipaddress = '';
if (getenv('HTTP_CLIENT_IP')) {
$ipaddress = getenv('HTTP_CLIENT_IP');
}
else {
if (getenv('REMOTE_ADDR')) {
$ipaddress = getenv('REMOTE_ADDR');
}
else {
if (getenv('HTTP_X_FORWARDED_FOR')) {
$ipaddress = getenv('HTTP_X_FORWARDED_FOR');
}
else {
if (getenv('HTTP_X_FORWARDED')) {
$ipaddress = getenv('HTTP_X_FORWARDED');
}
else {
if (getenv('HTTP_FORWARDED_FOR')) {
$ipaddress = getenv('HTTP_FORWARDED_FOR');
}
else {
if (getenv('HTTP_FORWARDED')) {
$ipaddress = getenv('HTTP_FORWARDED');
}
else {
$ipaddress = 'UNKNOWN';
}
}
}
}
}
}
return $ipaddress;
}