You are here

function ip_ranges_write_record in IP Ranges 7.2

Same name and namespace in other branches
  1. 7 ip_ranges.module \ip_ranges_write_record()

Creates/updates an entry to the ban database.

Parameters

$ip: IP-address or range to bw written to the database.

$type: Type of the list(blacklist, whitelist).

$bid: (optional) id of the current ban, used when existing record is updated.

1 call to ip_ranges_write_record()
ip_ranges_whitelist_own_address in ./ip_ranges.module
Whitelists users own IP-address.

File

./ip_ranges.module, line 131

Code

function ip_ranges_write_record($ip, $type, $bid = NULL, $description = NULL) {
  db_merge('ip_ranges')
    ->key(array(
    'bid' => $bid,
  ))
    ->fields(array(
    'bid' => $bid,
    'ip' => $ip,
    'type' => $type,
    'description' => $description,
  ))
    ->execute();
}