<?php
$adminkey = "admin";
/*-----------------请在上面修改密码---------------- */
session_start();
if(@$_POST['password'] == $adminkey){
$_SESSION['login'] = md5($adminkey);
}
if($_SERVER['QUERY_STRING'] == "logout"){
$_SESSION['login'] = "";
header("location: " . $_SERVER['PHP_SELF']);
exit();
}
$html_login = <<<EOF
<!DOCTYPE html>
<html>
<head>
<title>登录</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
div{text-align:center; margin:0 auto;}
#loginform{width:350px;height:100px;background-color:#F8F8FF;box-shadow: 1px 1px 1px #888888;}
</style>
</head>
<body>
<div id="loginform">
<div style="color:#C5C1AA;height:35px;">登录</div>
<div style="text-align:center; margin:0 auto;"><form action="" method="post"> 独立查看密码 <input type="password" name="password" style="width:120px;"><input type="submit" value="登录"></form></div>
</div>
</body>
</html>
EOF;
/* ----------------以上是登录页代码------------------- */
if(@$_SESSION['login'] != md5($adminkey)){
exit($html_login);
}
/* ----------------以上代码由LYT博客添加的------------------- */
/* ----------------本探针基于YaHei.net探针------------------- */
error_reporting(0); //抑制所有错误信息
@header("content-Type: text/html; charset=utf-8"); //语言强制
ob_start();
$title = "雅黑PHP探针";
$version = "v0.4.2"; //版本号
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 <4; $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--)
{
$strlen = 4-strlen($allsize[$j]);
if($strlen==1)
$allsize[$j] = "<font color='#FFFFFF'>0</font>".$allsize[$j];
elseif($strlen==2)
$allsize[$j] = "<font color='#FFFFFF'>00</font>".$allsize[$j];
elseif($strlen==3)
$allsize[$j] = "<font color='#FFFFFF'>000</font>".$allsize[$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 '<font color="red">×</font>';
break;
case 1:
return '<font color="green">√</font>';
break;
default:
return $result;
break;
}
}
if ($_GET['act'] == "phpinfo")
{
phpinfo();
exit();
}
elseif($_GET['act'] == "Function")
{
$arr = get_defined_functions();
Function php()
{
}
echo "<pre>";
Echo "这里显示系统所支持的所有函数,和自定义函数\n";
print_r($arr);
echo "</pre>";
exit();
}elseif($_GET['act'] == "disable_functions")
{
$disFuns=get_cfg_var("disable_functions");
if(empty($disFuns))
{
$arr = '<font color=red>×</font>';
}
else
{
$arr = $disFuns;
}
Function php()
{
}
echo "<pre>";
Echo "这里显示系统被禁用的函数\n";
print_r($arr);
echo "</pre>";
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!\n\nhttp://lnmp.org")) ? "完成":"失败";
}
// 检测函数支持
function isfun($funName = '')
{
if (!$funName || trim($funName) == '' || preg_match('~[^a-z0-9\_]+~i', $funName, $tmp)) return '错误';
return (false !== function_exists($funName)) ? '<font color="green">√</font>' : '<font color="red">×</font>';
}
function isfun1($funName = '')
{
if (!$funName || trim($funName) == '' || preg_match('~[^a-z0-9\_]+~i', $funName, $tmp)) return '错误';
return (false !== function_exists($funName)) ? '√' : '×';
}
// 根据不同系统取得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("<br />", $res['cpu']['model']);
if (false !== is_array($res['cpu']['mhz'])) $res['cpu']['mhz'] = implode("<br />", $res['cpu']['mhz']);
if (false !== is_array($res['cpu']['cache'])) $res['cpu']['cache'] = implode("<br />", $res['cpu']['cache']);
if (false !== is_array($res['cpu']['bogomips'])) $res['cpu']['bogomips'] = implode("<br />", $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_a
PHP实例开发源码-PHP探针 加密版.zip
版权申诉
51 浏览量
2022-10-15
17:25:19
上传
评论
收藏 12KB ZIP 举报
易小侠
- 粉丝: 6449
- 资源: 9万+