⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 whois.php

📁 主要是提供域名查询功能的主程序 PHP源代码
💻 PHP
字号:
<?php
// --------------------------------------------
// | The EP-Dev Whois script      
// |                                           
// | Copyright (c) 2003-2005 Patrick Brown as EP-Dev.com           
// | 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.
// --------------------------------------------

// !! DO NOT EDIT THIS FILE !!

// +------------------------------
//	initialize script and navigate
// +------------------------------
$EP_Dev_Whois = new EP_Dev_Whois();
$EP_Dev_Whois->navigate($_REQUEST['page']);


/* ------------------------------------------------------------------ */
//	EP-Dev Whois Main Class
//	Main class of the script. Initializes and controls all aspects of
//	the whois script, including initiailizing core, etc.
//	Date: 3/29/2005
/* ------------------------------------------------------------------ */

class EP_Dev_Whois
{
	var $CORE;
	var $absolute_path;

	
	/* ------------------------------------------------------------------ */
	//	Constructor
	/* ------------------------------------------------------------------ */
	
	function EP_Dev_Whois()
	{
		// set error reporting level
		error_reporting(E_ALL ^ E_NOTICE);

		// absolute path
		$this->absolute_path = "";

		// detect and (if necessary) set absolute path
		if ($this->absolute_path == "")
			$this->absolute_path = dirname(__FILE__) . "/";

		// try include and error if bad abs path
		$include_success = @include_once($this->absolute_path . "global.php");
		if ($include_success === false)
		{
			die("<div style=\"font-weight: bold; color: red;\">Error Loading EP-Dev Whois Script: The specified absolute path is incorrect.</div>");
		}

		// initialize core
		$this->CORE = new EP_Dev_Whois_Global($this->absolute_path);
	}


	/* ------------------------------------------------------------------ */
	//	navigate to $page
	//	Calls on methods corresponding to $page
	/* ------------------------------------------------------------------ */
	
	function navigate($page)
	{
		switch ($page)
		{
			case "WhoisReport" :
				$domain = $_REQUEST['domain'];
				$ext = $_REQUEST['ext'];

				// ensure extension exists
				if (empty($ext))
					$this->CORE->ERROR->stop("no_extension");

				// validate domain
				$this->CORE->DOMAINS->validateDomain($domain, $ext);

				// show report
				$this->page_WhoisReport($domain, $ext);
			break;

			case "WhoisSearch" :
				$base_extensions = array();

				// search for all extensions
				foreach(array_keys($_REQUEST) as $current_key)
				{
					if (ereg("^ext[0-9]+$", $current_key))
						$base_extensions[] = $_REQUEST[$current_key];
				}

				$domains = explode("\n", str_replace("\r\n", "\n", $_REQUEST['domain']));

				if ($this->CORE->CONFIG->BUYMODE['CONFIG']['enable'])
				{
					foreach($domains as $domain)
					{
						$extensions = $base_extensions;

						// validate domain
						$this->CORE->DOMAINS->validateDomain($domain, $extensions);

						// send to search method
						if (!empty($whoisQueries))
							$whoisQueries = array_merge($this->go_WhoisSearch($domain, $extensions, ($_REQUEST['skip_additional'] == "1")), $whoisQueries);
						else
							$whoisQueries = $this->go_WhoisSearch($domain, $extensions, ($_REQUEST['skip_additional'] == "1"));
					}

					// display results
					$this->page_Results($whoisQueries);
				}
				else
				{
					// ensure extension exists
					if (empty($extensions[0]))
						$this->CORE->ERROR->stop("no_extension");

					// validate domain
					$this->CORE->DOMAINS->validateDomain($domains[0], $extensions[0]);

					// show whois report
					$this->page_WhoisReport($domains[0], $extensions[0]);
				}
			break;

			case "MultipleWhoisSearch" :
				$this->page_MultipleWhoisSearch();
			break;


			default: $this->page_Front();
		}
	}


	/* ------------------------------------------------------------------ */
	//	Whois Search
	//	Performs whois search on $domain with $form_extensions while
	//	incorporating additional script features.
	//	RETURN: array of whois query objects
	/* ------------------------------------------------------------------ */
	
