最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
php针探代码,这款针探可以检测你机器的
时间:2010-07-23 编辑:简简单单 来源:一聚教程网
/*
服务器时间 2010年7月22日 16:24:57 北京时间: 2010年7月22日 16:24:57
服务器域名/ip地址 192.168.0.118 ( 192.168.0.118 )
服务器操作系统 windows 内核版本: jimmy
主机名称 nt
服务器解译引擎 apache/2.2.8 (win32) php/5.2.6
web服务端口 801
服务器语言 zh-cn
服务器管理员 qq@sina.com
本文件路径 d:/www/fk/
目前还有空余空间 diskfreespace 3054.95 m
5
6
8php基本特性
php运行方式 apache2handler
php版本 5.2.6
运行于安全模式 no
支持zend编译运行 yes
允许使用url打开文件 allow_url_fopen yes
允许动态加载链接库 enable_dl yes
显示错误信息 display_errors yes
自动定义全局变量 register_globals no
程序最多允许使用内存量 memory_limit 128m
post最大字节数 post_max_size 1000m
允许最大上传文件 upload_max_filesize 1000m
程序最长运行时间 max_execution_time 9000000 秒
magic_quotes_gpc no
magic_quotes_runtime no
被禁用的函数 disable_functions 无
php信息 phpinfo phpinfo
5
6
8php组件支持
拼写检查 asp教程ell library no 高精度数学运算 bcmath yes
历法运算 calendar yes dba数据库教程 no
dbase数据库 no dbm数据库 no
fdf表单资料格式 no filepro数据库 no
hyperwave数据库 no 图形处理 gd library yes
imap电子邮件系统 no informix数据库 no
ldap目录协议 no mcrypt加密处理 no
哈稀计算 mhash no msql数据库 no
sql server数据库 yes mysql教程数据库 yes
sybase数据库 no yellow page系统 no
oracle数据库 no oracle 8 数据库 no
prel相容语法 pcre yes pdf文档支持 no
postgre sql数据库 no snmp网络管理协议 no
vmailmgr邮件处理 no wddx支持 yes
压缩文件支持(zlib) yes xml解析 yes
ftp yes odbc数据库连接 yes
session支持 yes socket支持 no
浮点型数据显示的有效位数(precision) 14 socket超时时间(default_socket_timeout) 60秒
"...?>"短标签(short_open_tag) yes 指定包含文件目录(include_path) no
忽略重复错误信息(ignore_repeated_errors) no 忽略重复的错误源(ignore_repeated_source) no
报告内存泄漏(report_memleaks) yes 声明argv和argc变量(register_argc_argv) no
历法运算函数库: yes iconv编码转换: yes
mbstring: yes sqlite 数据库:
功能
*/
$runtime= new runtime;
$runtime->start();
class runtime
{
var $starttime = 0;
var $stoptime = 0;
function get_microtime()
{
list($usec, $sec) = explode(' ', microtime());
return ((float)$usec + (float)$sec);
}
function start()
{
$this->starttime = $this->get_microtime();
}
function stop()
{
$this->stoptime = $this->get_microtime();
}
function spent()
{
return round(($this->stoptime - $this->starttime) * 1000, 1);
}
}
header("content-type: text/html; charset=utf-8");
error_reporting(e_error | e_warning | e_parse);
ob_start();
$mysqlreshow = "none";
$mailreshow = "none";
$funreshow = "none";
$opreshow = "none";
$sysreshow = "none";
define("yes", "yes");
define("no", "no");
define("icon", "2 ");
$phps教程elf = $_server[php_self] ? $_server[php_self] : $_server[script_name];
define("phpself", preg_replace("/(.{0,}?/+)/", "", $phpself));
if ($_get['act'] == "phpinfo")
{
phpinfo();
exit();
}
elseif($_post['act'] == "connect")
{
$mysqlreshow = "show";
$mysqlre = "mysql连接测试结果:";
$mysqlre .= (false !== @mysql_connect($_post['mysqlhost'], $_post['mysqluser'], $_post['mysqlpassword']))?"mysql服务器连接正常, ":
"mysql服务器连接失败, ";
$mysqlre .= "数据库 ".$_post['mysqldb']." ";
$mysqlre .= (false != @mysql_select_db($_post['mysqldb']))?"连接正常":
"连接失败";
}
elseif($_post['act'] == "sendmail")
{
$mailreshow = "show";
$mailre = "mail邮件发送测试结果:发送";
$mailre .= (false !== @mail($_post["mailreceiver"], "mail server test", "this is a test email."))?"完成":"失败";
}
elseif($_post['act'] == "function_check")
{
$funreshow = "show";
$funre = "函数 ".$_post['funname']." 支持状况检测结果:".isfun($_post['funname']);
}
elseif($_post['act'] == "configuration_check")
{
$opreshow = "show";
$opre = "配置参数 ".$_post['opname']." 检测结果:".getcon($_post['opname']);
}
// 系统参数
switch (php_os)
{
case "linux":
$sysreshow = (false !== ($sysinfo = sys_linux()))?"show":"none";
break;
default:
break;
}
/*========================================================================*/
?>
/*=============================================================
函数库
=============================================================*/
/*-------------------------------------------------------------------------------------------------------------
检测函数支持
--------------------------------------------------------------------------------------------------------------*/
function isfun($funname)
{
return (false !== function_exists($funname))?yes:no;
}
/*-------------------------------------------------------------------------------------------------------------
检测php设置参数
--------------------------------------------------------------------------------------------------------------*/
function getcon($varname)
{
switch($res = get_cfg_var($varname))
{
case 0:
return no;
break;
case 1:
return yes;
break;
default:
return $res;
break;
}
}
/*-------------------------------------------------------------------------------------------------------------
比例条
--------------------------------------------------------------------------------------------------------------*/
function bar($percent)
{
?>
}
/*-------------------------------------------------------------------------------------------------------------
系统参数探测 linux
--------------------------------------------------------------------------------------------------------------*/
function sys_linux()
{
// cpu
if (false === ($str = @file("/proc/cpuinfo"))) return false;
$str = implode("", $str);
@preg_match_all("/models+names{0,}:+s{0,}([ws)(@.-]+)([ ]+)/s", $str, $model);
@preg_match_all("/cpus+mhzs{0,}:+s{0,}([d.]+)[ ]+/", $str, $mhz);
@preg_match_all("/caches+sizes{0,}:+s{0,}([d.]+s{0,}[a-z]+[ ]+)/", $str, $cache);
if (false !== is_array($model[1]))
{
$res['cpu']['num'] = sizeof($model[1]);
for($i = 0; $i < $res['cpu']['num']; $i++)
{
//$res['cpu']['detail'][] = "类型:".$model[1][$i]." 缓存:".$cache[1][$i];
$res['cpu']['model'][] = $model[1][$i];
$res['cpu']['cache'][] = $cache[1][$i];
}
//if (false !== is_array($res['cpu']['detail'])) $res['cpu']['detail'] = implode("
", $res['cpu']['detail']);
if (false !== is_array($res['cpu']['model'])) $res['cpu']['model'] = implode("
", $res['cpu']['model']);
if (false !== is_array($res['cpu']['cache'])) $res['cpu']['cache'] = implode("
", $res['cpu']['cache']);
}
// 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("/memtotals{0,}:+s{0,}([d.]+).+?memfrees{0,}:+s{0,}([d.]+).+?cacheds{0,}:+s{0,}([d.]+).+?swaptotals{0,}:+s{0,}([d.]+).+?swapfrees{0,}:+s{0,}([d.]+)/s", $str, $buf);
$res['memtotal'] = round($buf[1][0]/1024, 2);
$res['memfree'] = round($buf[2][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['memrealpercent'] = (floatval($res['memtotal'])!=0)?round($res['memrealused']/$res['memtotal']*100,2):0;
$res['swaptotal'] = round($buf[4][0]/1024, 2);
$res['swapfree'] = round($buf[5][0]/1024, 2);
$res['swapused'] = ($res['swaptotal']-$res['swapfree']);
$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;
}
?>
-
下一个: php生成pdf文件代码
相关文章
- PHP导出数据超时的优化建议解读 10-31
- PHP之mysql位运算解析 10-31
- Laravel实现登录跳转功能解析 10-31
- php双向队列解读 10-31
- Laravel异常上下文解决教程 10-24
- php数组查询元素位置方法介绍 10-24