You are here

function _ip_login_get_user_range in IP Login 7.2

Same name and namespace in other branches
  1. 6.2 ip_login.module \_ip_login_get_user_range()

Gets a user's IP range match string by uid

Parameters

$uid: The user ID

Return value

The IP range string for the user if one is found, otherwise NULL.

2 calls to _ip_login_get_user_range()
ip_login_form_alter in ./ip_login.module
Implementation of hook_form_alter().
_ip_login_set_user_range in ./ip_login.module
Sets the IP range match string for a user.

File

./ip_login.module, line 631
Allow user login by IP addresses, ranges or wildcards.

Code

function _ip_login_get_user_range($uid) {
  if (isset($uid) && is_numeric($uid)) {
    $result = db_query('SELECT * FROM {ip_login_user} WHERE uid = :uid', array(
      ':uid' => $uid,
    ));
    foreach ($result as $record) {
      return $record->ip_match;
    }
  }
  return NULL;
}