	function go_WhoisSearch($domain, $form_extensions, $skip_autosearch = false)
	{
		// +------------------------------
		//	Log Search Parameters in session
		// +------------------------------
		$this->CORE->USER->setValue("domain", $domain);
		$this->CORE->USER->setValue("extension", $form_extensions[0]);
		$this->CORE->USER->setValue("extensions", $form_extensions);

		if (!$skip_autosearch)
		{
			// append auto-search extensions, remove duplicates
			$extensions = array_unique(array_merge($form_extensions, $this->CORE->DOMAINS->getAutoSearchExtensions()));
		}
		else
		{
			$extensions = $form_extensions;
		}

		// ensure extension exists
		if (empty($extensions))
			$this->CORE->ERROR->stop("no_extension");

		// detect log type & process logs accordingly
		if (!$this->CORE->CONFIG->SCRIPT['LOGS']['all'] && !empty($form_extensions))
			$this->CORE->LOG->update($domain, $form_extensions);
		else
			$this->CORE->LOG->update($domain, $extensions);

		// extension count
		$i=0;
		foreach($extensions as $current_ext)
		{
			// only process if extension not blank
			if (!empty($current_ext))
			{
				// perform whois lookup
				$whois_queries[$i] = $this->CORE->whoisRequest($domain, $current_ext);
				$whois_queries[$i]->lookup();
				$i++;
			}
		}

		return $whois_queries;
	}


	/* ------------------------------------------------------------------ */
	//	Front page
	//	Displays front page
	/* ------------------------------------------------------------------ */
	
	function page_Front()
	{
		// display main page
		$this->CORE->DISPLAY->constructPage("main", "", "");
		$this->CORE->DISPLAY->displayPage();
	}


	/* ------------------------------------------------------------------ */
	//	Multiple Whois Search Page
	//	Displays multiple TLD check page
	/* ------------------------------------------------------------------ */
	
	function page_MultipleWhoisSearch()
	{
		// display main page
		$this->CORE->DISPLAY->constructPage("multiple_tlds", "", "");
		$this->CORE->DISPLAY->displayPage();
	}


	/* ------------------------------------------------------------------ */
	//	Whois Report Page
	//	Calls & Displays whois report for $domain and $ext
	/* ------------------------------------------------------------------ */
	
	function page_WhoisReport($domain, $ext)
	{
		// +------------------------------
		//	Log Search Parameters in session
		// +------------------------------
		$this->CORE->USER->setValue("domain", $domain);
		$this->CORE->USER->setValue("extension", $ext);
		$this->CORE->USER->setValue("extensions", array($ext));

		// Log query
		$this->CORE->LOG->update($domain, $ext);
		
		// +------------------------------
		//	Generate & Display page
		// +------------------------------
		// load page template
		$this->CORE->DISPLAY->constructPage("report", "", "Whois Report");

		// generate whois request
		$whois_query = $this->CORE->whoisRequest($domain, $ext);

		// perform full whois lookup
		$whois_query->lookup(true);

		// parse for whoisreport
		$this->CORE->DISPLAY->customParse("whoisreport", $whois_query->getWhoisReport());

		// display page
		$this->CORE->DISPLAY->displayPage();
	}


	/* ------------------------------------------------------------------ */
	//	Results Page
	//	Organizes array of query objects ($whois_queries) according to
	//	results page template and displays result page
	/* ------------------------------------------------------------------ */
	
	function page_Results($whois_queries)
	{
		// load page template
		$this->CORE->DISPLAY->constructPage("results", "", "Domain Name Search Results");

		$available_array = array();
		$unavailable_array = array();

		// cycle through queries
		foreach($whois_queries as $current_query)
		{
			// detect if query resulted in available and sort accordingly
			if ($current_query->isAvailable())
				$available_array[] = $current_query;
			else
				$unavailable_array[] = $current_query;
		}

		// parse for available/unavailable extensions
		$this->CORE->DISPLAY->parseAvailableDomains($available_array);
		$this->CORE->DISPLAY->parseUnavailableDomains($unavailable_array);

		// display page
		$this->CORE->DISPLAY->displayPage();
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -