You are here

function httpbl_se in http:BL 5

Same name and namespace in other branches
  1. 6.2 httpbl.module \httpbl_se()
  2. 6 httpbl.module \httpbl_se()

Check if an IP is known to belong to a search engine

Parameters

string $ip:

Return value

bool

File

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

Code

function httpbl_se($ip = NULL) {
  if ($response = httpbl_dnslookup($ip)) {
    $iplink = _httpbl_iplink($ip);

    // positive threat, type is search engine (0)
    if ($response['threat'] && $response['type'] == 0) {
      if (variable_get('httpbl_log', 1) > 2) {
        watchdog('httpbl', t('Search engine lookup for %ip was positive (%response)', array(
          '%ip' => $ip,
          '%response' => $response['raw'],
        )), WATCHDOG_NOTICE, $iplink);
      }
      return TRUE;
    }
    else {
      if (variable_get('httpbl_log', 1) > 2) {
        watchdog('httpbl', t('Search engine lookup for %ip was negative (%response)', array(
          '%ip' => $ip,
          '%response' => $response['raw'],
        )), WATCHDOG_NOTICE, $iplink);
      }
      return FALSE;
    }
  }
  else {
    return FALSE;
  }
}