';
echo '
查询结果
';
echo '';
}else{
echo '
';
echo '
Error!
';
echo '';
echo '
';
}
}else{
echo '
';
echo '
工具说明
';
echo '';
echo '
';
}
function whois() {
global $domain;
if(!$server = get_server()) {
die("无法查询此类型的域名");
}
$result = whois_request($server['server'], $domain);
if(!$result) {
echo "无法连接服务器";
die();
}
$server['info']=trim($server['info']);
if($server['info']){
$he = strpos($result,$server['info']) + strlen($server['info']);
$le = strpos($result, " ", $he);
$whois_server = trim(substr($result, $he, $le-$he));
$result2 = whois_request($whois_server, $domain);
if($result2){
echo nl2br($result." 以下信息来自:".$whois_server." ".$result2);
}else {
echo nl2br($result);
}
}else {
echo nl2br($result);
}
}
/*function whois() {
global $domain;
if(!$server = get_server()) {
echo "无法查询此类型的域名";
}else{
$result = whois_request($server['server'], $domain);
if(!$result) {
echo "无法连接服务器";
} else {
echo $result;
}
}
}
*/
function whois_request($server, $query)
{
$data = "";
if(!$fp = @fsockopen($server, 43)) {
Return false;
} else {
fputs($fp, $query . " ");
while (!feof($fp)) {
$data .= fread($fp, 1000);
}
fclose($fp);
}
//return nl2br($data);
return $data;
}
function get_server() {
global $config,$domain;
$serverarray = file($config['server_list']);
$i = 0;
foreach($serverarray as $key=>$val) {
if(substr($val,0,1) != "#") {
$server_p = explode("|",$val);
$server[$i]['tld'] = $server_p[0];
$server[$i]['server'] = $server_p[1];
$server[$i]['avail'] = $server_p[2];
$server[$i]['infoserver'] = $server_p[3];
$server[$i]['backserver'] = $server_p[4];
$server[$i]['info'] = $server_p[5];
}
$i++;
}
$domain_c = explode(".",$domain);
$partnum = count($domain_c);
$last_part_1 = $domain_c[$partnum-1];
$last_part_2 = $domain_c[$partnum-2];
foreach($server as $key=>$val) {
if($val['tld'] == $last_part_2.".".$last_part_1) {
Return $val;
} elseif($val['tld'] == $last_part_1) {
Return $val;
}
}
Return false;
}
$q=trim($_GET['q']);
$q2=$q;
if($q''){
if($q=matchip($q2)){
$isip=1;
}elseif($q=matchdomain($q2)){
$domain=topdomain($q2);
$isdomain=1;
}
}