public function IPTools::getUserIP in Restrict Login or Role Access by IP Address 8.4
Return the IP address of the current user using restrict_by_ip general settings.
Overrides IPToolsInterface::getUserIP
File
- src/
IPTools.php, line 25
Class
- IPTools
- Class IPTools.
Namespace
Drupal\restrict_by_ipCode
public function getUserIP() {
$header = $this->config
->get('header');
$ip_address = '';
if (!empty($_SERVER[$header])) {
$ip_address = $_SERVER[$header];
}
return $ip_address;
}