php 显示探针_雅黑php 探针

雅黑php探针

位置:放于网站根目录下

功能:

下载:http://www.yahei.net/tz/tz.zip

代码:

/* ---------------------------------------------------- */

/* 程序名称: PHP探针-Yahei

/* 程序功能: 探测系统的Web服务器运行环境

/* 程序开发: Yahei.Net

/* 联系方式: info@Yahei.net

/* Date: 1970-01-01 / 2012-07-08

/* ---------------------------------------------------- */

/* 使用条款:

/* 1.该软件免费使用.

/* 2.禁止任何衍生版本.

/* ---------------------------------------------------- */

/* 感谢以下朋友为探针做出的贡献:

/* zyypp,酷を龙卷风,龙智超,菊花肿了,闲人,Clare Lou,hotsnow

/* 二戒,yexinzhu,wangyu1314,Kokgog,gibyasus,黃子珅,A大,huli

/* 小松,charwin,华景网络

/* 您可能是下一个?

/* ---------------------------------------------------- */

error_reporting(0); //抑制所有错误信息

@header("content-Type: text/html; charset=utf-8"); //语言强制

ob_start();

date_default_timezone_set('Asia/Shanghai');//此句用于消除时间差

$title = '雅黑PHP探针[简体版]';

$version = "v0.4.7"; //版本号

define('HTTP_HOST', preg_replace('~^www\.~i', '', $_SERVER['HTTP_HOST']));

$time_start = microtime_float();

function memory_usage()

{

$memory = ( ! function_exists('memory_get_usage')) ? '0' : round(memory_get_usage()/1024/1024, 2).'MB';

return $memory;

}

// 计时

function microtime_float()

{

$mtime = microtime();

$mtime = explode(' ', $mtime);

return $mtime[1] + $mtime[0];

}

//单位转换

function formatsize($size)

{

$danwei=array(' B ',' K ',' M ',' G ',' T ');

$allsize=array();

$i=0;

for($i = 0; $i <5; $i++)

{

if(floor($size/pow(1024,$i))==0){break;}

}

for($l = $i-1; $l >=0; $l--)

{

$allsize1[$l]=floor($size/pow(1024,$l));

$allsize[$l]=$allsize1[$l]-$allsize1[$l+1]*1024;

}

$len=count($allsize);

for($j = $len-1; $j >=0; $j--)

{

$fsize=$fsize.$allsize[$j].$danwei[$j];

}

return $fsize;

}

function valid_email($str)

{

return ( ! preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $str)) ? FALSE : TRUE;

}

//检测PHP设置参数

function show($varName)

{

switch($result = get_cfg_var($varName))

{

case 0:

return '×';

break;

case 1:

return '';

break;

default:

return $result;

break;

}

}

//保留服务器性能测试结果

$valInt = isset($_POST['pInt']) ? $_POST['pInt'] : "未测试";

$valFloat = isset($_POST['pFloat']) ? $_POST['pFloat'] : "未测试";

$valIo = isset($_POST['pIo']) ? $_POST['pIo'] : "未测试";

if ($_GET['act'] == "phpinfo")

{

phpinfo();

exit();

}

elseif($_POST['act'] == "整型测试")

{

$valInt = test_int();

}

elseif($_POST['act'] == "浮点测试")

{

$valFloat = test_float();

}

elseif($_POST['act'] == "IO测试")

{

$valIo = test_io();

}

//网速测试-开始

elseif($_POST['act']=="开始测试")

{

?>

var acd1;

acd1 = new Date();

acd1ok=acd1.getTime();

for($i=1;$i<=100000;$i++)

{

echo "";

}

?>

var acd2;

acd2 = new Date();

acd2ok=acd2.getTime();

window.location = '?speed=' +(acd2ok-acd1ok)+'#w_networkspeed';

}

//网速测试-结束

elseif($_GET['act'] == "Function")

{

$arr = get_defined_functions();

Function php()

{

}

echo "

";

Echo "这里显示系统所支持的所有函数,和自定义函数\n";

print_r($arr);

echo "

";

exit();

}elseif($_GET['act'] == "disable_functions")

{

$disFuns=get_cfg_var("disable_functions");

if(empty($disFuns))

{

$arr = '×';

}

else

{

$arr = $disFuns;

}

Function php()

{

}

echo "

";

Echo "这里显示系统被禁用的函数\n";

print_r($arr);

echo "

";

exit();

}

//MySQL检测

if ($_POST['act'] == 'MySQL检测')

{

$host = isset($_POST['host']) ? trim($_POST['host']) : '';

$port = isset($_POST['port']) ? (int) $_POST['port'] : '';

$login = isset($_POST['login']) ? trim($_POST['login']) : '';

$password = isset($_POST['password']) ? trim($_POST['password']) : '';

$host = preg_match('~[^a-z0-9\-\.]+~i', $host) ? '' : $host;

$port = intval($port) ? intval($port) : '';

$login = preg_match('~[^a-z0-9\_\-]+~i', $login) ? '' : htmlspecialchars($login);

$password = is_string($password) ? htmlspecialchars($password) : '';

}

elseif ($_POST['act'] == '函数检测')

{

$funRe = "函数".$_POST['funName']."支持状况检测结果:".isfun1($_POST['funName']);

}

elseif ($_POST['act'] == '邮件检测')

