找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 705|回复: 0
打印 上一主题 下一主题

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

[复制链接]

2588

主题

2588

帖子

7694

积分

论坛元老

Rank: 8Rank: 8

积分
7694
跳转到指定楼层
楼主
发表于 2018-2-14 09:45:29 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

            文件一:index.php
-->\\n\";
/*
    #########################################################################################
    #                                                                                       #
    #  本域名查询系统由mydowns收集整理汉化,汉化归把握时间网站所有(http://www.85time.com)   #
    #  该程序是2001年5月18日发布的最新版本,本站将对此程序继续进行修改完善,敬请关注本站!  #
    #  该程序可以查询域名所有者的详细资料信息,现提供9个类型的域名以供查询!                #
    #  演示地址:http://www.85time.com/whois                                                #
    #  源程序打包下载:http://www.85time.com/mydowns/mydowns.php?id=378                     #
    #  把握时间网站提供PHP、ASP、CGI、HTML、JSP等源程序、电子教材、文章资料                 #
    #  把握时间网站http://www.85time.com  把握时间论坛http://ww.85time.ent                  #
    #  请保留此信息,谢谢!                                                                 #
    #                                                                                       #
    #########################################################################################
    MWhois - a Whois lookup script written in PHP and Perl
    Copyright (C) 2000 Matt Wilson
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/
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 information stuff
  ----------------------------
  The following strings in your templates are replaced with the description;
    [>DOMAINRAWOUTPUTWHOIS_SERVERAVAIL_LISTUNAVAIL_LISTERROR_MSGEXTEXT_HTML_LISTEXT_LIST\\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_SERVERTITLE_BARDOMAINERROR_MSGRAWOUTPUT\".$avail[$l].\"
\";
    }
     for($l=0; $l\".$unavail[$l].\"
\";
    }
    $f = str_replace(\"[>AVAIL_LISTUNAVAIL_LISTSCRIPT_NAMEEXTEXT_LISTEXT_HTML_LIST\\n\".implode(\"\\n\",$whois_exts).\"\\n\",$f);
    return $f;
}
// show the error page
function do_error()
{
    global $use_global_templates;
    global $template_header;
    global $template_footer;
    global $template_error;
    global $domain;
    global $titlebar;
    global $error_title;
    global $errormsg;
    $titlebar = $error_title;
    if($use_global_templates)
        echo make_changes($template_header);
    echo make_changes($template_error);
    if($use_global_templates)
        echo make_changes($template_footer);
    exit();
}
// checks the domain is legal
function check_domain()
{
    global $errormsg;
    global $domain;
    global $ext;
    global $whois_exts;
    if(isset($ext)){
        if(!strlen($ext)){
            $errormsg = \"没有选择域名后缀\";
            return 0;
        }
        if(!my_in_array($ext,$whois_exts)){
            $errormsg = \"不支持此域名后缀\";
            return 0;
        }
    }
    if(isset($domain)){
        if(strlen($domain)  57){
            $errormsg = \"域名太长或太短\";
            return 0;
        }
        if(strlen($domain) == 2 && !ereg(\"([0-9]){2}\",$domain)){
            $errormsg = \"在2个字节的域名中不能包含有字母\";
            return 0;
        }
        if(ereg(\"^-|-$\",$domain)){
            $errormsg = \"域名前和域名后不能使用-,也不可以连续使用-\";
            return 0;
        }
        if(!ereg(\"([a-z]|[A-Z]|[0-9]|-){\".strlen($domain).\"}\",$domain)){
            $errormsg = \"域名只可以包含字母数字组合和-\";
            return 0;
        }
    }
    return 1;
}
// perform_whois function returns 0 if domain is available otherwise returns either the raw info or 1
function perform_whois($domainname,$ext,$raw)
{
    global $errormsg;
    global $whois_servers;
    global $rawoutput;
    global $whois_avail_strings;
    $rawoutput = \"\";
    if($raw)
        return do_raw($domainname,$ext);
    if(($ns = fsockopen($whois_servers[$ext],43)) == false){
        $errormsg = \"无法连接到域名查询服务器 \".$whois_servers[$ext].\"\";
        return -1;
    }
    fputs($ns,\"$domainname.$ext\\n\");
    while(!feof($ns))
        $rawoutput .= fgets($ns,128);
    fclose($ns);
    echo \"\\n\";
    if(!ereg($whois_avail_strings[$whois_servers[$ext]], $rawoutput))
        return 0;
    return 1;
}
// this performs the whois lookup and then shows the data returned
function do_raw($domainname, $ext)
{
    global $titlebar;
    global $template_raw_output;
    global $use_global_templates;
    global $template_header;
    global $template_footer;
    global $raw_output_title;
    global $whois_info_servers;
    global $whois_servers;
    global $rawoutput;
    global $errormsg;
    global $whois_info_servers_backup;
    global $whois_avail_strings;
    global $whois_server;
    choose_info_server($domainname, $ext);
    if(($ns = fsockopen($whois_server,43)) == false){
        if(($ns = fsockopen($whois_info_servers[$ext],43)) == false){
            if(($ns = fsockopen($whois_info_servers_backup[$ext], 43)) == false){
                        return -1;
            } else {
                $whois_server = $whois_info_servers_backup[$ext];
            }
        } else {
            $whois_server = $whois_info_servers[$ext];
        }
    }
    print \"\\n\";
        fputs($ns,\"$domainname.$ext\\n\");
        while(!feof($ns))
                $rawoutput = $rawoutput.fgets($ns,128);
        fclose($ns);
    echo \"\";
//    $pos = @strpos($rawoutput,$whois_avail_strings[$server]);
//    if(is_string($pos) && !$pos){}
//    else{
//    if(!is_string($pos) || $pos){
//        if(($ns = fsockopen($whois_info_servers_backup[$ext],43)) == false)
//            return -1;
//        else{
//            $rawoutput = \"\";
//            fputs($ns,\"$domainname.$ext\\n\");
//            while(!feof($ns))
//                $rawoutput = $rawoutput.fgets($ns,128);
//            $pos = @strpos($rawoutput,$whois_avail_strings[$whois_info_servers_backup[$ext]]);
//            if(!is_string($pos) || $pos){}
//            else
//                return -1;
//        }
//    }
    $titlebar = $raw_output_title;
        if($use_global_templates)
                echo make_changes($template_header);
        echo make_changes($template_raw_output);
        if($use_global_templates)
                echo make_changes($template_footer);
    exit();
}
function do_getsearch_mini()
{
        global $template_search_mini;
        echo make_changes($template_search_mini);
    exit();
}
function do_getsearch()
{
        global $template_footer;
        global $template_header;
        global $use_global_templates;
        global $titlebar;
        global $template_search;
    global $search_title;
        $titlebar = $search_title;
        if($use_global_templates)
                echo make_changes($template_header);
        echo make_changes($template_search);
        if($use_global_templates)
                echo make_changes($template_footer);
        exit();     
}
function do_avail()
{
    global $template_footer;
    global $template_header;
    global $use_global_templates;
    global $titlebar;
    global $template_available;
    global $available_title;
        $titlebar = $available_title;
        if($use_global_templates)
                echo make_changes($template_header);
        echo make_changes($template_available);
        if($use_global_templates)
                echo make_changes($template_footer);
    exit();
}
function do_taken()
{
    global $template_footer;
    global $template_header;
    global $use_global_templates;
    global $template_taken;
    global $titlebar;
    global $taken_title;
        $titlebar = $taken_title;
        if($use_global_templates)
                echo make_changes($template_header);
        echo make_changes($template_taken);
        if($use_global_templates)
                echo make_changes($template_footer);
    exit();
}
function do_exts()
{
        global $template_footer;
        global $template_header;
        global $use_global_templates;
        global $template_exts_list;
        global $titlebar;
        global $exts_list_title;
        $titlebar = $exts_list_title;
        if($use_global_templates)
                echo make_changes($template_header);
        echo make_changes($template_exts_list);
        if($use_global_templates)
                echo make_changes($template_footer);
        exit();
}
function do_glob()
{
    global $domain;
    global $whois_exts;
    global $avail;
    global $unavail;
    global $template_header;
        global $template_footer;
        global $use_global_templates;
        global $titlebar;
        global $global_title;
    $titlebar = $global_title;
    if($use_global_templates)
        echo make_changes($template_header);
    if(!isset($domain)){
            global $template_global;
            echo make_changes($template_global);
    }
    else{
        global $template_global_results;
        for($l=0; $l
            
            
        
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

用户反馈
客户端