You are here

function ip_tracker_ip_records in IP address manager 8.2

Same name and namespace in other branches
  1. 6 ip.module \ip_tracker_ip_records()
  2. 7.2 ip.module \ip_tracker_ip_records()
  3. 7 ip.module \ip_tracker_ip_records()

Get the records from the tracker for an IP.

File

./ip.module, line 61
IP address manager module.

Code

function ip_tracker_ip_records($ip) {
  $sql = "SELECT * FROM {ip_tracker}";
  $args = array();
  if (!empty($ip)) {
    $sql .= " WHERE ip = :ip";
    $args[':ip'] = ip2long($ip);
  }
  $result = db_query($sql, $args);
  $rows = array();
  foreach ($result as $row) {
    $row->ip = long2ip($row->ip);
    $rows[] = $row;
  }
  return $rows;
}