function olc_get_ip_info(&$smarty) { if (SHOW_IP_LOG == TRUE_STRING_S) { $customers_ip_text = 'CUSTOMERS_IP'; $ip = $_SESSION[$customers_ip_text]; if (!isset($ip)) { $ip = $_SERVER['REMOTE_ADDR']; if (strlen($ip) > 0) { if (function_exists("gethostbyaddr")) { //Get host-name for IP by built-in PHP-function $host = gethostbyaddr($ip); } if (strlen($host) == 0) { //"gethostbyaddr" does not work always, so try "Net_DNS" first define('FILENAME_NET_DNS', '"Net/DNS.php'); if (file_exists(FILENAME_NET_DNS)) { require_once FILENAME_NET_DNS; $res = new Net_DNS_Resolver(); $ans = $res->search($ip, "MX"); if ($ans) { $host = $ans->answer[0]->ptrdname; } } } if (strlen($host) > 0) { if ($host != $ip) { $ip .= LPAREN . $host . RPAREN; } } $ip .= ' -- Datum: ' . date("d.m.Y H:i:s"); $_SESSION[$customers_ip_text] = $ip; } } if ($smarty) { $smarty->assign('IP_LOG', true); $smarty->assign($customers_ip_text, $ip); } } }
function getdnsattributes($l, $ip) { $r = new Net_DNS_Resolver(); $r->nameservers = array("ws1.maxmind.com"); $p = $r->search($l . "." . $ip . ".s.maxmind.com", "TXT", "IN"); $str = is_object($p->answer[0]) ? $p->answer[0]->string() : ''; ereg("\"(.*)\"", $str, $regs); $str = $regs[1]; return $str; }
public function getdnsattributes($l, $ip) { $r = new Net_DNS_Resolver(); $r->nameservers = array("ws1.maxmind.com"); $p = $r->search($l . "." . $ip . ".s.maxmind.com", "TXT", "IN"); $str = is_object($p->answer[0]) ? $p->answer[0]->string() : ''; $str = substr($str, 1, -1); return $str; }
/** * @brief Resolve a LSID using the DNS * * */ function Resolve($lsid_to_resolve) { $result = true; $this->lsid = new LSID($lsid_to_resolve); $ndr = new Net_DNS_Resolver(); $answer = $ndr->search("_lsid._tcp." . $this->lsid->getAuthority(), "SRV"); if ($answer == false) { $result = false; } else { if ($this->debug) { echo "<pre>"; print_r($answer->answer); echo "</pre>"; } } $this->server = $answer->answer[0]->target; $this->port = $answer->answer[0]->port; if ($this->report) { echo "<p>"; echo "Authority for <strong>{$lsid_to_resolve}</strong> "; if ($result) { echo "is located at: ", $this->server, ":", $this->port; } else { echo "not found"; } echo "</p>"; } return $result; }
/** * Gets or sets the nameservers to be queried. * * Returns the current nameservers if an array of new nameservers is not * given as the argument OR sets the nameservers to the given nameservers. * * Nameservers not specified by ip address must be able to be resolved by * the default settings of a new Net_DNS_Resolver. * * @access public */ function nameservers($nsa = array()) { $defres = new Net_DNS_Resolver(); if (is_array($nsa)) { $a = array(); foreach ($nsa as $ns) { if (preg_match('/^(\\d+(:?\\.\\d+){0,3})$/', $ns)) { $a[] = $ns == 0 ? '0.0.0.0' : $ns; } else { $names = array(); if (!preg_match('/\\./', $ns)) { if (!empty($defres->searchlist)) { foreach ($defres->searchlist as $suffix) { $names[] = $ns . '.' . $suffix; } } elseif (!empty($defres->domain)) { $names[] = $ns . '.' . $defres->domain; } } else { $names[] = $ns; } $packet = $defres->search($ns); if (is_object($packet)) { $addresses = $this->cname_addr($names, $packet); foreach ($addresses as $b) { $a[] = $b; } $a = array_unique($a); } } } if (count($a)) { $this->nameservers = $a; } } return $this->nameservers; }
function getdnsattributes_VMWO($l, $ip) { $r = new Net_DNS_Resolver(); $r->nameservers = array("ws1.maxmind.com"); $p = $r->search($l . "." . $ip . ".s.maxmind.com", "TXT", "IN"); $str = is_object($p->answer[0]) ? $p->answer[0]->string() : ''; //ereg("\"(.*)\"",$str,$regs); // mike challis PHP5.3 fix preg_match("/\"(.*)\"/", $str, $regs); $str = isset($regs[1]) ? $regs[1] : ''; return $str; }