function ip_login_check in IP Login 7.3
Same name and namespace in other branches
- 6.2 ip_login.module \ip_login_check()
- 7.2 ip_login.module \ip_login_check()
Compares the current request's IP address to the ip_login_user table and then does a proper match for each match on exact, ranges and wildcards
Parameters
$ip: An ip address string, usually from the current user's request
Return value
$uid_matched The uid of the matching user account
4 calls to ip_login_check()
- ip_login_attempt_login in ./
ip_login.module - Checks the request IP and logs user in there's a match by calling ip_login_check then ip_login_attempt_login
- ip_login_boot in ./
ip_login.module - Implementation of hook_boot().
- ip_login_form_alter in ./
ip_login.module - Implementation of hook_form_alter().
- _ip_login_can_login_as_another_user in ./
ip_login.module
File
- ./
ip_login.module, line 374 - Allow user login by IP addresses, ranges or wildcards.
Code
function ip_login_check($ip, $diagnostics = FALSE) {
// have we checked user IP already this session?
if (!empty($_SESSION[IP_CHECKED])) {
return $_SESSION[IP_UID_MATCH];
}
$uid_matched = ip_login_match_user($ip, $diagnostics);
// if not diagnostic test, set processed session flag, store matching user (if there is one)
if (!$diagnostics) {
$_SESSION[IP_CHECKED] = TRUE;
$_SESSION[IP_UID_MATCH] = $uid_matched;
}
return $uid_matched;
}