Location: PHPKode > projects > PHPMyServer > server/modules/memory/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_memory {

	var $module;

	function MemoryUsage() {
		$val = array();

		if (function_exists('pmsFuncStatic'))
			$func =& pmsFuncStatic();

		if (isset($func)) {
			if ($func->OSIsWindows()) {
				// windows results here
				if ($memoryInfo = explode("\n", shell_exec(".\\memory\\memory.exe"))) {
					$val['byte_total'] = $memoryInfo[2];
					$val['byte_free'] = $memoryInfo[3];
					$val['byte_used'] = $memoryInfo[2] - $memoryInfo[3];
					$val['mb_total'] = round($memoryInfo[2] / 1048576, 2);
					$val["mb_free"] = round($memoryInfo[3] / 1048576, 2);
					$val["mb_used"] = $val["mb_total"] - $val["mb_free"];
					$val["percent_free"] = round(($val["mb_free"] / $val["mb_total"]) * 100, 2);
					$val["percent_used"] = @round(($val["mb_used"] / $val["mb_total"]) * 100, 2);
				} else
					return false; //No SHELL_EXEC true
			} else
				return false; //No linux
		} else
			return false; //NOT SETTED $FUNC
		return $val;	
	}






	//Constructor
	function pmsmod_memory() {
		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();
		
		if ($mem_data = $this->MemoryUsage()) {
			$this->module['return_data'] = $mem_data;
		}
	}

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

?>
Return current item: PHPMyServer