栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > PHP

无数据库的详细域名查询程序PHP版(1)

PHP 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

无数据库的详细域名查询程序PHP版(1)

文件一:index.php


echo "\n";



if(!isset($use_global_templates))
    $use_global_templates = 1;    // whether to use the global templates

$template_header = "gheader.tml";    // the global header template
$template_footer = "gfooter.tml";    // the global footer template



$template_search_mini = "searchform.tml";    // search template
$template_search = "searchmain.tml";
$template_raw_output = "rawoutput.tml";    // raw output template
$template_available = "isavail.tml";    // template for available
$template_taken = "istaken.tml";    // template for taken
$template_wizard = "wizard.tml";    // template for the domain wizard
$template_wizard_results = "wizardres.tml"; // the output template for the domain wizard
$template_error = "error.tml";    // the template in case of error
$template_exts_list = "exts_list.tml";
$template_global = "global.tml";
$template_global_results = "globres.tml";

$search_title = "Let Floyd find your domain name";
$raw_output_title = "Floyd's Raw WHOIS Output";
$available_title = "Floyd says Domain Name Available!";
$taken_title = "Floyd says Doman Name in use";
$wizard_title = "Floyd the Domain Name Wizard";
$error_title = "Floyd Encountered an Error!";
$exts_list_title = "Floyd supports the following extensions";
$global_title = "Let Floyd do the hard work!";

// the extensions that we are going to be using, edit these for your needs
$whois_exts = array(
    "com",
    "net",
    "org",
    "com.cn",
    "net.cn",
    "org.cn",
    "gov.cn",
    "sh",
    "cc"
);

// some extensions (com/net/org) have a server which contains the name of the server which should be used for  

the information, this simply tells the script to use the whois server as a source for the server info... ;)
$whois_si_servers = array();

// an array of the `whois' servers
$whois_servers = array();

// default whois servers for info
$whois_info_servers = array();

// the backup whois servers to try
$whois_info_servers_backup = array();

// the strings that are returned if the domain is available
$whois_avail_strings = array();

// some substitution strings follow
$errormsg = "";
$titlebar = "MWhois written by Matt Wilson";    // the defatul title bar
$rawoutput = "";
$avail = array();
$unavail = array();
$whois_server = "";

// the name of the script
$script_name = "index.php";

function my_in_array($val,$array_)
{
    for($l=0; $l        if($array_[$l] == $val)
            return 1;

    return 0;
}

// this loads the server info for the extensions in $whois_exts;
function load_server_info()
{
    global $whois_exts;
    global $whois_si_servers;
    global $whois_servers;
    global $whois_info_servers;
    global $whois_info_servers_backup;
    global $whois_avail_strings;

    // load the servers.lst file
    $tlds = file("servers.lst");

    for($l=0; $l        // time leading spaces or trailing spaces
        $tlds[$l] = chop($tlds[$l]);

        // filter out the commented lines (begin with #)
        if(substr($tlds[$l], 0, 1) == "#" || !strlen($tlds[$l])) { continue; }

        // explode via the seperation char `|'
        $es = explode("|", $tlds[$l]);

        // check to see whether we want this TLD
        if(!my_in_array($es[0], $whois_exts)) { continue; }

        // yes we do, so store the details in the appropriate arrays
        $whois_servers[$es[0]] = $es[1];
        $whois_si_servers[$es[0]] = $es[5];
        $whois_info_servers[$es[0]] = $es[3];
        $whois_info_servers_backup[$es[0]] = $es[4];
        $whois_avail_strings[$es[1]] = $es[2];

        // thats it!
    }
}

function choose_info_server($domain, $ext)
{
    global $whois_info_servers;
    global $whois_si_servers;
    global $whois_server;
    global $whois_servers;

    $whois_server = "";

    if($whois_si_servers[$ext]){
        if(($co = fsockopen($whois_servers[$ext], 43)) == false){
            echo "\n";
            $whois_server = $whois_servers[$ext];
        } else {
            echo "\n";
            fputs($co, $domain.".".$ext."\n");
            while(!feof($co))
                $output .= fgets($co,128);

            fclose($co);

            $he = strpos($output, $whois_si_servers[$ext]) + strlen($whois_si_servers[$ext]);
            $le = strpos($output, "\n", $he);
            $whois_server = substr($output, $he, $le-$he);
            echo "\n";
        }
    } else {
        $whois_server = $whois_info_servers[$ext];
    }

    $whois_server = trim($whois_server);
}

// make all the changes
function make_changes($fil)
{
    global $domain;
    global $errormsg;
    global $titlebar;
    global $rawoutput;
    global $avail;
    global $unavail;
    global $ext;
    global $whois_exts;
    global $whois_servers;
    global $script_name;

    $f = implode("",file($fil));

    $f = str_replace("[>WHOIS_SERVER<]",$whois_servers[$ext],$f);
    $f = str_replace("[>TITLE_BAR<]",$titlebar,$f);
    $f = str_replace("[>DOMAIN<]",$domain,$f);
    $f = str_replace("[>ERROR_MSG<]",$errormsg,$f);
    $f = str_replace("[>RAWOUTPUT<]",$rawoutput,$f);

    for($l=0; $l        $sp[1] = substr(strchr($avail[$l],"."),1);
        $sp[0] = substr($avail[$l],0,strlen($avail[$l])-strlen($sp[1])-1);
        $avail_s = $avail_s."
href=\"".$script_name."?domain=".$sp[0]."&ext=".$sp[1]."\">".$avail[$l]."
";
    }

     for($l=0; $l                $sp[1] = substr(strchr($unavail[$l],"."),1);
                $sp[0] = substr($unavail[$l],0,strlen($unavail[$l])-strlen($sp[1])-1);
                $unavail_s = $unavail_s."
href=\"".$script_name."?domain=".$sp[0]."&ext=".$sp[1]."\">".$unavail[$l]."
";
    }

    $f = str_replace("[>AVAIL_LIST<]",$avail_s,$f);
    $f = str_replace("[>UNAVAIL_LIST<]",$unavail_s,$f);
    $f = str_replace("[>script_NAME<]", $script_name, $f);
    $f = str_replace("[>EXT<]",$ext,$f);
    $f = str_replace("[>EXT_LIST<]",implode("
",$whois_exts),$f);
    $f = str_replace("[>EXT_HTML_LIST<]","
name=ext>\n
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/54324.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号