Location: PHPKode > projects > PHPMyServer > server/modules/network/index.php4.php
<?PHP
//
// PHPMyServer - A PHP System Information Script - Old project name was PHPMyStats
// http://www.phpmyserver.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.
//
// 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.
//
// $Id: index.php/index.php4.php/index.php5.php/etc ,v 2.6 13-08-2005 16:30 precision Exp $
//
// Date in $Id is as DD-MM-YY

//PHPMyServer - XML Server v2.6
//Build version:
//  split version at the DOT, before the DOT is the CORE version, AFTER the DOT is de RELEASE
//Every new release will get an higher number, so when i released version 2 of the script for the 126523st time, its version v2.126523

//Copyright 2004-2005 by KingOfDos Intra/Extra/Internet WebServices
//http://www.phpmyserver.com
//http://www.kingofdos.com
//http://www.kingofdos.com

class pmsmod_network {

	var $module;

	//Constructor
	function pmsmod_network() {
		if (function_exists('pmsFuncStatic'))
			$this->func=& pmsFuncStatic();

		$this->module = array();

		//Compatible versions of PHPMyServer for this module
		$this->module['compatible_version'] = array(
			'03d21b594c8a1b5831a7101c10df7b83',
		'02f1051414bda3eb39439ce2c998abca'
		);

		

	
		//Information
		include 'info_data.php';
		$this->module['information'] = $val;
		$this->module['return_data'] = array();
		
		
		//XML Server - IP / Name of this connection (external)
		if (isset($_SERVER['SERVER_NAME']))
			$t_ext_server_name = $_SERVER['SERVER_NAME'];
		elseif (isset($_SERVER['HTTP_HOST']))
			$t_ext_server_name = $_SERVER['HTTP_HOST'];
		
		if (isset($t_ext_server_name)) {
			$this->module['return_data']['xml_server_name'] = $t_ext_server_name; //XML Server 
			
			//Try to get the ip from the hostname
			if ($t_ext_server_ip = gethostbyname($t_ext_server_name) AND preg_match("/\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]\.\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]\.\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]\.\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]/x",$t_ext_server_ip))
				$this->module['return_data']['xml_server_name2ip'] = $t_ext_server_ip; //XML Server
			else
				$this->module['return_data']['xml_server_name2ip'] = 'Unknown (xml_ext_name2ip)';
		} else {
			$this->module['return_data']['xml_server_name'] = 'Unknown (xml_ext_noservername)';
			$this->module['return_data']['xml_server_name2ip'] = 'Unknown (xml_ext_noservername)';
		}
		
		
		//XML Server - IP / Name of this connection (internal)
		if (isset($_ENV['SERVER_ADDR']))
			$t_int_server_addr = $_ENV['SERVER_ADDR'];
		elseif (isset($_SERVER['SERVER_ADDR']))
			$t_int_server_addr = $_SERVER['SERVER_ADDR'];
			
		if (isset($t_int_server_addr)) {
			$this->module['return_data']['xml_server_ip'] = $t_int_server_addr; //XML Server
			
			if (preg_match("/\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]\.\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]\.\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]\.\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]/x",$t_int_server_addr) AND $t_int_server_name = gethostbyaddr($t_int_server_addr))
				$this->module['return_data']['xml_server_ip2name'] = $t_int_server_name; //XML Server
			else
				$this->module['return_data']['xml_server_ip2name'] = 'Unknown (xml_int_ip2name)';
		} else {
			$this->module['return_data']['xml_server_ip'] = 'Unknown (xml_int_noaddr)';
			$this->module['return_data']['xml_server_ip2name'] = 'Unknown (xml_int_noaddr)';
		}
		
		
		//More stuff
		$this->module['return_data']['xml_connection_protocol'] = $_SERVER["SERVER_PROTOCOL"];
		$this->module['return_data']['xml_connection_port'] = $_SERVER["SERVER_PORT"];
		$this->module['return_data']['xml_connection_portremote'] = $_SERVER["REMOTE_PORT"];
		$this->module['return_data']['this_server_ip'] = $_SERVER['REMOTE_ADDR'];
		$this->module['return_data']['this_server_ip2name'] = gethostbyaddr($_SERVER['REMOTE_ADDR']);
		//$this->module['return_data']['this_server_name'] = gethostbyaddr($_SERVER['REMOTE_ADDR']);
		//$this->module['return_data']['this_server_name2ip'] = gethostbyaddr($_SERVER['REMOTE_ADDR']);
	}

	//Returner
	function pmsmod_return() {
		return $this->module;
	}
}

?>
Return current item: PHPMyServer