那一抹温暖的阳光,是我们永恒的向往。
www.webbar.cn

PHP探针代码 html5

PHP探针代码 html5

前台基于HTML5技术的PHP探针,在支持HTML5的浏览器中查看效果最佳。本PHP探针代码由网络上的PHP探针整理而成,可检测PHP服务器各个 变量信息,比如PHP服务器的操作系统、PHP版本、上传文件的大小限制、当前时间、脚本解释引擎、已编译模块监测、高精度数学运算等,还可检测服务器组 件及数据库支持监测、压缩文件支持、IMAP电子邮件系统函数库等,另外还有一个实用的PHP与MYSQL数据库连接测试模块,HTML5技术的加入,使 得本款探针的界面相当简洁美观。下面是完整的探针代码:

<!doctype html>
<html>
<head>
<meta charset=”utf-8″>
<title>PHP探针</title>
<style type=”text/css” >
* { padding:0px; margin:0px;}
li { list-style-type:none}
a { color:#333;}
body { background:#f2efe8; font-size:12px; color:#666; padding-top:30px; }
.box { background:#FFF; border:1px solid #e1e1e1; -webkit-box-shadow: 0 2px 2px rgba(0, 0, 0, 0.3);-moz-box-shadow:0 2px 2px rgba(0, 0, 0, 0.3));box-shadow: 0 2px 2px rgba(0, 0, 0, 0.3); width:90%; margin:0px auto; border-radius:10px; line-height:30px; padding-bottom:10px; margin-bottom:20px;}
.title { background:#f5f5f5; line-height:40px; padding-left:20px; font-size:14px; color:#333; height:40px; border-bottom:1px solid #e5e5e5; border-radius:10px; border-bottom-right-radius:0px;border-bottom-left-radius:0px; }
ul li { padding:0px 20px; border-bottom:1px solid #e5e5e5; margin:0px 5px; }
span { margin-left:10px;}
.sudu {padding: 0; background:#5dafd1; }
.suduk { margin:0px; padding:0;}
</style>
<?php
error_reporting(0);
phpversion() >= ‘5.1.0’ && date_default_timezone_set(‘UTC’);
@header(“content-Type: text/html; charset=utf-8″);
$stime = date(“Y-n-j H:i:s”);
function check_os() {
$uname=php_uname();
$uname=explode(” “,$uname);
return $uname[0];
}
function check_extension() {
$os=get_loaded_extensions();
for($i=0;$i<count($os);$i++) {
echo $os[$i];
if(($i+1)>=15 and ($i+1)%15==0) { echo ‘<br />'; } else { echo ‘ | ‘; }
}
}
function ini($ini) {
if(preg_match(‘/0|off/i’,$x=ini_get($ini))) {
return ‘OFF';
} elseif($x == null) {
return ‘NONE';
} else {
return $x == 1 ? ‘ON’ : $x;
}
}
function isfun($funName = ”) {
if (!$funName || trim($funName) == ” || preg_match(‘~[^a-z0-9\_]+~i’, $funName,
$tmp))
return ‘错误';
return (false !== function_exists($funName)) ? ‘<b>√</b>’ : ‘<em>×</em>';
}
header(“content-type:text/html;charset=UTF-8″);
if(isset($_GET[page])) {
if($_GET[‘page’]==”date”) {
echo date(“Y-m-d H:i:s”);
} elseif($_GET[‘page’]==”phpinfo”) {
phpinfo();
} elseif($_GET[‘page’]==”cpuinfo”) {
check_cpu();
} elseif($_GET[‘page’]==”meminfo”) {
check_mem();
} elseif($_GET[‘page’]==”diskinfo”){
check_disk();
} elseif($_GET[‘page’]==”uptime”) {
check_uptime();
} elseif($_GET[‘page’]==”download”) {
Header(‘Content-Type:application/octet-stream’);
header(‘accept-length:’.filesize($path));
Header(‘Content-Disposition:attachment;filename=check.php’);
echo file_get_contents(__FILE__);
}
exit();
}
if ($_POST[‘act’] == “开始测试”) {
?>
<script language=”javascript” type=”text/javascript”>
var acd1;
acd1 = new Date();
acd1ok=acd1.getTime();
</script>
<?php
for ($i = 1; $i <= 100000; $i++) {
echo “<!–567890#########0#########0#########0#########0#########0#########0#########0#########012345–>”;
}
?>
<script language=”javascript” type=”text/javascript”>
var acd2;
acd2 = new Date();
acd2ok=acd2.getTime();
window.location = ‘?speed=’ +(acd2ok-acd1ok);
</script>
<?php
}
//网速测试-结束
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 = “<font color=\”red\”> 未探测 </font>”;
}
function check_mysql($host,$user,$pass) {
if(@mysql_connect($host,$user,$pass)) {
return ‘<script type=”text/javascript”>alert(“成功连接到MysqL数据库!”);</script>';
} else {
return ‘<script type=”text/javascript”>alert(“无法连接到MysqL数据库!”);</script>';
}
}
?>
</head>

<body>
<div class=”box”>
<div class=”title”>实用探针v1.0</div>
</div>
<div class=”box”>
<div class=”title”>服务器参数</div>
<ul>
<li>服务器系统:<?php echo check_os(); ?></li>
<li>PHP版本:<?php echo phpversion(); ?><a href=”?page=phpinfo”>PHPINFO</a></li>
<li> 服务器IP:<?php echo @$_SERVER[‘REMOTE_ADDR’];?><span>服务器端口:<?php echo $_SERVER[‘SERVER_PORT’];?></span></li>
<li>服务器解释引擎:<?php echo $_SERVER[‘SERVER_SOFTWARE’];?></li>
<li>服务器当前时间:<?php echo $stime;?></li>
<li> 探针真实地址:<?php echo $_SERVER[‘DOCUMENT_ROOT’]?str_replace(‘\\’,’/’,$_SERVER[‘DOCUMENT_ROOT’]):str_replace(‘\\’,’/’,dirname(__FILE__));?></li>
<li>上传文件的大小限制:<?php echo ini(‘upload_max_filesize’); ?></li>
</ul>
</div>
<div class=”box”>
<form action=”<?php echo $_SERVER[PHP_SELF];?>” method=”post”>
<div class=”title”>网络速度测试<span><input name=”act” type=”submit” class=”btn” value=”开始测试” /></span></div>
<ul>
<li style=”content:”>
<table align=”center” width=”550″ border=”0″ cellspacing=”0″ cellpadding=”0″ >
<tr >
<td height=”15″ width=”50″>带宽</td>
<td height=”15″ width=”50″>1M</td>
<td height=”15″ width=”50″>2M</td>
<td height=”15″ width=”50″>3M</td>
<td height=”15″ width=”50″>4M</td>
<td height=”15″ width=”50″>5M</td>
<td height=”15″ width=”50″>6M</td>
<td height=”15″ width=”50″>7M</td>
<td height=”15″ width=”50″>8M</td>
<td height=”15″ width=”50″>9M</td>
<td height=”15″ width=”50″>10M</td>
</tr>
<tr>
<td colspan=”11″ class=”suduk” ><table align=”center” width=”550″ border=”0″ cellspacing=”0″ cellpadding=”0″ height=”8″ class=”suduk”>
<tr>
<td class=”sudu”  width=”<?php
if(preg_match(“/[^\d-., ]/”,$speed))
{
echo “0”;
}
else{
echo 550*($speed/11000);
}
?>”></td>
<td class=”suduk” width=”<?php
if(preg_match(“/[^\d-., ]/”,$speed))
{
echo “550”;
}
else{
echo 550-550*($speed/11000);
}
?>”></td>
</tr>
</table>
</td>
</tr>
</table>
<?php echo (isset($_GET[‘speed’]))?”下载 1000 KB 数据用时 <b>”.$_GET[‘speed’].”</b> 毫秒,下载速度:<b>”.$speed.” KB/s</b>,需测试多次取平均值,超过10M直接看下载速度”: “<em> 未探测 </em>” ?>
</li>
</ul>
</form>
</div>
<!–测速结束–>
<div class=”box”>
<div class=”title”>已编译模块监测</div>
<ul>
<li><?php echo check_extension(); ?></li>
</ul>
</div>
<!–模块监测结束–>
<div class=”box”>
<div class=”title”>组件及数据库支持监测</div>
<ul>
<li><table width=”100%” cellpadding=”3″ cellspacing=”0″ align=”center”>
<tr>
<td width=”32%”>FTP支持:</td>
<td width=”18%”><?php echo isfun(“ftp_login”);?></td>
<td width=”32%”>XML解析支持:</td>
<td width=”18%”><?php echo isfun(“xml_set_object”);?></td>
</tr>
<tr>
<td>Session支持:</td>
<td><?php echo isfun(“session_start”);?></td>
<td>Socket支持:</td>
<td><?php echo isfun(“socket_accept”);?></td>
</tr>
<tr>
<td>GD库支持:</td>
<td>
<?php
if(function_exists(gd_info)) {
$gd_info = @gd_info();
echo $gd_info[“GD Version”];
}else{echo ‘<em>×</em>';}
?></td>
<td>压缩文件支持(Zlib):</td>
<td><?php echo isfun(“gzclose”);?></td>
</tr>
<tr>
<td>IMAP电子邮件系统函数库:</td>
<td><?php echo isfun(“imap_close”);?></td>
<td>历法运算函数库:</td>
<td><?php echo isfun(“JDToGregorian”);?></td>
</tr>
<tr>
<td>正则表达式函数库:</td>
<td><?php echo isfun(“preg_match”);?></td>
<td>WDDX支持:</td>
<td><?php echo isfun(“wddx_add_vars”);?></td>
</tr>
<tr>
<td>高精度数学运算:</td>
<td><?php echo isfun(“bcadd”);?></td>
<td>LDAP目录协议:</td>
<td><?php echo isfun(“ldap_close”);?></td>
</tr>
<tr>
<td>MCrypt加密处理:</td>
<td><?php echo isfun(“mcrypt_cbc”);?></td>
<td>哈稀计算:</td>
<td><?php echo isfun(“mhash_count”);?></td>
</tr>
<tr>
<td>MCrypt加密处理:</td>
<td><?php echo isfun(“mcrypt_cbc”);?></td>
<td>哈稀计算:</td>
<td><?php echo isfun(“mhash_count”);?></td>
</tr>
</table>
</li>
<li>
<table width=”100%” cellpadding=”3″ cellspacing=”0″ align=”center”>
<tr>
<td width=”32%”>MySQL 数据库:</td>
<td width=”18%”><?php echo isfun(“mysql_close”);?>
<?php
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 ? $s : $c;
}
?>
</td>
<td width=”32%”>ODBC 数据库:</td>
<td width=”18%”><?php echo isfun(“odbc_close”);?></td>
</tr>
<tr>
<td>Oracle 数据库:</td>
<td><?php echo isfun(“ora_close”);?></td>
<td>SQL Server 数据库:</td>
<td><?php echo isfun(“mssql_close”);?></td>
</tr>
<tr>
<td>dBASE 数据库:</td>
<td><?php echo isfun(“dbase_close”);?></td>
<td>mSQL 数据库:</td>
<td><?php echo isfun(“msql_close”);?></td>
</tr>
<tr>
<td>SQLite 数据库:</td>
<td><?php echo isfun(“sqlite_close”); if(isfun(“sqlite_close”) == ‘<b>√</b>’){echo ”  版本: “.@sqlite_libversion();}?></td>
<td>Hyperwave 数据库:</td>
<td><?php echo isfun(“hw_close”);?></td>
</tr>
</table>
</li>
</ul>
</div>
<!–组件支持–>
<div class=”box”>
<div class=”title”>数据库连接测试</div>
<ul>
<li><?php if(function_exists(‘mysql_connect’)) { ?>
<form action=”<?php echo $_SERVER[‘PHP_SELF’]; ?>” method=”post”>
<p>主机:<span><input type=”text” name=”host” value=”127.0.0.1:3306″ /></span></p>
<p>用户:<span><input type=”text” name=”user” /></span></p>
<p>密码:<span><input type=”password” name=”pass” /></span></p>
<p><input type=”submit” value=”检测MYSQL” /><?php if(isset($_POST[‘host’]) and isset($_POST[‘user’]) and isset($_POST[‘pass’])) { echo ‘<span style=”background-color:#663399″>’.check_mysql($_POST[‘host’],$_POST[‘user’],$_POST[‘pass’]).'</span>'; } ?></p>
</form>
<?php } else { echo ‘<span style=”color:#60def0″>未找到Mysql扩展!</span>'; } ?></li>
</ul>
</div>
</body>
</html>

PHP探针代码 html5 PHP探针代码 html5

您可直接保存成phpinfo.php文件,在PHP环境下测试运行。

时间:2014-07-21
分类:PHP , 编程语言

Comments are closed.

Search