Home Backend Development PHP Tutorial Detailed domain name query program without database PHP version (1)_PHP tutorial

Detailed domain name query program without database PHP version (1)_PHP tutorial

Jul 21, 2016 pm 04:06 PM
echo index.php mw php one domain name database document Inquire Version of program detailed

File 1: index.php


echo " \n";

/*
  ################################## ################################################ ####
     #                                s is collected and compiled into Chinese versions. The Chinese version is owned by the website (http://www.85time.com) #
# This program was launched in 2001 The latest version released on May 18th, this site will continue to modify and improve this program, so please pay attention to this site! #
# This program can query the detailed information of the domain name owner, and now provides 9 types of domain names for query! #
# Demo address: http://www.85time.com/whois                                                         🎜> # Seize the time website provides PHP, ASP, CGI, HTML, JSP and other source programs, electronic textbooks, article information #
# Seize the time website http://www.85time.com Seize the time forum 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;

    [>DOMAIN<] = domain searching for
    [>RAWOUTPUT<] = the raw output of the whois query
    [>WHOIS_SERVER<] = the whois server used
    [>AVAIL_LIST<] = a list of the available domains (in global/wizard search mode)
    [>UNAVAIL_LIST<] = a list of the unavailable domains (in global/wizard search mode)
    [>ERROR_MSG<] = the error message produced
    [>EXT<] = the extension if it is set
    [>EXT_HTML_LIST<] = a list of the extensions supported in a html list
    [>EXT_LIST<] = a list of extensions supported

  parameters to the script (no parameters brings up normal search script);

    show_raw=1    = wherther to show the raw output page
    do_wizard=1    = whether the information being passed is for the wizard
    domain=(string) = do a search for the domain (string)
    list_exts=1    = show the extensions supported page
    do_global=1    = goto the global search page
    do_mini_search=1 = just show the search form without anything else
    company=(string) = used for the wizard, needed in order to search
    keyword1=(string) = used for the wizard, needed in order to search
    keyword2=(string) = used for the wizard, needed in order to search

  If any of this is unclear, see the provided example templates
*/

$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.bkjia.comtruehttp://www.bkjia.com/PHPjc/315524.htmlTechArticle文件一:index.php ?php echo !-- Powered by MWhois written by Matt Wilson matt@mattsscripts.co.uk --\n; /* #####################################################################...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PHP and Python: Comparing Two Popular Programming Languages PHP and Python: Comparing Two Popular Programming Languages Apr 14, 2025 am 12:13 AM

PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

MySQL: Simple Concepts for Easy Learning MySQL: Simple Concepts for Easy Learning Apr 10, 2025 am 09:29 AM

MySQL is an open source relational database management system. 1) Create database and tables: Use the CREATEDATABASE and CREATETABLE commands. 2) Basic operations: INSERT, UPDATE, DELETE and SELECT. 3) Advanced operations: JOIN, subquery and transaction processing. 4) Debugging skills: Check syntax, data type and permissions. 5) Optimization suggestions: Use indexes, avoid SELECT* and use transactions.

PHP: A Key Language for Web Development PHP: A Key Language for Web Development Apr 13, 2025 am 12:08 AM

PHP is a scripting language widely used on the server side, especially suitable for web development. 1.PHP can embed HTML, process HTTP requests and responses, and supports a variety of databases. 2.PHP is used to generate dynamic web content, process form data, access databases, etc., with strong community support and open source resources. 3. PHP is an interpreted language, and the execution process includes lexical analysis, grammatical analysis, compilation and execution. 4.PHP can be combined with MySQL for advanced applications such as user registration systems. 5. When debugging PHP, you can use functions such as error_reporting() and var_dump(). 6. Optimize PHP code to use caching mechanisms, optimize database queries and use built-in functions. 7

What is Cross-Site Request Forgery (CSRF) and how do you implement CSRF protection in PHP? What is Cross-Site Request Forgery (CSRF) and how do you implement CSRF protection in PHP? Apr 07, 2025 am 12:02 AM

In PHP, you can effectively prevent CSRF attacks by using unpredictable tokens. Specific methods include: 1. Generate and embed CSRF tokens in the form; 2. Verify the validity of the token when processing the request.

PHP in Action: Real-World Examples and Applications PHP in Action: Real-World Examples and Applications Apr 14, 2025 am 12:19 AM

PHP is widely used in e-commerce, content management systems and API development. 1) E-commerce: used for shopping cart function and payment processing. 2) Content management system: used for dynamic content generation and user management. 3) API development: used for RESTful API development and API security. Through performance optimization and best practices, the efficiency and maintainability of PHP applications are improved.

PHP vs. Python: Understanding the Differences PHP vs. Python: Understanding the Differences Apr 11, 2025 am 12:15 AM

PHP and Python each have their own advantages, and the choice should be based on project requirements. 1.PHP is suitable for web development, with simple syntax and high execution efficiency. 2. Python is suitable for data science and machine learning, with concise syntax and rich libraries.

PHP's Purpose: Building Dynamic Websites PHP's Purpose: Building Dynamic Websites Apr 15, 2025 am 12:18 AM

PHP is used to build dynamic websites, and its core functions include: 1. Generate dynamic content and generate web pages in real time by connecting with the database; 2. Process user interaction and form submissions, verify inputs and respond to operations; 3. Manage sessions and user authentication to provide a personalized experience; 4. Optimize performance and follow best practices to improve website efficiency and security.

The Future of PHP: Adaptations and Innovations The Future of PHP: Adaptations and Innovations Apr 11, 2025 am 12:01 AM

The future of PHP will be achieved by adapting to new technology trends and introducing innovative features: 1) Adapting to cloud computing, containerization and microservice architectures, supporting Docker and Kubernetes; 2) introducing JIT compilers and enumeration types to improve performance and data processing efficiency; 3) Continuously optimize performance and promote best practices.

See all articles