You are here

function _httpbl_cache_update in http:BL 6.2

Same name and namespace in other branches
  1. 5 httpbl.module \_httpbl_cache_update()
  2. 6 httpbl.module \_httpbl_cache_update()
  3. 7 httpbl.module \_httpbl_cache_update()

Update cache table

1 call to _httpbl_cache_update()
httpbl_request_whitelist_validate in ./httpbl.module
Validate session whitelist request. Ban the user if one of the 'forbidden' fields were filled.

File

./httpbl.module, line 747
Implementation of http:BL for Drupal. It provides IP-based blacklisting through http:BL and allows linking to a honeypot.

Code

function _httpbl_cache_update($ip, $status, $offset = 0) {
  db_query("UPDATE {httpbl} SET status = %d, expire = %d WHERE hostname = '%s'", $status, time() + $offset, $ip);

  // Note that IP addresses will not be deleted from the {access} table, but this is currently not needed.
  // TODO: check for duplicates
  if ($status == HTTPBL_LIST_BLACK && variable_get('httpbl_cache', HTTPBL_CACHE_DBDRUPAL)) {
    db_query("INSERT INTO {access} (mask, type, status) VALUES ('%s', '%s', %d)", $ip, 'host', 0);
  }
}