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

📄 index.php

📁 主要是提供域名查询功能的主程序 PHP源代码
💻 PHP
📖 第 1 页 / 共 2 页
字号:
<?php
// --------------------------------------------
// | EP-Dev Whois        
// |                                           
// | 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.
// --------------------------------------------


// set error reporting level
error_reporting(E_ALL ^ E_NOTICE);


// +------------------------------
//	initialize administration panel and navigate
// +------------------------------
$adminPanel = new EP_Dev_Whois_Admin();
$adminPanel->navigate($_REQUEST['page']);


/* ------------------------------------------------------------------ */
//	Administration Panel Class
//  Contains / Operates all of the functions of the admin panel through
//	its own functions or other included classes.
/* ------------------------------------------------------------------ */

class EP_Dev_Whois_Admin
{
	// internal version
	var $internal_version = "2.1";

	// configs
	var $CORE;
	var $TEMPLATE;

	// error handle
	var $ERROR;

	// panel display
	var $DISPLAY;

	// variable format
	var $FORMAT;

	// user login / logout functions
	var $USER;

	function EP_Dev_Whois_Admin()
	{
		// We will be using sessions
		session_start();

		// +------------------------------
		//	Remove effects of magic_quotes
		// +------------------------------
		if (get_magic_quotes_gpc())
		{
			$_POST = array_map(array(&$this, 'stripslashes_deep'), $_POST);
			$_GET = array_map(array(&$this, 'stripslashes_deep'), $_GET);
			$_COOKIE = array_map(array(&$this, 'stripslashes_deep'), $_COOKIE);
		}


		// Load config file
		require_once("../config/config.php");

		// initialize configuration
		$this->CONFIG = new EP_Dev_Whois_Config();


		// +------------------------------
		//	Load up common required files
		// +------------------------------
		require_once("../config/template.php");
		require_once("display.php");
		require_once("fileio.php");
		require_once("file_format.php");


		// +------------------------------
		//	Initialize variables
		// +------------------------------
		$template_temp = new EP_Dev_Whois_Templates();
		$this->TEMPLATE = $template_temp;

		$this->ERROR = new EP_Dev_Whois_Admin_Error_Handle();
		$this->DISPLAY = new EP_Dev_Whois_Admin_Display("EP-Dev Whois Administration Panel");
		$this->FORMAT = new EP_Dev_Whois_Admin_Variable_Format($this->ERROR);
		$this->USER = new EP_Dev_Whois_Admin_UserControl($this->CONFIG->ADMIN['username'], $this->CONFIG->ADMIN['password']);


		// +------------------------------
		//	Check if this panel is enabled
		// +------------------------------
		if (!$this->CONFIG->ADMIN['enabled'])
		{
			// error if we are disabled
			$this->ERROR->stop("panel_disabled");
		}


		// +------------------------------
		//	Ensure that files are writable
		// +------------------------------ 
		if (!is_writable("../config/config.php")
			|| !is_writable("../config/template.php")
			|| !is_writable("../whois.php")
			|| !is_writable("../logs/"))
		{
			$this->DISPLAY->MENU->blank();
			$message = $this->DISPLAY->constructOutput("It has been detected that not all of the files that need to be writable are writable.<br><br>
			Please ensure the following files are chmod 0666 (read & write all):<br>
			whois/whois.php<br>
			whois/config/config.php<br>
			whois/config/template.php<br><br>
			In addition, the logs folder needs to be chmod 0777 (read/write/execute all):<br>
			whois/logs/<br><br>
			NOTE: You can usually chmod files by right clicking on the file in your ftp program and selecting \"Change file permissions\" or \"CHMOD\".<br><br>
			Once you have changed these files to be writable, please refresh this page.
			");

			$this->page_Message("ERROR: NOT ALL REQUIRED FILES WRITABLE", $message);
			die();
		}


		// +------------------------------
		//	Check if in process of upgrading and load upgrader if so.
		// +------------------------------
		if ($this->CONFIG->SCRIPT['version'] != $this->internal_version)
		{
			require_once("upgrade/upgradeCore.php");
			$UPGRADER = new UpgradeCore($this);
			$UPGRADER->navigate($this->CONFIG->SCRIPT['version'], $this->internal_version);
			die();
		}
	}



	/* ------------------------------------------------------------------ */
	//	Strip slashes from $value
	//	Equivilent to stripslashes(), but it operates recursively
	/* ------------------------------------------------------------------ */
	
	function stripslashes_deep($value)
	{
       $value = is_array($value) ?
                   array_map(array(&$this, 'stripslashes_deep'), $value) :
                   stripslashes($value);

       return $value;
	}



	/* ------------------------------------------------------------------ */
	//	Navigate to $page
	//  Calls, based on $page, the correct page method.
	/* ------------------------------------------------------------------ */
	
	function navigate($page = null)
	{
		// +------------------------------
		//	Call method based on $page
		// +------------------------------
		switch($page)
		{
			// +------------------------------
			//	Non-restricted (Public) Pages
			// +------------------------------

			case "FAQ" :
				if (!$this->USER->check())
					$this->DISPLAY->MENU->blank();
				$this->page_FAQ();
			break;

			case "goLogin" :
				$this->USER->login($_POST['username'], $_POST['password']);
				$this->navigate();
			break;

			default: 
				
				// +------------------------------
				//	User Authentication
				// +------------------------------
				if(!$this->USER->check()) // if not valid user
				{
					// show login page
					$this->DISPLAY->MENU->blank();

					if ($this->USER->defaultConfig())
						$this->page_Login($this->CONFIG->ADMIN['username'], $this->CONFIG->ADMIN['password']);
					else
						$this->page_Login();
				}


				// +------------------------------
				//	Restricted (Requires authentication) Pages
				// +------------------------------

				else
				{
					// +------------------------------
					//	Auto Check for update (if enabled)
					// +------------------------------
					if ($this->CONFIG->ADMIN['update_check'] && !$this->USER->getValue("checked_for_update"))
					{
						$update_info = $this->CheckUpdate();
						if ($update_info['version_available'])
						{
							$this->USER->setValue("checked_for_update", true);

							$this->page_CheckForUpdate();

							break;
						}
					}


					// +------------------------------
					//	Force Username & Password Change if still default
					// +------------------------------
					if ($this->USER->defaultConfig() && $page != "goModifyConfig")
						$page = "AdminSettings";


					/* A fancy (or sloppy, depending on how you look at it)
					embedded switch statement */

⌨️ 快捷键说明

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