[tighturl-users] tighturl question...

Dave nugenx7 at gmail.com
Fri Dec 16 12:27:08 EST 2011


function URI_on_URIBL($uri) {

// This code does not yet properly implement a correct and efficient
querying
// of URI BL data.

  global $uribl, $uribluri, $validschemes, $validurlpattern,
$validipv4pattern,
         $antiabuse, $netchecks, $tltlds;

  // Everything gets a pass if antiabuse or network tests are off.
  if ((! $antiabuse) || (! $netchecks)) return(false);

  $uribls = "";

  if ($uri) {
    // Test for IPv4 address, reverse the quads if found
    if (preg_match("/^".$validschemes.$validipv4pattern."/", $uri,
$matches)) {
      $domain=$matches[5] . "." . $matches[4] . "." . $matches[3] . "." .
$matches[2];
    }
    else {
      // strip out second-level domain name, *unless* on exception list,
      // in which case, strip out third level also and test that instead.
      // FIX: when testing uribl.com lists, also test additional level.
 First hit wins.

      preg_match("/^".$validschemes.$validurlpattern."$/", $uri, $matches);
      $domain = $matches[4];
      if (preg_match("/".$tltlds."$/", $domain, $matches)) {$levels = 2;}
else {$levels = 1;}

      // klugey stripping routine to reduce domain to base domain name
      // expect regex wojuld be better

      $ss = countSubstrs($domain, ".");
      while ($ss > $levels) {
        $chop = strpos($domain, ".");
        $domain = substr($domain, $chop + 1);
        $ss = countSubstrs($domain, ".");
      }
    }

    // Query URI blacklists to see if domain/IP appears as target in known
spam
    // or something involved in a malware/phishing attack.
    for ($i=0; $i<count($uribl); $i++) {
      $fqdn = $domain . "." . $uribl[$i];
      $recexists = gethostbyname($fqdn); // ghbn weirdly returns the name
on failure
      if (($recexists != $fqdn) && preg_match("<^127\.>", $recexists)) {
        if ($i > 0) $uribls .= ", ";
        $uribls .= $uribl[$i];
      }
    }
    return ($uribls); // change to return an array of indexes into the
URIBL array
  }
}

/**
 * Checks to see if a given URL is a Reserved URL.
 *
 * Returns TRUE if the ID is listed as a Reserved URL.
 */
function on_Reserve($decimal) {
  global $ReservedURL;

  $res=FALSE;

  if ($decimal) {
    $sexatrigesimal = base_convert($decimal, 10, 36);
    for ($i=0; $i<count($ReservedURL); $i++) {
      if ($sexatrigesimal == strtolower($ReservedURL[$i])) return TRUE;
    }
    return FALSE;
  }
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.tighturl.com/pipermail/tighturl-users/attachments/20111216/492b3e38/attachment.html>


More information about the TightURL-users mailing list