function _restrict_by_ip_get_ip in Restrict Login or Role Access by IP Address 7.3
Same name and namespace in other branches
- 6.3 restrict_by_ip.module \_restrict_by_ip_get_ip()
Returns the IP address of the user, taking into account header configuration.
3 calls to _restrict_by_ip_get_ip()
- restrict_by_ip_login_settings in ./
restrict_by_ip.module - Menu callback for restrict login settings
- restrict_by_ip_role_check in ./
restrict_by_ip.module - Perform an IP restriction check for all roles belonging to the given user.
- _restrict_by_ip_login in ./
restrict_by_ip.module - Login function Checks the user's ip address on login If they are not restricted, or logging in from the appropriate address allow logon to continue. If not redirect to a designated page
File
- ./
restrict_by_ip.module, line 533 - Allows the admin to select which ip addresses role or a user can login from for this site Some of the code below is taken from the cck_ipaddress_module
Code
function _restrict_by_ip_get_ip() {
$header = variable_get('restrict_by_ip_header', 'REMOTE_ADDR');
$ip_address = '';
if (!empty($_SERVER[$header])) {
$ip_address = $_SERVER[$header];
}
/**
* Warning: Using this hook has security implications. Providing a wrong IP
* address could allow users to bypass IP restrictions.
*/
drupal_alter('restrict_by_ip_get_ip', $ip_address);
return $ip_address;
}