<?php
// +----------------------------------------------------------------------+
// | PHP version 4.0 |
// +----------------------------------------------------------------------+
// | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Author: FengSe (shirui@gmail.com) |
// +----------------------------------------------------------------------+
// $Id: index.php,v 1.0 2006/04/08 FengSe Exp $
error_reporting(7);
set_time_limit(300);
// Server List File
$config['server_list'] = "servers.lst";
$domain = trim($_POST['domain']);
$domain = strtolower($domain);
if(substr($domain,0,7) == "http://") {
$domain = str_replace("http://","",$domain);
}
if(substr($domain,0,4) == "www.") {
$domain = str_replace("www.","",$domain);
}
function whois_request($server, $query)
{
$data = "";
if(!$fp = @fsockopen($server, 43)) {
Return false;
} else {
fputs($fp, $query . "\r\n");
while (!feof($fp)) {
$data .= fread($fp, 1000);
}
fclose($fp);
}
return nl2br($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;
}
function startwhois() {
global $domain;
if(!$server = get_server()) {
die("无法查询此类型的域名");
}
$result1 = whois_request($server['server'], $domain);
$result2 = whois_request($server['infoserver'], $domain);
if(!$result1 && !$result2) {
echo "无法连接服务器";
die();
} else {
$result = $result1."<br />".$result2;
echo $result;
}
}
if(isset($_GET['action']) && trim($_GET['action']) == "do") {
startwhois();
die();
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Whois查询</title>
<link href="global.css" rel="stylesheet" type="text/css" />
<script src="global.js" type="text/javascript"></script>
<SCRIPT type="text/javascript">
<!--
var xmlHttp;
function creatXMLHttpRequest() {
if(window.ActiveXObject) {
xmlHttp = new ActiveXObject('Microsoft.XMLHTTP');
} else if(window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
}
}
function startRequest() {
var queryString;
var domain = document.getElementById('domain').value;
queryString = "domain=" + domain;
creatXMLHttpRequest();
xmlHttp.open("POST","?action=do","true");
xmlHttp.onreadystatechange = handleStateChange;
xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;");
xmlHttp.send(queryString);
}
function handleStateChange() {
if(xmlHttp.readyState == 1) {
document.getElementById('result').style.cssText = "";
document.getElementById('result').innerText = "Loading...";
}
if(xmlHttp.readyState == 4) {
if(xmlHttp.status == 200) {
document.getElementById('result').style.cssText = "";
var allcon = xmlHttp.responseText;
document.getElementById('result').innerHTML = allcon;
}
}
}
//-->
</SCRIPT>
</head>
<body>
<div class="t">Whois查询:请在下框中输入您要查询的域名,不用带http://</div>
<center>
<div class="c">
<div> <input name="domain" type="text" size="36" maxlength="100" id="url" onkeydown="if(event.keyCode==13)event.keyCode=9;" />
<input type="button" name="button" value="查 询" id="sub" onclick="startRequest();" /></div>
<div id="result" style="display:none"></div>
</div>
</center>
</body>
</html>
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
【项目资源】:包含前端、后端、移动开发、操作系统、人工智能、物联网、信息化管理、数据库、硬件开发、大数据、课程资源、音视频、网站开发等各种技术项目的源码。包括STM32、ESP8266、PHP、QT、Linux、iOS、C++、Java、python、web、C#、EDA、proteus、RTOS等项目的源码。【项目质量】:所有源码都经过严格测试,可以直接运行。功能在确认正常工作后才上传。【适用人群】:适用于希望学习不同技术领域的小白或进阶学习者。可作为毕设项目、课程设计、大作业、工程实训或初期项目立项。【附加价值】:项目具有较高的学习借鉴价值,也可直接拿来修改复刻。对于有一定基础或热衷于研究的人来说,可以在这些基础代码上进行修改和扩展,实现其他功能。【沟通交流】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。鼓励下载和使用,并欢迎大家互相学习,共同进步。
资源推荐
资源详情
资源评论
收起资源包目录
521yy 网站Whois查询 php版 1.0_whois_工具查询网站开发模板(使用说明+PHP源代码+html).zip (4个子文件)
[工具查询]521yy 网站Whois查询 php版 1.0_whois
whois
servers.lst 23KB
global.css 4KB
index.php 5KB
global.js 2KB
共 4 条
- 1
资源评论
CyMylive.
- 粉丝: 6784
- 资源: 3万+
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功