{

$mailRe = "邮件发送检测结果:发送";

if($_SERVER['SERVER_PORT']==80){$mailContent = "http://".$_SERVER['SERVER_NAME'].($_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME']);}

else{$mailContent = "http://".$_SERVER['SERVER_NAME'].":".$_SERVER['SERVER_PORT'].($_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME']);}

$mailRe .= (false !== @mail($_POST["mailAdd"], $mailContent, "This is a test mail!")) ? "完成":"失败";

}

//网络速度测试

if(isset($_POST['speed']))

{

$speed=round(100/($_POST['speed']/1000),2);

}

elseif($_GET['speed']=="0")

{

$speed=6666.67;

}

elseif(isset($_GET['speed']) and $_GET['speed']>0)

{

$speed=round(100/($_GET['speed']/1000),2); //下载速度:$speed kb/s

}

else

{

$speed=" 未探测 ";

}

// 检测函数支持

function isfun($funName = '')

{

if (!$funName || trim($funName) == '' || preg_match('~[^a-z0-9\_]+~i', $funName, $tmp)) return '错误';

return (false !== function_exists($funName)) ? '' : '×';

}

function isfun1($funName = '')

{

if (!$funName || trim($funName) == '' || preg_match('~[^a-z0-9\_]+~i', $funName, $tmp)) return '错误';

return (false !== function_exists($funName)) ? '√' : '×';

}

//整数运算能力测试

function test_int()

{

$timeStart = gettimeofday();

for($i = 0; $i < 3000000; $i++)

{

$t = 1+1;

}

$timeEnd = gettimeofday();

$time = ($timeEnd["usec"]-$timeStart["usec"])/1000000+$timeEnd["sec"]-$timeStart["sec"];

$time = round($time, 3)."秒";

return $time;

}

//浮点运算能力测试

function test_float()

{

//得到圆周率值

$t = pi();

$timeStart = gettimeofday();

for($i = 0; $i < 3000000; $i++)

{

//开平方

sqrt($t);

}

$timeEnd = gettimeofday();

$time = ($timeEnd["usec"]-$timeStart["usec"])/1000000+$timeEnd["sec"]-$timeStart["sec"];

$time = round($time, 3)."秒";

return $time;

}

//IO能力测试

function test_io()

{

$fp = @fopen(PHPSELF, "r");

$timeStart = gettimeofday();

for($i = 0; $i < 10000; $i++)

{

@fread($fp, 10240);

@rewind($fp);

}

$timeEnd = gettimeofday();

@fclose($fp);

$time = ($timeEnd["usec"]-$timeStart["usec"])/1000000+$timeEnd["sec"]-$timeStart["sec"];

$time = round($time, 3)."秒";

return($time);

}

function GetCoreInformation() {$data = file('/proc/stat');$cores = array();foreach( $data as $line ) {if( preg_match('/^cpu[0-9]/', $line) ){$info = explode(' ', $line);$cores[]=array('user'=>$info[1],'nice'=>$info[2],'sys' => $info[3],'idle'=>$info[4],'iowait'=>$info[5],'irq' => $info[6],'softirq' => $info[7]);}}return $cores;}

function GetCpuPercentages($stat1, $stat2) {if(count($stat1)!==count($stat2)){return;}$cpus=array();for( $i = 0, $l = count($stat1); $i < $l; $i++) { $dif = array(); $dif['user'] = $stat2[$i]['user'] - $stat1[$i]['user'];$dif['nice'] = $stat2[$i]['nice'] - $stat1[$i]['nice']; $dif['sys'] = $stat2[$i]['sys'] - $stat1[$i]['sys'];$dif['idle'] = $stat2[$i]['idle'] - $stat1[$i]['idle'];$dif['iowait'] = $stat2[$i]['iowait'] - $stat1[$i]['iowait'];$dif['irq'] = $stat2[$i]['irq'] - $stat1[$i]['irq'];$dif['softirq'] = $stat2[$i]['softirq'] - $stat1[$i]['softirq'];$total = array_sum($dif);$cpu = array();foreach($dif as $x=>$y) $cpu[$x] = round($y / $total * 100, 2);$cpus['cpu' . $i] = $cpu;}return $cpus;}

$stat1 = GetCoreInformation();sleep(1);$stat2 = GetCoreInformation();$data = GetCpuPercentages($stat1, $stat2);

$cpu_show = $data['cpu0']['user']."%us, ".$data['cpu0']['sys']."%sy, ".$data['cpu0']['nice']."%ni, ".$data['cpu0']['idle']."%id, ".$data['cpu0']['iowait']."%wa, ".$data['cpu0']['irq']."%irq, ".$data['cpu0']['softirq']."%softirq";

function makeImageUrl($title, $data) {$api='http://api.yahei.net/tz/cpu_show.php?id=';$url.=$data['user'].',';$url.=$data['nice'].',';$url.=$data['sys'].',';$url.=$data['idle'].',';$url.=$data['iowait'];$url.='&chdl=User|Nice|Sys|Idle|Iowait&chdlp=b&chl=';$url.=$data['user'].'%25|';$url.=$data['nice'].'%25|';$url.=$data['sys'].'%25|';$url.=$data['idle'].'%25|';$url.=$data['iowait'].'%25';$url.='&chtt=Core+'.$title;return $api.base64_encode($url);}

if($_GET['act'] == "cpu_percentage"){echo "

图片加载慢,请耐心等待!
";foreach( $data as $k => $v ) {echo ' ';}echo "
";exit();}

// 根据不同系统取得CPU相关信息

switch(PHP_OS)

{

case "Linux":

$sysReShow = (false !== ($sysInfo = sys_linux()))?"show":"none";

break;

case "FreeBSD":

$sysReShow = (false !== ($sysInfo = sys_freebsd()))?"show":"none";

break;

/*

case "WINNT":

$sysReShow = (false !== ($sysInfo = sys_windows()))?"show":"none";

break;

*/

default:

break;

}

//linux系统探测

function sys_linux()

{

// CPU

if (false === ($str = @file("/proc/cpuinfo"))) return false;

$str = implode("", $str);

@preg_match_all("/model\s+name\s{0,}\:+\s{0,}([\w\s\)\(\@.-]+)([\r\n]+)/s", $str, $model);

@preg_match_all("/cpu\s+MHz\s{0,}\:+\s{0,}([\d\.]+)[\r\n]+/", $str, $mhz);

@preg_match_all("/cache\s+size\s{0,}\:+\s{0,}([\d\.]+\s{0,}[A-Z]+[\r\n]+)/", $str, $cache);

@preg_match_all("/bogomips\s{0,}\:+\s{0,}([\d\.]+)[\r\n]+/", $str, $bogomips);

if (false !== is_array($model[1]))

{

$res['cpu']['num'] = sizeof($model[1]);

/*

for($i = 0; $i < $res['cpu']['num']; $i++)

{

$res['cpu']['model'][] = $model[1][$i].' ('.$mhz[1][$i].')';

$res['cpu']['mhz'][] = $mhz[1][$i];

$res['cpu']['cache'][] = $cache[1][$i];

$res['cpu']['bogomips'][] = $bogomips[1][$i];

}*/

if($res['cpu']['num']==1)

$x1 = '';

else

$x1 = ' ×'.$res['cpu']['num'];

$mhz[1][0] = ' | 频率:'.$mhz[1][0];

$cache[1][0] = ' | 二级缓存:'.$cache[1][0];

$bogomips[1][0] = ' | Bogomips:'.$bogomips[1][0];

$res['cpu']['model'][] = $model[1][0].$mhz[1][0].$cache[1][0].$bogomips[1][0].$x1;

if (false !== is_array($res['cpu']['model'])) $res['cpu']['model'] = implode("
", $res['cpu']['model']);

if (false !== is_array($res['cpu']['mhz'])) $res['cpu']['mhz'] = implode("
", $res['cpu']['mhz']);

if (false !== is_array($res['cpu']['cache'])) $res['cpu']['cache'] = implode("
", $res['cpu']['cache']);

if (false !== is_array($res['cpu']['bogomips'])) $res['cpu']['bogomips'] = implode("
", $res['cpu']['bogomips']);

}

// NETWORK

// UPTIME

if (false === ($str = @file("/proc/uptime"))) return false;

$str = explode(" ", implode("", $str));

$str = trim($str[0]);

$min = $str / 60;

$hours = $min / 60;

$days = floor($hours / 24);

$hours = floor($hours - ($days * 24));

$min = floor($min - ($days * 60 * 24) - ($hours * 60));

if ($days !== 0) $res['uptime'] = $days."天";

if ($hours !== 0) $res['uptime'] .= $hours."小时";

$res['uptime'] .= $min."分钟";

// MEMORY

if (false === ($str = @file("/proc/meminfo"))) return false;

$str = implode("", $str);

preg_match_all("/MemTotal\s{0,}\:+\s{0,}([\d\.]+).+?MemFree\s{0,}\:+\s{0,}([\d\.]+).+?Cached\s{0,}\:+\s{0,}([\d\.]+).+?SwapTotal\s{0,}\:+\s{0,}([\d\.]+).+?SwapFree\s{0,}\:+\s{0,}([\d\.]+)/s", $str, $buf);

preg_match_all("/Buffers\s{0,}\:+\s{0,}([\d\.]+)/s", $str, $buffers);

$res['memTotal'] = round($buf[1][0]/1024, 2);

$res['memFree'] = round($buf[2][0]/1024, 2);

$res['memBuffers'] = round($buffers[1][0]/1024, 2);

$res['memCached'] = round($buf[3][0]/1024, 2);

$res['memUsed'] = $res['memTotal']-$res['memFree'];

$res['memPercent'] = (floatval($res['memTotal'])!=0)?round($res['memUsed']/$res['memTotal']*100,2):0;

$res['memRealUsed'] = $res['memTotal'] - $res['memFree'] - $res['memCached'] - $res['memBuffers']; //真实内存使用

$res['memRealFree'] = $res['memTotal'] - $res['memRealUsed']; //真实空闲

$res['memRealPercent'] = (floatval($res['memTotal'])!=0)?round($res['memRealUsed']/$res['memTotal']*100,2):0; //真实内存使用率

$res['memCachedPercent'] = (floatval($res['memCached'])!=0)?round($res['memCached']/$res['memTotal']*100,2):0; //Cached内存使用率

$res['swapTotal'] = round($buf[4][0]/1024, 2);

$res['swapFree'] = round($buf[5][0]/1024, 2);

$res['swapUsed'] = round($res['swapTotal']-$res['swapFree'], 2);

$res['swapPercent'] = (floatval($res['swapTotal'])!=0)?round($res['swapUsed']/$res['swapTotal']*100,2):0;

// LOAD AVG

if (false === ($str = @file("/proc/loadavg"))) return false;

$str = explode(" ", implode("", $str));

$str = array_chunk($str, 4);

$res['loadAvg'] = implode(" ", $str[0]);

return $res;

}

//FreeBSD系统探测

function sys_freebsd()

{

//CPU

if (false === ($res['cpu']['num'] = get_key("hw.ncpu"))) return false;

$res['cpu']['model'] = get_key("hw.model");

//LOAD AVG

if (false === ($res['loadAvg'] = get_key("vm.loadavg"))) return false;

//UPTIME

if (false === ($buf = get_key("kern.boottime"))) return false;

$buf = explode(' ', $buf);

$sys_ticks = time() - intval($buf[3]);

$min = $sys_ticks / 60;

$hours = $min / 60;

$days = floor($hours / 24);

$hours = floor($hours - ($days * 24));

$min = floor($min - ($days * 60 * 24) - ($hours * 60));

if ($days !== 0) $res['uptime'] = $days."天";

if ($hours !== 0) $res['uptime'] .= $hours."小时";

$res['uptime'] .= $min."分钟";

//MEMORY

if (false === ($buf = get_key("hw.physmem"))) return false;

$res['memTotal'] = round($buf/1024/1024, 2);

$str = get_key("vm.vmtotal");

preg_match_all("/\nVirtual Memory[\:\s]*\(Total[\:\s]*([\d]+)K[\,\s]*Active[\:\s]*([\d]+)K\)\n/i", $str, $buff, PREG_SET_ORDER);

preg_match_all("/\nReal Memory[\:\s]*\(Total[\:\s]*([\d]+)K[\,\s]*Active[\:\s]*([\d]+)K\)\n/i", $str, $buf, PREG_SET_ORDER);

$res['memRealUsed'] = round($buf[0][2]/1024, 2);

$res['memCached'] = round($buff[0][2]/1024, 2);

$res['memUsed'] = round($buf[0][1]/1024, 2) + $res['memCached'];

$res['memFree'] = $res['memTotal'] - $res['memUsed'];

$res['memPercent'] = (floatval($res['memTotal'])!=0)?round($res['memUsed']/$res['memTotal']*100,2):0;

$res['memRealPercent'] = (floatval($res['memTotal'])!=0)?round($res['memRealUsed']/$res['memTotal']*100,2):0;

return $res;

}

//取得参数值 FreeBSD

function get_key($keyName)

{

return do_command('sysctl', "-n $keyName");

}

//确定执行文件位置 FreeBSD

function find_command($commandName)

{

$path = array('/bin', '/sbin', '/usr/bin', '/usr/sbin', '/usr/local/bin', '/usr/local/sbin');

foreach($path as $p)

{

if (@is_executable("$p/$commandName")) return "$p/$commandName";

}

return false;

}

//执行系统命令 FreeBSD

function do_command($commandName, $args)

{

$buffer = "";

if (false === ($command = find_command($commandName))) return false;

if ($fp = @popen("$command $args", 'r'))

{

while (!@feof($fp))

{

$buffer .= @fgets($fp, 4096);

}

return trim($buffer);

}

return false;

}

//windows系统探测

function sys_windows()

{

if (PHP_VERSION >= 5)

{

$objLocator = new COM("WbemScripting.SWbemLocator");

$wmi = $objLocator->ConnectServer();

$prop = $wmi->get("Win32_PnPEntity");

}

else

{

return false;

}

//CPU

$cpuinfo = GetWMI($wmi,"Win32_Processor", array("Name","L2CacheSize","NumberOfCores"));

$res['cpu']['num'] = $cpuinfo[0]['NumberOfCores'];

if (null == $res['cpu']['num'])

{

$res['cpu']['num'] = 1;

}/*

for ($i=0;$i

{

$res['cpu']['model'] .= $cpuinfo[0]['Name']."
";

$res['cpu']['cache'] .= $cpuinfo[0]['L2CacheSize']."
";

}*/

$cpuinfo[0]['L2CacheSize'] = ' ('.$cpuinfo[0]['L2CacheSize'].')';

if($res['cpu']['num']==1)

$x1 = '';

else

$x1 = ' ×'.$res['cpu']['num'];

$res['cpu']['model'] = $cpuinfo[0]['Name'].$cpuinfo[0]['L2CacheSize'].$x1;

// SYSINFO

$sysinfo = GetWMI($wmi,"Win32_OperatingSystem", array('LastBootUpTime','TotalVisibleMemorySize','FreePhysicalMemory','Caption','CSDVersion','SerialNumber','InstallDate'));

$sysinfo[0]['Caption']=iconv('GBK', 'UTF-8',$sysinfo[0]['Caption']);

$sysinfo[0]['CSDVersion']=iconv('GBK', 'UTF-8',$sysinfo[0]['CSDVersion']);

$res['win_n'] = $sysinfo[0]['Caption']." ".$sysinfo[0]['CSDVersion']." 序列号:{$sysinfo[0]['SerialNumber']} 于".date('Y年m月d日H:i:s',strtotime(substr($sysinfo[0]['InstallDate'],0,14)))."安装";

//UPTIME

$res['uptime'] = $sysinfo[0]['LastBootUpTime'];

$sys_ticks = 3600*8 + time() - strtotime(substr($res['uptime'],0,14));

$min = $sys_ticks / 60;

$hours = $min / 60;

$days = floor($hours / 24);

$hours = floor($hours - ($days * 24));

$min = floor($min - ($days * 60 * 24) - ($hours * 60));

if ($days !== 0) $res['uptime'] = $days."天";

if ($hours !== 0) $res['uptime'] .= $hours."小时";

$res['uptime'] .= $min."分钟";

//MEMORY

$res['memTotal'] = round($sysinfo[0]['TotalVisibleMemorySize']/1024,2);

$res['memFree'] = round($sysinfo[0]['FreePhysicalMemory']/1024,2);

$res['memUsed'] = $res['memTotal']-$res['memFree']; //上面两行已经除以1024,这行不用再除了

$res['memPercent'] = round($res['memUsed'] / $res['memTotal']*100,2);

$swapinfo = GetWMI($wmi,"Win32_PageFileUsage", array('AllocatedBaseSize','CurrentUsage'));

// LoadPercentage

$loadinfo = GetWMI($wmi,"Win32_Processor", array("LoadPercentage"));

$res['loadAvg'] = $loadinfo[0]['LoadPercentage'];

return $res;

}

function GetWMI($wmi,$strClass, $strValue = array())

{

$arrData = array();

$objWEBM = $wmi->Get($strClass);

$arrProp = $objWEBM->Properties_;

$arrWEBMCol = $objWEBM->Instances_();

foreach($arrWEBMCol as $objItem)

{

@reset($arrProp);

$arrInstance = array();

foreach($arrProp as $propItem)

{

eval("\$value = \$objItem->" . $propItem->Name . ";");

if (empty($strValue))

{

$arrInstance[$propItem->Name] = trim($value);

}

else

{

if (in_array($propItem->Name, $strValue))

{

$arrInstance[$propItem->Name] = trim($value);

}

}

}

$arrData[] = $arrInstance;

}

return $arrData;

}

//比例条

function bar($percent)

{

?>

}

$uptime = $sysInfo['uptime']; //在线时间

$stime = date('Y-m-d H:i:s'); //系统当前时间

//硬盘

$dt = round(@disk_total_space(".")/(1024*1024*1024),3); //总

$df = round(@disk_free_space(".")/(1024*1024*1024),3); //可用

$du = $dt-$df; //已用

$hdPercent = (floatval($dt)!=0)?round($du/$dt*100,2):0;

$load = $sysInfo['loadAvg']; //系统负载

//判断内存如果小于1G,就显示M,否则显示G单位

if($sysInfo['memTotal']<1024)

{

$memTotal = $sysInfo['memTotal']." M";

$mt = $sysInfo['memTotal']." M";

$mu = $sysInfo['memUsed']." M";

$mf = $sysInfo['memFree']." M";

$mc = $sysInfo['memCached']." M"; //cache化内存

$mb = $sysInfo['memBuffers']." M"; //缓冲

$st = $sysInfo['swapTotal']." M";

$su = $sysInfo['swapUsed']." M";

$sf = $sysInfo['swapFree']." M";

$swapPercent = $sysInfo['swapPercent'];

$memRealUsed = $sysInfo['memRealUsed']." M"; //真实内存使用

$memRealFree = $sysInfo['memRealFree']." M"; //真实内存空闲

$memRealPercent = $sysInfo['memRealPercent']; //真实内存使用比率

$memPercent = $sysInfo['memPercent']; //内存总使用率

$memCachedPercent = $sysInfo['memCachedPercent']; //cache内存使用率

}

else

{

$memTotal = round($sysInfo['memTotal']/1024,3)." G";

$mt = round($sysInfo['memTotal']/1024,3)." G";

$mu = round($sysInfo['memUsed']/1024,3)." G";

$mf = round($sysInfo['memFree']/1024,3)." G";

$mc = round($sysInfo['memCached']/1024,3)." G";

$mb = round($sysInfo['memBuffers']/1024,3)." G";

$st = round($sysInfo['swapTotal']/1024,3)." G";

$su = round($sysInfo['swapUsed']/1024,3)." G";

$sf = round($sysInfo['swapFree']/1024,3)." G";

$swapPercent = $sysInfo['swapPercent'];

$memRealUsed = round($sysInfo['memRealUsed']/1024,3)." G"; //真实内存使用

$memRealFree = round($sysInfo['memRealFree']/1024,3)." G"; //真实内存空闲

$memRealPercent = $sysInfo['memRealPercent']; //真实内存使用比率

$memPercent = $sysInfo['memPercent']; //内存总使用率

$memCachedPercent = $sysInfo['memCachedPercent']; //cache内存使用率

}

//网卡流量

$strs = @file("/proc/net/dev");

for ($i = 2; $i < count($strs); $i++ )

{

preg_match_all( "/([^\s]+):[\s]{0,}(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)/", $strs[$i], $info );

$NetOutSpeed[$i] = $info[10][0];

$NetInputSpeed[$i] = $info[2][0];

$NetInput[$i] = formatsize($info[2][0]);

$NetOut[$i] = formatsize($info[10][0]);

}

//ajax调用实时刷新

if ($_GET['act'] == "rt")

{

$arr=array('useSpace'=>"$du",'freeSpace'=>"$df",'hdPercent'=>"$hdPercent",'barhdPercent'=>"$hdPercent%",'TotalMemory'=>"$mt",'UsedMemory'=>"$mu",'FreeMemory'=>"$mf",'CachedMemory'=>"$mc",'Buffers'=>"$mb",'TotalSwap'=>"$st",'swapUsed'=>"$su",'swapFree'=>"$sf",'loadAvg'=>"$load",'uptime'=>"$uptime",'freetime'=>"$freetime",'bjtime'=>"$bjtime",'stime'=>"$stime",'memRealPercent'=>"$memRealPercent",'memRealUsed'=>"$memRealUsed",'memRealFree'=>"$memRealFree",'memPercent'=>"$memPercent%",'memCachedPercent'=>"$memCachedPercent",'barmemCachedPercent'=>"$memCachedPercent%",'swapPercent'=>"$swapPercent",'barmemRealPercent'=>"$memRealPercent%",'barswapPercent'=>"$swapPercent%",'NetOut2'=>"$NetOut[2]",'NetOut3'=>"$NetOut[3]",'NetOut4'=>"$NetOut[4]",'NetOut5'=>"$NetOut[5]",'NetOut6'=>"$NetOut[6]",'NetOut7'=>"$NetOut[7]",'NetOut8'=>"$NetOut[8]",'NetOut9'=>"$NetOut[9]",'NetOut10'=>"$NetOut[10]",'NetInput2'=>"$NetInput[2]",'NetInput3'=>"$NetInput[3]",'NetInput4'=>"$NetInput[4]",'NetInput5'=>"$NetInput[5]",'NetInput6'=>"$NetInput[6]",'NetInput7'=>"$NetInput[7]",'NetInput8'=>"$NetInput[8]",'NetInput9'=>"$NetInput[9]",'NetInput10'=>"$NetInput[10]",'NetOutSpeed2'=>"$NetOutSpeed[2]",'NetOutSpeed3'=>"$NetOutSpeed[3]",'NetOutSpeed4'=>"$NetOutSpeed[4]",'NetOutSpeed5'=>"$NetOutSpeed[5]",'NetInputSpeed2'=>"$NetInputSpeed[2]",'NetInputSpeed3'=>"$NetInputSpeed[3]",'NetInputSpeed4'=>"$NetInputSpeed[4]",'NetInputSpeed5'=>"$NetInputSpeed[5]");

$jarr=json_encode($arr);

$_GET['callback'] = htmlspecialchars($_GET['callback']);

echo $_GET['callback'],'(',$jarr,')';

exit;

}

?>

<?php echo $title.$version; ?>

PHP参数组件支持第三方组件数据库支持性能检测网速检测MySQL检测函数检测邮件检测探针下载
服务器参数
服务器域名/IP地址<?php echo @get_current_user();?> - <?php echo $_SERVER['SERVER_NAME'];?>(<?php if('/'==DIRECTORY_SEPARATOR){echo $_SERVER['SERVER_ADDR'];}else{echo @gethostbyname($_SERVER['SERVER_NAME']);} ?>)  你的IP地址是:<?php echo @$_SERVER['REMOTE_ADDR'];?>
服务器标识<?php if($sysInfo['win_n'] != ''){echo $sysInfo['win_n'];}else{echo @php_uname();};?>
服务器操作系统<?php $os = explode(" ", php_uname()); echo $os[0];?>  内核版本:<?php if('/'==DIRECTORY_SEPARATOR){echo $os[2];}else{echo $os[1];} ?>服务器解译引擎<?php echo $_SERVER['SERVER_SOFTWARE'];?>
服务器语言<?php echo getenv("HTTP_ACCEPT_LANGUAGE");?>服务器端口<?php echo $_SERVER['SERVER_PORT'];?>
服务器主机名<?php if('/'==DIRECTORY_SEPARATOR ){echo $os[1];}else{echo $os[2];} ?>绝对路径<?php echo $_SERVER['DOCUMENT_ROOT']?str_replace('\\','/',$_SERVER['DOCUMENT_ROOT']):str_replace('\\','/',dirname(__FILE__));?>
管理员邮箱<?php echo $_SERVER['SERVER_ADMIN'];?>探针路径<?php echo str_replace('\\','/',__FILE__)?str_replace('\\','/',__FILE__):$_SERVER['SCRIPT_FILENAME'];?>
服务器实时数据
服务器当前时间<?php echo $stime;?>服务器已运行时间<?php echo $uptime;?>
CPU型号 [<?php echo $sysInfo['cpu']['num'];?>核]<?php echo $sysInfo['cpu']['model'];?>
CPU使用状况<?php if('/'==DIRECTORY_SEPARATOR){echo $cpu_show." | 查看图表";}else{echo "暂时只支持Linux系统";}?>
硬盘使用状况

总空间 <?php echo $dt;?> G,

已用 <?php echo $du;?> G,

空闲 <?php echo $df;?> G,

使用率 <?php echo $hdPercent;?>%

内存使用状况

$tmp = array(

'memTotal', 'memUsed', 'memFree', 'memPercent',

'memCached', 'memRealPercent',

'swapTotal', 'swapUsed', 'swapFree', 'swapPercent'

);

foreach ($tmp AS $v) {

$sysInfo[$v] = $sysInfo[$v] ? $sysInfo[$v] : 0;

}

?>

物理内存:共

, 已用

, 空闲

, 使用率

//判断如果cache为0,不显示

if($sysInfo['memCached']>0)

{

?>

Cache化内存为 <?php echo $mc;?>

, 使用率

% | Buffers缓冲为 <?php echo $mb;?>

真实内存使用

, 真实内存空闲

, 使用率

%

}

//判断如果SWAP区为0,不显示

if($sysInfo['swapTotal']>0)

{

?>

SWAP区:共

, 已使用

, 空闲

, 使用率

%

}

?>

系统平均负载<?php echo $load;?>

}?>

网络使用状况
<?php echo $info[1][0]?> : 入网: <?php echo $NetInput[$i]?>实时: 0B/s出网: <?php echo $NetOut[$i]?>实时: 0B/s
PHP已编译模块检测

$able=get_loaded_extensions();

foreach ($able as $key=>$value) {

if ($key!=0 && $key%13==0) {

echo '
';

}

echo "$value  ";

}

?>

PHP相关参数
PHP信息(phpinfo):

$phpSelf = $_SERVER[PHP_SELF] ? $_SERVER[PHP_SELF] : $_SERVER[SCRIPT_NAME];

$disFuns=get_cfg_var("disable_functions");

?>

<?php echo (false!==eregi("phpinfo",$disFuns))? '×' :"PHPINFO";?>

PHP版本(php_version):<?php echo PHP_VERSION;?>
PHP运行方式:<?php echo strtoupper(php_sapi_name());?>脚本占用最大内存(memory_limit):<?php echo show("memory_limit");?>
PHP安全模式(safe_mode):<?php echo show("safe_mode");?>POST方法提交最大限制(post_max_size):<?php echo show("post_max_size");?>
上传文件最大限制(upload_max_filesize):<?php echo show("upload_max_filesize");?>浮点型数据显示的有效位数(precision):<?php echo show("precision");?>
脚本超时时间(max_execution_time):<?php echo show("max_execution_time");?>秒socket超时时间(default_socket_timeout):<?php echo show("default_socket_timeout");?>秒
PHP页面根目录(doc_root):<?php echo show("doc_root");?>用户根目录(user_dir):<?php echo show("user_dir");?>
dl()函数(enable_dl):<?php echo show("enable_dl");?>指定包含文件目录(include_path):<?php echo show("include_path");?>
显示错误信息(display_errors):<?php echo show("display_errors");?>自定义全局变量(register_globals):<?php echo show("register_globals");?>
数据反斜杠转义(magic_quotes_gpc):<?php echo show("magic_quotes_gpc");?>"<?...?>"短标签(short_open_tag):<?php echo show("short_open_tag");?>
"<% %>"ASP风格标记(asp_tags):<?php echo show("asp_tags");?>忽略重复错误信息(ignore_repeated_errors):<?php echo show("ignore_repeated_errors");?>
忽略重复的错误源(ignore_repeated_source):<?php echo show("ignore_repeated_source");?>报告内存泄漏(report_memleaks):<?php echo show("report_memleaks");?>
自动字符串转义(magic_quotes_gpc):<?php echo show("magic_quotes_gpc");?>外部字符串自动转义(magic_quotes_runtime):<?php echo show("magic_quotes_runtime");?>
打开远程文件(allow_url_fopen):<?php echo show("allow_url_fopen");?>声明argv和argc变量(register_argc_argv):<?php echo show("register_argc_argv");?>
Cookie 支持:<?php echo isset($_COOKIE)?'√' : '×';?>拼写检查(ASpell Library):<?php echo isfun("aspell_check_raw");?>
高精度数学运算(BCMath):<?php echo isfun("bcadd");?>PREL相容语法(PCRE):<?php echo isfun("preg_match");?>
PDF文档支持:<?php echo isfun("pdf_close");?>SNMP网络管理协议:<?php echo isfun("snmpget");?>
VMailMgr邮件处理:<?php echo isfun("vm_adduser");?>Curl支持:<?php echo isfun("curl_init");?>
SMTP支持:<?php echo get_cfg_var("SMTP")?'√' : '×';?>SMTP地址:<?php echo get_cfg_var("SMTP")?get_cfg_var("SMTP"):'×';?>
默认支持函数(enable_functions):请点这里查看详细!
被禁用的函数(disable_functions):

$disFuns=get_cfg_var("disable_functions");

if(empty($disFuns))

{

echo '×';

}

else

{

//echo $disFuns;

$disFuns_array = explode(',',$disFuns);

foreach ($disFuns_array as $key=>$value)

{

if ($key!=0 && $key%5==0) {

echo '
';

}

echo "$value  ";

}

}

?>

组件支持
FTP支持:<?php echo isfun("ftp_login");?>XML解析支持:<?php echo isfun("xml_set_object");?>
Session支持:<?php echo isfun("session_start");?>Socket支持:<?php echo isfun("socket_accept");?>
Calendar支持<?php echo isfun('cal_days_in_month');?>允许URL打开文件:<?php echo show("allow_url_fopen");?>
GD库支持:

if(function_exists(gd_info)) {

$gd_info = @gd_info();

echo $gd_info["GD Version"];

}else{echo '×';}

?>

压缩文件支持(Zlib):<?php echo isfun("gzclose");?>
IMAP电子邮件系统函数库:<?php echo isfun("imap_close");?>历法运算函数库:<?php echo isfun("JDToGregorian");?>
正则表达式函数库:<?php echo isfun("preg_match");?>WDDX支持:<?php echo isfun("wddx_add_vars");?>
Iconv编码转换:<?php echo isfun("iconv");?>mbstring:<?php echo isfun("mb_eregi");?>
高精度数学运算:<?php echo isfun("bcadd");?>LDAP目录协议:<?php echo isfun("ldap_close");?>
MCrypt加密处理:<?php echo isfun("mcrypt_cbc");?>哈稀计算:<?php echo isfun("mhash_count");?>

第三方组件
Zend版本<?php $zend_version = zend_version();if(empty($zend_version)){echo '×';}else{echo $zend_version;}?>

$PHP_VERSION = PHP_VERSION;

$PHP_VERSION = substr($PHP_VERSION,2,1);

if($PHP_VERSION > 2)

{

echo "ZendGuardLoader[启用]";

}

else

{

echo "Zend Optimizer";

}

?>

<?php if($PHP_VERSION > 2){echo (get_cfg_var("zend_loader.enable"))?'':'×';} else{if(function_exists('zend_optimizer_version')){ echo zend_optimizer_version();}else{ echo (get_cfg_var("zend_optimizer.optimization_level")||get_cfg_var("zend_extension_manager.optimizer_ts")||get_cfg_var("zend.ze1_compatibility_mode")||get_cfg_var("zend_extension_ts"))?'':'×';}}?>
eAccelerator<?php if((phpversion('eAccelerator'))!=''){echo phpversion('eAccelerator');}else{ echo "×";} ?>ioncube<?php if(extension_loaded('ionCube Loader')){ $ys = ioncube_loader_iversion(); $gm = ".".(int)substr($ys,3,2); echo ionCube_Loader_version().$gm;}else{echo "×";}?>
XCache<?php if((phpversion('XCache'))!=''){echo phpversion('XCache');}else{ echo "×";} ?>APC<?php if((phpversion('APC'))!=''){echo phpversion('APC');}else{ echo "×";} ?>

数据库支持
MySQL 数据库:<?php echo isfun("mysql_close");?>

if(function_exists("mysql_get_server_info")) {

$s = @mysql_get_server_info();

$s = $s ? '  mysql_server 版本:'.$s : '';

$c = '  mysql_client 版本:'.@mysql_get_client_info();

echo $s;

}

?>

ODBC 数据库:<?php echo isfun("odbc_close");?>
Oracle 数据库:<?php echo isfun("ora_close");?>SQL Server 数据库:<?php echo isfun("mssql_close");?>
dBASE 数据库:<?php echo isfun("dbase_close");?>mSQL 数据库:<?php echo isfun("msql_close");?>
SQLite 数据库:<?php if(extension_loaded('sqlite3')) {$sqliteVer = SQLite3::version();echo '√ ';echo "SQLite3 Ver ";echo $sqliteVer[versionString];}else {echo isfun("sqlite_close");if(isfun("sqlite_close") == '') {echo "  版本: ".@sqlite_libversion();}}?>Hyperwave 数据库:<?php echo isfun("hw_close");?>
Postgre SQL 数据库:<?php echo isfun("pg_close"); ?>Informix 数据库:<?php echo isfun("ifx_close");?>
DBA 数据库:<?php echo isfun("dba_close");?>DBM 数据库:<?php echo isfun("dbmclose");?>
FilePro 数据库:<?php echo isfun("filepro_fieldcount");?>SyBase 数据库:<?php echo isfun("sybase_close");?>

" method="post">
服务器性能检测
参照对象整数运算能力检测
(1+1运算300万次)
浮点运算能力检测
(圆周率开平方300万次)
数据I/O能力检测
(读取10K文件1万次)
CPU信息
美国 LinodeVPS0.357秒0.802秒0.023秒4 x Xeon L5520 @ 2.27GHz
美国 PhotonVPS.com0.431秒1.024秒0.034秒8 x Xeon E5520 @ 2.27GHz
德国 SpaceRich.com0.421秒1.003秒0.038秒4 x Core i7 920 @ 2.67GHz
美国 RiZie.com0.521秒1.559秒0.054秒2 x Pentium4 3.00GHz
埃及 CitynetHost.com0.343秒0.761秒0.023秒2 x Core2Duo E4600 @ 2.40GHz
美国 IXwebhosting.com0.535秒1.607秒0.058秒4 x Xeon E5530 @ 2.40GHz
本台服务器<?php echo $valInt;?><?php echo $valFloat;?><?php echo $valIo;?>

网络速度测试

向客户端传送1000k字节数据

带宽比例按理想值计算

带宽1M2M3M4M5M6M7M8M9M10M

{

echo "0";

}

else{

echo 550*($speed/11000);

}

?>">

{

echo "550";

}

else{

echo 550-550*($speed/11000);

}

?>">

<?php echo (isset($_GET['speed']))?"下载1000KB数据用时 ".$_GET['speed']." 毫秒,下载速度:"."".$speed.""." kb/s,需测试多次取平均值,超过10M直接看下载速度":" 未探测 " ?>

MySQL数据库连接检测

地址:

端口:

用户名:

密码:

if ($_POST['act'] == 'MySQL检测') {

if(function_exists("mysql_close")==1) {

$link = @mysql_connect($host.":".$port,$login,$password);

if ($link){

echo "";

} else {

echo "";

}

} else {

echo "";

}

}

?>

函数检测

请输入您要检测的函数:

if ($_POST['act'] == '函数检测') {

echo "";

}

?>

邮件发送检测

请输入您要检测的邮件地址:

if ($_POST['act'] == '邮件检测') {

echo "";

}

?>

<?php echo $title.$version;?><?php $run_time = sprintf('%0.4f', microtime_float() - $time_start);?>Processed in <?php echo $run_time?> seconds. <?php echo memory_usage();?> memory usage.返回顶部
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值