• LNAMP 中的PHP探针


       1 <?php
       2 /* ----------------本探针基于YaHei.net探针------------------- */
       3 error_reporting(0); //抑制所有错误信息
       4 @header("content-Type: text/html; charset=utf-8"); //语言强制
       5 ob_start();
       6 
       7 $title = "雅黑PHP探针";
       8 $version = "v0.4.2"; //版本号
       9 
      10 define('HTTP_HOST', preg_replace('~^www.~i', '', $_SERVER['HTTP_HOST']));
      11 
      12 $time_start = microtime_float();
      13 
      14 function memory_usage() 
      15 {
      16     $memory     = ( ! function_exists('memory_get_usage')) ? '0' : round(memory_get_usage()/1024/1024, 2).'MB';
      17     return $memory;
      18 }
      19 
      20 // 计时
      21 function microtime_float() 
      22 {
      23     $mtime = microtime();
      24     $mtime = explode(' ', $mtime);
      25     return $mtime[1] + $mtime[0];
      26 }
      27 
      28 //单位转换
      29 function formatsize($size) 
      30 {
      31     $danwei=array(' B ',' K ',' M ',' G ',' T ');
      32     $allsize=array();
      33     $i=0;
      34 
      35     for($i = 0; $i <4; $i++) 
      36     {
      37         if(floor($size/pow(1024,$i))==0){break;}
      38     }
      39 
      40     for($l = $i-1; $l >=0; $l--) 
      41     {
      42         $allsize1[$l]=floor($size/pow(1024,$l));
      43         $allsize[$l]=$allsize1[$l]-$allsize1[$l+1]*1024;
      44     }
      45 
      46     $len=count($allsize);
      47 
      48     for($j = $len-1; $j >=0; $j--) 
      49     {
      50         $strlen = 4-strlen($allsize[$j]);
      51         if($strlen==1)
      52             $allsize[$j] = "<font color='#FFFFFF'>0</font>".$allsize[$j];
      53         elseif($strlen==2)
      54             $allsize[$j] = "<font color='#FFFFFF'>00</font>".$allsize[$j];
      55         elseif($strlen==3)
      56             $allsize[$j] = "<font color='#FFFFFF'>000</font>".$allsize[$j];
      57 
      58         $fsize=$fsize.$allsize[$j].$danwei[$j];
      59     }    
      60     return $fsize;
      61 }
      62 
      63 function valid_email($str) 
      64 {
      65     return ( ! preg_match("/^([a-z0-9+_-]+)(.[a-z0-9+_-]+)*@([a-z0-9-]+.)+[a-z]{2,6}$/ix", $str)) ? FALSE : TRUE;
      66 }
      67 
      68 //检测PHP设置参数
      69 function show($varName)
      70 {
      71     switch($result = get_cfg_var($varName))
      72     {
      73         case 0:
      74             return '<font color="red">×</font>';
      75         break;
      76         
      77         case 1:
      78             return '<font color="green">√</font>';
      79         break;
      80         
      81         default:
      82             return $result;
      83         break;
      84     }
      85 }
      86 
      87 
      88 if ($_GET['act'] == "phpinfo") 
      89 {
      90     phpinfo();
      91     exit();
      92 } 
      93 elseif($_GET['act'] == "Function")
      94 {
      95     $arr = get_defined_functions();
      96     Function php()
      97     {
      98     }
      99     echo "<pre>";
     100     Echo "这里显示系统所支持的所有函数,和自定义函数
    ";
     101     print_r($arr);
     102     echo "</pre>";
     103     exit();
     104 }elseif($_GET['act'] == "disable_functions")
     105 {
     106     $disFuns=get_cfg_var("disable_functions");
     107     if(empty($disFuns))
     108     {
     109         $arr = '<font color=red>×</font>';
     110     }
     111     else
     112     { 
     113         $arr = $disFuns;
     114     }
     115     Function php()
     116     {
     117     }
     118     echo "<pre>";
     119     Echo "这里显示系统被禁用的函数
    ";
     120     print_r($arr);
     121     echo "</pre>";
     122     exit();
     123 }
     124 
     125 //MySQL检测
     126 if ($_POST['act'] == 'MySQL检测')
     127 {
     128     $host = isset($_POST['host']) ? trim($_POST['host']) : '';
     129     $port = isset($_POST['port']) ? (int) $_POST['port'] : '';
     130     $login = isset($_POST['login']) ? trim($_POST['login']) : '';
     131     $password = isset($_POST['password']) ? trim($_POST['password']) : '';
     132     $host = preg_match('~[^a-z0-9-.]+~i', $host) ? '' : $host;
     133     $port = intval($port) ? intval($port) : '';
     134     $login = preg_match('~[^a-z0-9\_-]+~i', $login) ? '' : htmlspecialchars($login);
     135     $password = is_string($password) ? htmlspecialchars($password) : '';
     136 }
     137 elseif ($_POST['act'] == '函数检测')
     138 {
     139     $funRe = "函数".$_POST['funName']."支持状况检测结果:".isfun1($_POST['funName']);
     140 } 
     141 elseif ($_POST['act'] == '邮件检测')
     142 {
     143     $mailRe = "邮件发送检测结果:发送";
     144     if($_SERVER['SERVER_PORT']==80){$mailContent = "http://".$_SERVER['SERVER_NAME'].($_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME']);}
     145     else{$mailContent = "http://".$_SERVER['SERVER_NAME'].":".$_SERVER['SERVER_PORT'].($_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME']);}
     146     $mailRe .= (false !== @mail($_POST["mailAdd"], $mailContent, "This is a test mail!
    
    http://lnmp.org")) ? "完成":"失败";
     147 }    
     148     
     149 // 检测函数支持
     150 function isfun($funName = '')
     151 {
     152     if (!$funName || trim($funName) == '' || preg_match('~[^a-z0-9\_]+~i', $funName, $tmp)) return '错误';
     153     return (false !== function_exists($funName)) ? '<font color="green">√</font>' : '<font color="red">×</font>';
     154 }
     155 function isfun1($funName = '')
     156 {
     157     if (!$funName || trim($funName) == '' || preg_match('~[^a-z0-9\_]+~i', $funName, $tmp)) return '错误';
     158     return (false !== function_exists($funName)) ? '√' : '×';
     159 }
     160 
     161 // 根据不同系统取得CPU相关信息
     162 switch(PHP_OS)
     163 {
     164     case "Linux":
     165         $sysReShow = (false !== ($sysInfo = sys_linux()))?"show":"none";
     166     break;
     167     
     168     case "FreeBSD":
     169         $sysReShow = (false !== ($sysInfo = sys_freebsd()))?"show":"none";
     170     break;
     171     
     172 /*    
     173     case "WINNT":
     174         $sysReShow = (false !== ($sysInfo = sys_windows()))?"show":"none";
     175     break;
     176 */    
     177     
     178     default:
     179     break;
     180 }
     181 
     182 //linux系统探测
     183 function sys_linux()
     184 {
     185     // CPU
     186     if (false === ($str = @file("/proc/cpuinfo"))) return false;
     187     $str = implode("", $str);
     188     @preg_match_all("/models+names{0,}:+s{0,}([ws)(@.-]+)([
    ]+)/s", $str, $model);
     189     @preg_match_all("/cpus+MHzs{0,}:+s{0,}([d.]+)[
    ]+/", $str, $mhz);
     190     @preg_match_all("/caches+sizes{0,}:+s{0,}([d.]+s{0,}[A-Z]+[
    ]+)/", $str, $cache);
     191     @preg_match_all("/bogomipss{0,}:+s{0,}([d.]+)[
    ]+/", $str, $bogomips);
     192     if (false !== is_array($model[1]))
     193     {
     194         $res['cpu']['num'] = sizeof($model[1]);
     195         /*
     196         for($i = 0; $i < $res['cpu']['num']; $i++)
     197         {
     198             $res['cpu']['model'][] = $model[1][$i].'&nbsp;('.$mhz[1][$i].')';
     199             $res['cpu']['mhz'][] = $mhz[1][$i];
     200             $res['cpu']['cache'][] = $cache[1][$i];
     201             $res['cpu']['bogomips'][] = $bogomips[1][$i];
     202         }*/
     203         if($res['cpu']['num']==1)
     204             $x1 = '';
     205         else
     206             $x1 = ' ×'.$res['cpu']['num'];
     207         $mhz[1][0] = ' | 频率:'.$mhz[1][0];
     208         $cache[1][0] = ' | 二级缓存:'.$cache[1][0];
     209         $bogomips[1][0] = ' | Bogomips:'.$bogomips[1][0];
     210         $res['cpu']['model'][] = $model[1][0].$mhz[1][0].$cache[1][0].$bogomips[1][0].$x1;
     211         if (false !== is_array($res['cpu']['model'])) $res['cpu']['model'] = implode("<br />", $res['cpu']['model']);
     212         if (false !== is_array($res['cpu']['mhz'])) $res['cpu']['mhz'] = implode("<br />", $res['cpu']['mhz']);
     213         if (false !== is_array($res['cpu']['cache'])) $res['cpu']['cache'] = implode("<br />", $res['cpu']['cache']);
     214         if (false !== is_array($res['cpu']['bogomips'])) $res['cpu']['bogomips'] = implode("<br />", $res['cpu']['bogomips']);
     215     }
     216 
     217     // NETWORK
     218 
     219     // UPTIME
     220     if (false === ($str = @file("/proc/uptime"))) return false;
     221     $str = explode(" ", implode("", $str));
     222     $str = trim($str[0]);
     223     $min = $str / 60;
     224     $hours = $min / 60;
     225     $days = floor($hours / 24);
     226     $hours = floor($hours - ($days * 24));
     227     $min = floor($min - ($days * 60 * 24) - ($hours * 60));
     228     if ($days !== 0) $res['uptime'] = $days."天";
     229     if ($hours !== 0) $res['uptime'] .= $hours."小时";
     230     $res['uptime'] .= $min."分钟";
     231 
     232     // MEMORY
     233     if (false === ($str = @file("/proc/meminfo"))) return false;
     234     $str = implode("", $str);
     235     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);
     236     preg_match_all("/Bufferss{0,}:+s{0,}([d.]+)/s", $str, $buffers);
     237 
     238     $res['memTotal'] = round($buf[1][0]/1024, 2);
     239     $res['memFree'] = round($buf[2][0]/1024, 2);
     240     $res['memBuffers'] = round($buffers[1][0]/1024, 2);
     241     $res['memCached'] = round($buf[3][0]/1024, 2);
     242     $res['memUsed'] = $res['memTotal']-$res['memFree'];
     243     $res['memPercent'] = (floatval($res['memTotal'])!=0)?round($res['memUsed']/$res['memTotal']*100,2):0;
     244 
     245     $res['memRealUsed'] = $res['memTotal'] - $res['memFree'] - $res['memCached'] - $res['memBuffers']; //真实内存使用
     246     $res['memRealFree'] = $res['memTotal'] - $res['memRealUsed']; //真实空闲
     247     $res['memRealPercent'] = (floatval($res['memTotal'])!=0)?round($res['memRealUsed']/$res['memTotal']*100,2):0; //真实内存使用率
     248 
     249     $res['memCachedPercent'] = (floatval($res['memCached'])!=0)?round($res['memCached']/$res['memTotal']*100,2):0; //Cached内存使用率
     250 
     251     $res['swapTotal'] = round($buf[4][0]/1024, 2);
     252     $res['swapFree'] = round($buf[5][0]/1024, 2);
     253     $res['swapUsed'] = round($res['swapTotal']-$res['swapFree'], 2);
     254     $res['swapPercent'] = (floatval($res['swapTotal'])!=0)?round($res['swapUsed']/$res['swapTotal']*100,2):0;
     255 
     256     // LOAD AVG
     257     if (false === ($str = @file("/proc/loadavg"))) return false;
     258     $str = explode(" ", implode("", $str));
     259     $str = array_chunk($str, 4);
     260     $res['loadAvg'] = implode(" ", $str[0]);
     261 
     262     return $res;
     263 }
     264 
     265 //FreeBSD系统探测
     266 function sys_freebsd()
     267 {
     268     //CPU
     269     if (false === ($res['cpu']['num'] = get_key("hw.ncpu"))) return false;
     270     $res['cpu']['model'] = get_key("hw.model");
     271     //LOAD AVG
     272     if (false === ($res['loadAvg'] = get_key("vm.loadavg"))) return false;
     273     //UPTIME
     274     if (false === ($buf = get_key("kern.boottime"))) return false;
     275     $buf = explode(' ', $buf);
     276     $sys_ticks = time() - intval($buf[3]);
     277     $min = $sys_ticks / 60;
     278     $hours = $min / 60;
     279     $days = floor($hours / 24);
     280     $hours = floor($hours - ($days * 24));
     281     $min = floor($min - ($days * 60 * 24) - ($hours * 60));
     282     if ($days !== 0) $res['uptime'] = $days."天";
     283     if ($hours !== 0) $res['uptime'] .= $hours."小时";
     284     $res['uptime'] .= $min."分钟";
     285     //MEMORY
     286     if (false === ($buf = get_key("hw.physmem"))) return false;
     287     $res['memTotal'] = round($buf/1024/1024, 2);
     288 
     289     $str = get_key("vm.vmtotal");
     290     preg_match_all("/
    Virtual Memory[:s]*(Total[:s]*([d]+)K[\,s]*Active[:s]*([d]+)K)
    /i", $str, $buff, PREG_SET_ORDER);
     291     preg_match_all("/
    Real Memory[:s]*(Total[:s]*([d]+)K[\,s]*Active[:s]*([d]+)K)
    /i", $str, $buf, PREG_SET_ORDER);
     292 
     293     $res['memRealUsed'] = round($buf[0][2]/1024, 2);
     294     $res['memCached'] = round($buff[0][2]/1024, 2);
     295     $res['memUsed'] = round($buf[0][1]/1024, 2) + $res['memCached'];
     296     $res['memFree'] = $res['memTotal'] - $res['memUsed'];
     297     $res['memPercent'] = (floatval($res['memTotal'])!=0)?round($res['memUsed']/$res['memTotal']*100,2):0;
     298 
     299     $res['memRealPercent'] = (floatval($res['memTotal'])!=0)?round($res['memRealUsed']/$res['memTotal']*100,2):0;
     300 
     301     return $res;
     302 }
     303 
     304 //取得参数值 FreeBSD
     305 function get_key($keyName)
     306 {
     307     return do_command('sysctl', "-n $keyName");
     308 }
     309 
     310 //确定执行文件位置 FreeBSD
     311 function find_command($commandName)
     312 {
     313     $path = array('/bin', '/sbin', '/usr/bin', '/usr/sbin', '/usr/local/bin', '/usr/local/sbin');
     314     foreach($path as $p) 
     315     {
     316         if (@is_executable("$p/$commandName")) return "$p/$commandName";
     317     }
     318     return false;
     319 }
     320 
     321 //执行系统命令 FreeBSD
     322 function do_command($commandName, $args)
     323 {
     324     $buffer = "";
     325     if (false === ($command = find_command($commandName))) return false;
     326     if ($fp = @popen("$command $args", 'r')) 
     327     {
     328         while (!@feof($fp))
     329         {
     330             $buffer .= @fgets($fp, 4096);
     331         }
     332         return trim($buffer);
     333     }
     334     return false;
     335 }
     336 
     337 //windows系统探测
     338 function sys_windows()
     339 {
     340     if (PHP_VERSION >= 5)
     341     {
     342         $objLocator = new COM("WbemScripting.SWbemLocator");
     343         $wmi = $objLocator->ConnectServer();
     344         $prop = $wmi->get("Win32_PnPEntity");
     345     }
     346     else
     347     {
     348         return false;
     349     }
     350 
     351     //CPU
     352     $cpuinfo = GetWMI($wmi,"Win32_Processor", array("Name","L2CacheSize","NumberOfCores"));
     353     $res['cpu']['num'] = $cpuinfo[0]['NumberOfCores'];
     354     if (null == $res['cpu']['num']) 
     355     {
     356         $res['cpu']['num'] = 1;
     357     }/*
     358     for ($i=0;$i<$res['cpu']['num'];$i++)
     359     {
     360         $res['cpu']['model'] .= $cpuinfo[0]['Name']."<br />";
     361         $res['cpu']['cache'] .= $cpuinfo[0]['L2CacheSize']."<br />";
     362     }*/
     363     $cpuinfo[0]['L2CacheSize'] = ' ('.$cpuinfo[0]['L2CacheSize'].')';
     364     if($res['cpu']['num']==1)
     365         $x1 = '';
     366     else
     367         $x1 = ' ×'.$res['cpu']['num'];
     368     $res['cpu']['model'] = $cpuinfo[0]['Name'].$cpuinfo[0]['L2CacheSize'].$x1;
     369     // SYSINFO
     370     $sysinfo = GetWMI($wmi,"Win32_OperatingSystem", array('LastBootUpTime','TotalVisibleMemorySize','FreePhysicalMemory','Caption','CSDVersion','SerialNumber','InstallDate'));
     371     $sysinfo[0]['Caption']=iconv('GBK', 'UTF-8',$sysinfo[0]['Caption']);
     372     $sysinfo[0]['CSDVersion']=iconv('GBK', 'UTF-8',$sysinfo[0]['CSDVersion']);
     373     $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)))."安装";
     374     //UPTIME
     375     $res['uptime'] = $sysinfo[0]['LastBootUpTime'];
     376 
     377     $sys_ticks = 3600*8 + time() - strtotime(substr($res['uptime'],0,14));
     378     $min = $sys_ticks / 60;
     379     $hours = $min / 60;
     380     $days = floor($hours / 24);
     381     $hours = floor($hours - ($days * 24));
     382     $min = floor($min - ($days * 60 * 24) - ($hours * 60));
     383     if ($days !== 0) $res['uptime'] = $days."天";
     384     if ($hours !== 0) $res['uptime'] .= $hours."小时";
     385     $res['uptime'] .= $min."分钟";
     386 
     387     //MEMORY
     388     $res['memTotal'] = round($sysinfo[0]['TotalVisibleMemorySize']/1024,2);
     389     $res['memFree'] = round($sysinfo[0]['FreePhysicalMemory']/1024,2);
     390     $res['memUsed'] = $res['memTotal']-$res['memFree'];    //上面两行已经除以1024,这行不用再除了
     391     $res['memPercent'] = round($res['memUsed'] / $res['memTotal']*100,2);
     392 
     393     $swapinfo = GetWMI($wmi,"Win32_PageFileUsage", array('AllocatedBaseSize','CurrentUsage'));
     394 
     395     // LoadPercentage
     396     $loadinfo = GetWMI($wmi,"Win32_Processor", array("LoadPercentage"));
     397     $res['loadAvg'] = $loadinfo[0]['LoadPercentage'];
     398 
     399     return $res;
     400 }
     401 
     402 function GetWMI($wmi,$strClass, $strValue = array())
     403 {
     404     $arrData = array();
     405 
     406     $objWEBM = $wmi->Get($strClass);
     407     $arrProp = $objWEBM->Properties_;
     408     $arrWEBMCol = $objWEBM->Instances_();
     409     foreach($arrWEBMCol as $objItem) 
     410     {
     411         @reset($arrProp);
     412         $arrInstance = array();
     413         foreach($arrProp as $propItem) 
     414         {
     415             eval("$value = $objItem->" . $propItem->Name . ";");
     416             if (empty($strValue)) 
     417             {
     418                 $arrInstance[$propItem->Name] = trim($value);
     419             } 
     420             else
     421             {
     422                 if (in_array($propItem->Name, $strValue)) 
     423                 {
     424                     $arrInstance[$propItem->Name] = trim($value);
     425                 }
     426             }
     427         }
     428         $arrData[] = $arrInstance;
     429     }
     430     return $arrData;
     431 }
     432 
     433 //比例条
     434 function bar($percent)
     435 {
     436 ?>
     437     <div class="bar"><div class="barli" style="<?php echo $percent?>%">&nbsp;</div></div>
     438 <?php
     439 }
     440 
     441 $uptime = $sysInfo['uptime'];
     442 $stime = date("Y-n-j H:i:s");
     443 $df = round(@disk_free_space(".")/(1024*1024*1024),3);
     444 $dt = round(@disk_total_space(".")/(1024*1024*1024),3);
     445 
     446 $load = $sysInfo['loadAvg'];    //系统负载
     447 
     448 
     449 //判断内存如果小于1GB,就显示M,否则显示GB单位
     450 if($sysInfo['memTotal']<1024)
     451 {
     452     $memTotal = $sysInfo['memTotal']." MB";
     453     $mt = $sysInfo['memTotal']." MB";
     454     $mu = $sysInfo['memUsed']." MB";
     455     $mf = $sysInfo['memFree']." MB";
     456     $mc = $sysInfo['memCached']." MB";    //cache化内存
     457     $mb = $sysInfo['memBuffers']." MB";    //缓冲
     458     $st = $sysInfo['swapTotal']." MB";
     459     $su = $sysInfo['swapUsed']." MB";
     460     $sf = $sysInfo['swapFree']." MB";
     461     $swapPercent = $sysInfo['swapPercent'];
     462     $memRealUsed = $sysInfo['memRealUsed']." MB"; //真实内存使用
     463     $memRealFree = $sysInfo['memRealFree']." MB"; //真实内存空闲
     464     $memRealPercent = $sysInfo['memRealPercent']; //真实内存使用比率
     465     $memPercent = $sysInfo['memPercent']; //内存总使用率
     466     $memCachedPercent = $sysInfo['memCachedPercent']; //cache内存使用率
     467 }
     468 else
     469 {
     470     $memTotal = round($sysInfo['memTotal']/1024,3)." GB";
     471     $mt = round($sysInfo['memTotal']/1024,3)." GB";
     472     $mu = round($sysInfo['memUsed']/1024,3)." GB";
     473     $mf = round($sysInfo['memFree']/1024,3)." GB";
     474     $mc = round($sysInfo['memCached']/1024,3)." GB";
     475     $mb = round($sysInfo['memBuffers']/1024,3)." GB";
     476     $st = round($sysInfo['swapTotal']/1024,3)." GB";
     477     $su = round($sysInfo['swapUsed']/1024,3)." GB";
     478     $sf = round($sysInfo['swapFree']/1024,3)." GB";
     479     $swapPercent = $sysInfo['swapPercent'];
     480     $memRealUsed = round($sysInfo['memRealUsed']/1024,3)." GB"; //真实内存使用
     481     $memRealFree = round($sysInfo['memRealFree']/1024,3)." GB"; //真实内存空闲
     482     $memRealPercent = $sysInfo['memRealPercent']; //真实内存使用比率
     483     $memPercent = $sysInfo['memPercent']; //内存总使用率
     484     $memCachedPercent = $sysInfo['memCachedPercent']; //cache内存使用率
     485 }
     486 
     487 //网卡流量
     488 $strs = @file("/proc/net/dev"); 
     489 
     490 for ($i = 2; $i < count($strs); $i++ )
     491 {
     492     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 );
     493 /*    $NetInput[$i] = formatsize($info[2][0]);
     494     $NetOut[$i]  = formatsize($info[10][0]);
     495 */ 
     496     $tmo = round($info[2][0]/1024/1024, 5); 
     497     $tmo2 = round($tmo / 1024, 5);
     498     $NetInput[$i] = $tmo2;
     499     $tmp = round($info[10][0]/1024/1024, 5); 
     500     $tmp2 = round($tmp / 1024, 5);
     501     $NetOut[$i] = $tmp2;
     502 
     503 }
     504 
     505 //ajax调用实时刷新
     506 if ($_GET['act'] == "rt")
     507 {
     508     $arr=array('freeSpace'=>"$df",'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]");
     509     $jarr=json_encode($arr); 
     510     echo $_GET['callback'],'(',$jarr,')';
     511     exit;
     512 }
     513 ?>
     514 
     515 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     516 <html xmlns="http://www.w3.org/1999/xhtml">
     517 <head>
     518 <title>PHP探针 for LNMP一键安装包</title>
     519 <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
     520 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     521 <!-- Powered by: Yahei.Net -->
     522 <style type="text/css">
     523 <!--
     524 * {font-family: Tahoma, "Microsoft Yahei", Arial; }
     525 body{text-align: center; margin: 0 auto; padding: 0; background-color:#FFFFFF;font-size:12px;font-family:Tahoma, Arial}
     526 h1 {font-size: 26px; font-weight: normal; padding: 0; margin: 0; color: #444444;}
     527 h1 small {font-size: 11px; font-family: Tahoma; font-weight: bold; }
     528 a{color: #000000; text-decoration:none;}
     529 a.black{color: #000000; text-decoration:none;}
     530 b{color: #999999;}
     531 table{clear:both;padding: 0; margin: 0 0 10px;border-collapse:collapse; border-spacing: 0;}
     532 th{padding: 3px 6px; font-weight:bold;background:#3066a6;color:#FFFFFF;border:1px solid #3066a6; text-align:left;}
     533 .th_1{padding: 3px 6px; font-weight:bold;background:#666699;color:#FFFFFF;border:1px solid #3066a6; text-align:left;}
     534 .th_2{padding: 3px 6px; font-weight:bold;background:#417291;color:#FFFFFF;border:1px solid #3066a6; text-align:left;}
     535 .th_3{padding: 3px 6px; font-weight:bold;background:#067201;color:#FFFFFF;border:1px solid #3066a6; text-align:left;}
     536 .th_4{padding: 3px 6px; font-weight:bold;background:#666666;color:#FFFFFF;border:1px solid #CCCCCC; text-align:left;}
     537 .th_5{padding: 3px 6px; font-weight:bold;background:#333333;color:#FFFFFF;border:1px solid #CCCCCC; text-align:left;}
     538 .th_6{padding: 3px 6px; font-weight:bold;background:#FF6600;color:#FFFFFF;border:1px solid #FF6600; text-align:left;}
     539 tr{padding: 0; background:#F7F7F7;}
     540 td{padding: 3px 6px; border:1px solid #CCCCCC;}
     541 input{padding: 2px; background: #FFFFFF; border-top:1px solid #666666; border-left:1px solid #666666; border-right:1px solid #CCCCCC; border-bottom:1px solid #CCCCCC; font-size:12px}
     542 input.btn{font-weight: bold; height: 20px; line-height: 20px; padding: 0 6px; color:#666666; background: #f2f2f2; border:1px solid #999;font-size:12px}
     543 .bar {border:1px solid #999999; background:#FFFFFF; height:5px; font-size:2px; 89%; margin:2px 0 5px 0;padding:1px;overflow: hidden;}
     544 .bar_1 {border:1px dotted #999999; background:#FFFFFF; height:5px; font-size:2px; 89%; margin:2px 0 5px 0;padding:1px;overflow: hidden;}
     545 .barli_red{background:#ff6600; height:5px; margin:0px; padding:0;}
     546 .barli_blue{background:#0099FF; height:5px; margin:0px; padding:0;}
     547 .barli_green{background:#36b52a; height:5px; margin:0px; padding:0;}
     548 .barli_1{background:#999999; height:5px; margin:0px; padding:0;}
     549 .barli{background:#36b52a; height:5px; margin:0px; padding:0;}
     550 #page { 920px; padding: 0 20px; margin: 0 auto; text-align: left;}
     551 #header{position: relative; padding: 10px;}
     552 #footer {padding: 15px 0; text-align: center; font-size: 11px; font-family: Tahoma, Verdana;}
     553 #lnmplink {position: absolute; top: 20px; left: 115px; text-align: right; font-weight: bold; color: #06C;}
     554 #lnmplink a {color: #0000FF; text-decoration: underline;}
     555 .w_small{font-family: Courier New;}
     556 .w_number{color: #f800fe;}
     557 .sudu {padding: 0; background:#5dafd1; }
     558 .suduk { margin:0px; padding:0;}
     559 .resYes{}
     560 .resNo{color: #FF0000;}
     561 .word{word-break:break-all;}
     562 -->
     563 </style>
     564 <script language="JavaScript" type="text/javascript" src="http://lib.sinaapp.com/js/jquery/1.7/jquery.min.js"></script>
     565 <script type="text/javascript"> 
     566 <!--
     567 $(document).ready(function(){getJSONData();});
     568 function getJSONData()
     569 {
     570     setTimeout("getJSONData()", 1000);
     571     $.getJSON('?act=rt&callback=?', displayData);
     572 }
     573 function displayData(dataJSON)
     574 {
     575     $("#freeSpace").html(dataJSON.freeSpace);
     576     $("#TotalMemory").html(dataJSON.TotalMemory);
     577     $("#UsedMemory").html(dataJSON.UsedMemory);
     578     $("#FreeMemory").html(dataJSON.FreeMemory);
     579     $("#CachedMemory").html(dataJSON.CachedMemory);
     580     $("#Buffers").html(dataJSON.Buffers);
     581     $("#TotalSwap").html(dataJSON.TotalSwap);
     582     $("#swapUsed").html(dataJSON.swapUsed);
     583     $("#swapFree").html(dataJSON.swapFree);
     584     $("#swapPercent").html(dataJSON.swapPercent);
     585     $("#loadAvg").html(dataJSON.loadAvg);
     586     $("#uptime").html(dataJSON.uptime);
     587     $("#freetime").html(dataJSON.freetime);
     588     $("#stime").html(dataJSON.stime);
     589     $("#bjtime").html(dataJSON.bjtime);
     590     $("#memRealUsed").html(dataJSON.memRealUsed);
     591     $("#memRealFree").html(dataJSON.memRealFree);
     592     $("#memRealPercent").html(dataJSON.memRealPercent);
     593     $("#memPercent").html(dataJSON.memPercent);
     594     $("#barmemPercent").width(dataJSON.memPercent);
     595     $("#barmemRealPercent").width(dataJSON.barmemRealPercent);
     596     $("#memCachedPercent").html(dataJSON.memCachedPercent);
     597     $("#barmemCachedPercent").width(dataJSON.barmemCachedPercent);
     598     $("#barswapPercent").width(dataJSON.barswapPercent);
     599     $("#NetOut2").html(dataJSON.NetOut2);
     600     $("#NetOut3").html(dataJSON.NetOut3);
     601     $("#NetOut4").html(dataJSON.NetOut4);
     602     $("#NetOut5").html(dataJSON.NetOut5);
     603     $("#NetOut6").html(dataJSON.NetOut6);
     604     $("#NetOut7").html(dataJSON.NetOut7);
     605     $("#NetOut8").html(dataJSON.NetOut8);
     606     $("#NetOut9").html(dataJSON.NetOut9);
     607     $("#NetOut10").html(dataJSON.NetOut10);
     608     $("#NetInput2").html(dataJSON.NetInput2);
     609     $("#NetInput3").html(dataJSON.NetInput3);
     610     $("#NetInput4").html(dataJSON.NetInput4);
     611     $("#NetInput5").html(dataJSON.NetInput5);
     612     $("#NetInput6").html(dataJSON.NetInput6);
     613     $("#NetInput7").html(dataJSON.NetInput7);
     614     $("#NetInput8").html(dataJSON.NetInput8);
     615     $("#NetInput9").html(dataJSON.NetInput9);
     616     $("#NetInput10").html(dataJSON.NetInput10);    
     617 }
     618 -->
     619 </script>
     620 </head>
     621 <body>
     622 
     623 <div id="page">
     624     <div id="header">
     625         <h1>PHP探针</h1>
     626         <div id="lnmplink">for <a href="http://lnmp.org" target="_blank">LNMP一键安装包</a> <a href="http://bbs.vpser.net/forum-25-1.html" target="_blank">技术支持论坛</a></div>
     627     </div>
     628 
     629 <!--服务器相关参数-->
     630 <table width="100%" cellpadding="3" cellspacing="0">
     631   <tr><th colspan="4">服务器参数</th></tr>
     632   <tr>
     633     <td>服务器域名/IP地址</td>
     634     <td colspan="3"><?php echo $_SERVER['SERVER_NAME'];?>(<?php if('/'==DIRECTORY_SEPARATOR){echo $_SERVER['SERVER_ADDR'];}else{echo @gethostbyname($_SERVER['SERVER_NAME']);} ?>)</td>
     635   </tr>
     636   <tr>
     637     <td>服务器标识</td>
     638     <td colspan="3"><?php if($sysInfo['win_n'] != ''){echo $sysInfo['win_n'];}else{echo @php_uname();};?></td>
     639   </tr>
     640   <tr>
     641     <td width="13%">服务器操作系统</td>
     642     <td width="37%"><?php $os = explode(" ", php_uname()); echo $os[0];?> &nbsp;内核版本:<?php if('/'==DIRECTORY_SEPARATOR){echo $os[2];}else{echo $os[1];} ?></td>
     643     <td width="13%">服务器解译引擎</td>
     644     <td width="37%"><?php echo $_SERVER['SERVER_SOFTWARE'];?></td>
     645   </tr>
     646   <tr>
     647     <td>服务器语言</td>
     648     <td><?php echo getenv("HTTP_ACCEPT_LANGUAGE");?></td>
     649     <td>服务器端口</td>
     650     <td><?php echo $_SERVER['SERVER_PORT'];?></td>
     651   </tr>
     652   <tr>
     653       <td>服务器主机名</td>
     654       <td><?php if('/'==DIRECTORY_SEPARATOR ){echo $os[1];}else{echo $os[2];} ?></td>
     655       <td>绝对路径</td>
     656       <td><?php echo $_SERVER['DOCUMENT_ROOT']?str_replace('\','/',$_SERVER['DOCUMENT_ROOT']):str_replace('\','/',dirname(__FILE__));?></td>
     657     </tr>
     658   <tr>
     659       <td>管理员邮箱</td>
     660       <td><?php echo $_SERVER['SERVER_ADMIN'];?></td>
     661         <td>探针路径</td>
     662         <td><?php echo str_replace('\','/',__FILE__)?str_replace('\','/',__FILE__):$_SERVER['SCRIPT_FILENAME'];?></td>
     663     </tr>
     664 </table>
     665 
     666 <?if("show"==$sysReShow){?>
     667 <table width="100%" cellpadding="3" cellspacing="0" align="center">
     668   <tr><th colspan="6">服务器实时数据</th></tr>
     669   <tr>
     670     <td width="13%" >服务器当前时间</td>
     671     <td width="37%" ><span id="stime"><?php echo $stime;?></span></td>
     672     <td width="13%" >服务器已运行时间</td>
     673     <td width="37%" colspan="3"><span id="uptime"><?php echo $uptime;?></span></td>
     674   </tr>
     675   <tr>
     676     <td>总空间</td>
     677     <td><?php echo $dt;?>&nbsp;GB</td>
     678     <td><a href="#" title="显示的是网站所在的目录的可用空间,非服务器上所有磁盘之可用空间!">可用空间</a></td>
     679     <td colspan="3"><font color='#CC0000'><span id="freeSpace"><?php echo $df;?></span></font>&nbsp;GB</td>
     680   </tr>
     681   <tr>
     682     <td width="13%">CPU型号 [<?php echo $sysInfo['cpu']['num'];?>核]</td>
     683     <td width="87%" colspan="5"><?php echo $sysInfo['cpu']['model'];?></td>
     684   </tr>
     685       <tr>
     686         <td>内存使用状况<br ><br ><a href="http://www.vpser.net/other/linux-vps-ram.html" target="_blank"><font color=red>内存参数解读</font></a></td>
     687         <td colspan="5">
     688 <?php
     689 $tmp = array(
     690     'memTotal', 'memUsed', 'memFree', 'memPercent',
     691     'memCached', 'memRealPercent',
     692     'swapTotal', 'swapUsed', 'swapFree', 'swapPercent'
     693 );
     694 foreach ($tmp AS $v) {
     695     $sysInfo[$v] = $sysInfo[$v] ? $sysInfo[$v] : 0;
     696 }
     697 ?>
     698           物理内存:共
     699           <font color='#CC0000'><?php echo $memTotal;?> </font>
     700            , 已用
     701           <font color='#CC0000'><span id="UsedMemory"><?php echo $mu;?></span></font>
     702           , 空闲
     703           <font color='#CC0000'><span id="FreeMemory"><?php echo $mf;?></span></font>
     704           , 使用率
     705           <span id="memPercent"><?php echo $memPercent;?></span>
     706           <div class="bar"><div id="barmemPercent" class="barli_green" style="<?php echo $memPercent?>%">&nbsp;</div> </div>
     707 <?php
     708 //判断如果cache为0,不显示
     709 if($sysInfo['memCached']>0)
     710 {
     711 ?>        
     712           Cache化内存为 <span id="CachedMemory"><?php echo $mc;?></span>
     713           , 使用率 
     714           <span id="memCachedPercent"><?php echo $memCachedPercent;?></span>
     715           %    | Buffers缓冲为  <span id="Buffers"><?php echo $mb;?></span>
     716           <div class="bar"><div id="barmemCachedPercent" class="barli_blue" >&nbsp;</div></div>
     717 
     718           真实内存使用
     719           <span id="memRealUsed"><?php echo $memRealUsed;?></span>
     720           , 真实内存空闲
     721           <span id="memRealFree"><?php echo $memRealFree;?></span>
     722           , 使用率
     723           <span id="memRealPercent"><?php echo $memRealPercent;?></span>
     724           %
     725           <div class="bar_1"><div id="barmemRealPercent" class="barli_1" >&nbsp;</div></div> 
     726 <?php
     727 }
     728 //判断如果SWAP区为0,不显示
     729 if($sysInfo['swapTotal']>0)
     730 {
     731 ?>    
     732           SWAP区:共
     733           <?php echo $st;?>
     734           , 已使用
     735           <span id="swapUsed"><?php echo $su;?></span>
     736           , 空闲
     737           <span id="swapFree"><?php echo $sf;?></span>
     738           , 使用率
     739           <span id="swapPercent"><?php echo $swapPercent;?></span>
     740           %
     741           <div class="bar"><div id="barswapPercent" class="barli_red" >&nbsp;</div> </div>
     742 
     743 <?php
     744 }    
     745 ?>          
     746       </td>
     747     </tr>
     748       <tr>
     749         <td>系统平均负载</td>
     750         <td colspan="5" class="w_number"><span id="loadAvg"><?php echo $load;?></span></td>
     751     </tr>
     752 </table>
     753 <?}?>
     754 
     755 <?php if (false !== ($strs = @file("/proc/net/dev"))) : ?>
     756 <table width="100%" cellpadding="3" cellspacing="0" align="center">
     757     <tr><th colspan="3">网络使用状况</th></tr>
     758 <?php for ($i = 2; $i < count($strs); $i++ ) : ?>
     759 <?php 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 );?>
     760      <tr>
     761         <td width="13%"><?php echo $info[1][0]?> : </td>
     762         <td width="43%">已接收 : <font color='#CC0000'><span id="NetInput<?php echo $i?>"><?php echo $NetInput[$i]?></span></font> GB</td>
     763         <td width="43%">已发送 : <font color='#CC0000'><span id="NetOut<?php echo $i?>"><?php echo $NetOut[$i]?></span></font> GB</td>
     764     </tr>
     765 <?php endfor; ?>
     766 </table>
     767 <?php endif; ?>
     768 
     769 <table width="100%" cellpadding="3" cellspacing="0" align="center">
     770   <tr>
     771     <th colspan="4" class="th_1">PHP已编译模块检测</th>
     772   </tr>
     773   <tr>
     774     <td colspan="4"><span class="w_small">
     775 <?php
     776 $able=get_loaded_extensions();
     777 foreach ($able as $key=>$value) {
     778     if ($key!=0 && $key%13==0) {
     779         echo '<br />';
     780     }
     781     echo "$value&nbsp;&nbsp;";
     782 }
     783 ?></span>
     784     </td>
     785   </tr>
     786 </table>
     787 <table width="100%" cellpadding="3" cellspacing="0" align="center">
     788   <tr><th colspan="4" class="th_1">PHP相关参数</th></tr>
     789   <tr>
     790     <td width="32%">PHP信息(phpinfo):</td>
     791     <td width="18%">
     792         <?php
     793         $phpSelf = $_SERVER[PHP_SELF] ? $_SERVER[PHP_SELF] : $_SERVER[SCRIPT_NAME];
     794         $disFuns=get_cfg_var("disable_functions");
     795         ?>
     796     <?php echo (false!==eregi("phpinfo",$disFuns))? '<font color="red">×</font>' :"<a href='$phpSelf?act=phpinfo' target='_blank'>PHPINFO</a>";?>
     797     </td>
     798     <td width="32%">PHP版本(php_version):</td>
     799     <td width="18%"><?php echo PHP_VERSION;?></td>
     800   </tr>
     801   <tr>
     802     <td>PHP运行方式:</td>
     803     <td><?php echo strtoupper(php_sapi_name());?></td>
     804     <td>脚本占用最大内存(memory_limit):</td>
     805     <td><?php echo show("memory_limit");?></td>
     806   </tr>
     807   <tr>
     808     <td>PHP安全模式(safe_mode):</td>
     809     <td><?php echo show("safe_mode");?></td>
     810     <td>POST方法提交最大限制(post_max_size):</td>
     811     <td><?php echo show("post_max_size");?></td>
     812   </tr>
     813   <tr>
     814     <td>上传文件最大限制(upload_max_filesize):</td>
     815     <td><?php echo show("upload_max_filesize");?></td>
     816     <td>浮点型数据显示的有效位数(precision):</td>
     817     <td><?php echo show("precision");?></td>
     818   </tr>
     819   <tr>
     820     <td>脚本超时时间(max_execution_time):</td>
     821     <td><?php echo show("max_execution_time");?>秒</td>
     822     <td>socket超时时间(default_socket_timeout):</td>
     823     <td><?php echo show("default_socket_timeout");?>秒</td>
     824   </tr>
     825   <tr>
     826     <td>PHP页面根目录(doc_root):</td>
     827     <td><?php echo show("doc_root");?></td>
     828     <td>用户根目录(user_dir):</td>
     829     <td><?php echo show("user_dir");?></td>
     830   </tr>
     831   <tr>
     832     <td>dl()函数(enable_dl):</td>
     833     <td><?php echo show("enable_dl");?></td>
     834     <td>指定包含文件目录(include_path):</td>
     835     <td><?php echo show("include_path");?></td>
     836   </tr>
     837   <tr>
     838     <td>显示错误信息(display_errors):</td>
     839     <td><?php echo show("display_errors");?></td>
     840     <td>自定义全局变量(register_globals):</td>
     841     <td><?php echo show("register_globals");?></td>
     842   </tr>
     843   <tr>
     844     <td>数据反斜杠转义(magic_quotes_gpc):</td>
     845     <td><?php echo show("magic_quotes_gpc");?></td>
     846     <td>"&lt;?...?&gt;"短标签(short_open_tag):</td>
     847     <td><?php echo show("short_open_tag");?></td>
     848   </tr>
     849   <tr>
     850     <td>"&lt;% %&gt;"ASP风格标记(asp_tags):</td>
     851     <td><?php echo show("asp_tags");?></td>
     852     <td>忽略重复错误信息(ignore_repeated_errors):</td>
     853     <td><?php echo show("ignore_repeated_errors");?></td>
     854   </tr>
     855   <tr>
     856     <td>忽略重复的错误源(ignore_repeated_source):</td>
     857     <td><?php echo show("ignore_repeated_source");?></td>
     858     <td>报告内存泄漏(report_memleaks):</td>
     859     <td><?php echo show("report_memleaks");?></td>
     860   </tr>
     861   <tr>
     862     <td>自动字符串转义(magic_quotes_gpc):</td>
     863     <td><?php echo show("magic_quotes_gpc");?></td>
     864     <td>外部字符串自动转义(magic_quotes_runtime):</td>
     865     <td><?php echo show("magic_quotes_runtime");?></td>
     866   </tr>
     867   <tr>
     868     <td>打开远程文件(allow_url_fopen):</td>
     869     <td><?php echo show("allow_url_fopen");?></td>
     870     <td>声明argv和argc变量(register_argc_argv):</td>
     871     <td><?php echo show("register_argc_argv");?></td>
     872   </tr>
     873   <tr>
     874     <td>Cookie 支持:</td>
     875     <td><?php echo isset($_COOKIE)?'<font color="green">√</font>' : '<font color="red">×</font>';?></td>
     876     <td>拼写检查(ASpell Library):</td>
     877     <td><?php echo isfun("aspell_check_raw");?></td>
     878   </tr>
     879    <tr>
     880     <td>高精度数学运算(BCMath):</td>
     881     <td><?php echo isfun("bcadd");?></td>
     882     <td>PREL相容语法(PCRE):</td>
     883     <td><?php echo isfun("preg_match");?></td>
     884    <tr>
     885     <td>PDF文档支持:</td>
     886     <td><?php echo isfun("pdf_close");?></td>
     887     <td>SNMP网络管理协议:</td>
     888     <td><?php echo isfun("snmpget");?></td>
     889   </tr> 
     890    <tr>
     891     <td>VMailMgr邮件处理:</td>
     892     <td><?php echo isfun("vm_adduser");?></td>
     893     <td>Curl支持:</td>
     894     <td><?php echo isfun("curl_init");?></td>
     895   </tr> 
     896    <tr>
     897     <td>SMTP支持:</td>
     898     <td><?php echo get_cfg_var("SMTP")?'<font color="green">√</font>' : '<font color="red">×</font>';?></td>
     899     <td>SMTP地址:</td>
     900     <td><?php echo get_cfg_var("SMTP")?get_cfg_var("SMTP"):'<font color="red">×</font>';?></td>
     901   </tr> 
     902     <tr>
     903         <td>默认支持函数(enable_functions):</td>
     904         <td colspan="3"><a href='<?php echo $phpSelf;?>?act=Function' target='_blank' class='static'>请点这里查看详细!</a></td>        
     905     </tr>
     906     <tr>
     907         <td>被禁用的函数(disable_functions):</td>
     908         <td colspan="3" class="word">
     909 <?php 
     910 $disFuns=get_cfg_var("disable_functions");
     911 if(empty($disFuns))
     912 {
     913     echo '<font color=red>×</font>';
     914 }
     915 else
     916 { 
     917     //echo $disFuns;
     918     $disFuns_array =  explode(',',$disFuns);
     919     foreach ($disFuns_array as $key=>$value) 
     920     {
     921         if ($key!=0 && $key%5==0) {
     922             echo '<br />';
     923     }
     924     echo "$value&nbsp;&nbsp;";
     925 }    
     926 }
     927 
     928 ?>
     929         </td>
     930     </tr>
     931 </table>
     932 <!--组件信息-->
     933 <table width="100%" cellpadding="3" cellspacing="0" align="center">
     934   <tr><th colspan="4" class="th_1">组件支持</th></tr>
     935   <tr>
     936     <td width="32%">FTP支持:</td>
     937     <td width="18%"><?php echo isfun("ftp_login");?></td>
     938     <td width="32%">XML解析支持:</td>
     939     <td width="18%"><?php echo isfun("xml_set_object");?></td>
     940   </tr>
     941   <tr>
     942     <td>Session支持:</td>
     943     <td><?php echo isfun("session_start");?></td>
     944     <td>Socket支持:</td>
     945     <td><?php echo isfun("socket_accept");?></td>
     946   </tr>
     947   <tr>
     948     <td>Calendar支持</td>
     949     <td><?php echo isfun('cal_days_in_month');?>
     950     </td>
     951     <td>允许URL打开文件:</td>
     952     <td><?php echo show("allow_url_fopen");?></td>
     953   </tr>
     954   <tr>
     955     <td>GD库支持:</td>
     956     <td>
     957     <?php
     958         if(function_exists(gd_info)) {
     959             $gd_info = @gd_info();
     960             echo $gd_info["GD Version"];
     961         }else{echo '<font color="red">×</font>';}
     962     ?></td>
     963     <td>压缩文件支持(Zlib):</td>
     964     <td><?php echo isfun("gzclose");?></td>
     965   </tr>
     966   <tr>
     967     <td>IMAP电子邮件系统函数库:</td>
     968     <td><?php echo isfun("imap_close");?></td>
     969     <td>历法运算函数库:</td>
     970     <td><?php echo isfun("JDToGregorian");?></td>
     971   </tr>
     972   <tr>
     973     <td>正则表达式函数库:</td>
     974     <td><?php echo isfun("preg_match");?></td>
     975     <td>WDDX支持:</td>
     976     <td><?php echo isfun("wddx_add_vars");?></td>
     977   </tr>
     978   <tr>
     979     <td>Iconv编码转换:</td>
     980     <td><?php echo isfun("iconv");?></td>
     981     <td>mbstring:</td>
     982     <td><?php echo isfun("mb_eregi");?></td>
     983   </tr>
     984   <tr>
     985     <td>高精度数学运算:</td>
     986     <td><?php echo isfun("bcadd");?></td>
     987     <td>LDAP目录协议:</td>
     988     <td><?php echo isfun("ldap_close");?></td>
     989   </tr>
     990   <tr>
     991     <td>MCrypt加密处理:</td>
     992     <td><?php echo isfun("mcrypt_cbc");?></td>
     993     <td>哈稀计算:</td>
     994     <td><?php echo isfun("mhash_count");?></td>
     995   </tr>
     996 </table>
     997 
     998 <!--第三方组件信息-->
     999 <table width="100%" cellpadding="3" cellspacing="0" align="center">
    1000   <tr><th colspan="4" class="th_1">第三方组件</th></tr>
    1001   <tr>
    1002     <td width="32%">Zend版本</td>
    1003     <td width="18%"><?php $zend_version = zend_version();if(empty($zend_version)){echo '<font color=red>×</font>';}else{echo $zend_version;}?></td>
    1004     <td width="32%">
    1005 <?php
    1006 $PHP_VERSION = PHP_VERSION;
    1007 $PHP_VERSION = substr($PHP_VERSION,2,1);
    1008 if($PHP_VERSION > 2)
    1009 {
    1010     echo "ZendGuardLoader[启用]";
    1011 }
    1012 else
    1013 {
    1014     echo "Zend Optimizer";
    1015 }
    1016 ?>
    1017     </td>
    1018     <td width="18%"><?php if($PHP_VERSION > 2){echo (get_cfg_var("zend_loader.enable"))?'<font color=green>√</font>':'<font color=red>×</font>';} 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"))?'<font color=green>√</font>':'<font color=red>×</font>';}}?></td>
    1019   </tr>
    1020   <tr>
    1021     <td>eAccelerator</td>
    1022     <td><?php if((phpversion('eAccelerator'))!=''){echo phpversion('eAccelerator');}else{ echo "<font color=red>×</font>";} ?></td>
    1023     <td>ioncube</td>
    1024     <td><?php if(extension_loaded('ionCube Loader')){   $ys = ioncube_loader_iversion();   $gm = ".".(int)substr($ys,3,2);   echo ionCube_Loader_version().$gm;}else{echo "<font color=red>×</font>";}?></td>
    1025   </tr>
    1026   <tr>
    1027     <td>XCache</td>
    1028     <td><?php if((phpversion('XCache'))!=''){echo phpversion('XCache');}else{ echo "<font color=red>×</font>";} ?></td>
    1029     <td>APC</td>
    1030     <td><?php if((phpversion('APC'))!=''){echo phpversion('APC');}else{ echo "<font color=red>×</font>";} ?></td>
    1031   </tr>
    1032 </table>
    1033 
    1034 <!--数据库支持-->
    1035 <table width="100%" cellpadding="3" cellspacing="0" align="center">
    1036   <tr><th colspan="4" class="th_2">数据库支持</th></tr>
    1037   <tr>
    1038     <td width="32%">MySQL 数据库:</td>
    1039     <td width="18%"><?php echo isfun("mysql_close");?>
    1040     <?php
    1041     if(function_exists("mysql_get_server_info")) {
    1042         $s = @mysql_get_server_info();
    1043         $s = $s ? '&nbsp; mysql_server 版本:'.$s : '';
    1044         $c = '&nbsp; mysql_client 版本:'.@mysql_get_client_info();
    1045         echo $s;
    1046     }
    1047     ?>
    1048     </td>
    1049     <td width="32%">ODBC 数据库:</td>
    1050     <td width="18%"><?php echo isfun("odbc_close");?></td>
    1051   </tr>
    1052   <tr>
    1053     <td>Oracle 数据库:</td>
    1054     <td><?php echo isfun("ora_close");?></td>
    1055     <td>SQL Server 数据库:</td>
    1056     <td><?php echo isfun("mssql_close");?></td>
    1057   </tr>
    1058   <tr>
    1059     <td>dBASE 数据库:</td>
    1060     <td><?php echo isfun("dbase_close");?></td>
    1061     <td>mSQL 数据库:</td>
    1062     <td><?php echo isfun("msql_close");?></td>
    1063   </tr>
    1064   <tr>
    1065     <td>SQLite 数据库:</td>
    1066     <td><?php if(extension_loaded('sqlite3')) {$sqliteVer = SQLite3::version();echo '<font color=green>√</font> ';echo "SQLite3 Ver ";echo $sqliteVer[versionString];}else {echo isfun("sqlite_close");if(isfun("sqlite_close") == '<font color="green">√</font>') {echo "&nbsp; 版本: ".@sqlite_libversion();}}?></td>
    1067     <td>Hyperwave 数据库:</td>
    1068     <td><?php echo isfun("hw_close");?></td>
    1069   </tr>
    1070   <tr>
    1071     <td>Postgre SQL 数据库:</td>
    1072     <td><?php echo isfun("pg_close"); ?></td>
    1073     <td>Informix 数据库:</td>
    1074     <td><?php echo isfun("ifx_close");?></td>
    1075   </tr>
    1076   <tr>
    1077     <td>DBA 数据库:</td>
    1078     <td><?php echo isfun("dba_close");?></td>
    1079     <td>DBM 数据库:</td>
    1080     <td><?php echo isfun("dbmclose");?></td>
    1081   </tr>
    1082   <tr>
    1083     <td>FilePro 数据库:</td>
    1084     <td><?php echo isfun("filepro_fieldcount");?></td>
    1085     <td>SyBase 数据库:</td>
    1086     <td><?php echo isfun("sybase_close");?></td>
    1087   </tr> 
    1088 </table>
    1089 
    1090 <form action="<?php echo $_SERVER[PHP_SELF]."#bottom";?>" method="post">
    1091 <!--MySQL数据库连接检测-->
    1092 <table width="100%" cellpadding="3" cellspacing="0" align="center">
    1093     <tr><th colspan="3" class="th_2">MySQL数据库连接检测</th></tr>
    1094   <tr>
    1095     <td width="15%"></td>
    1096     <td width="60%">
    1097       地址:<input type="text" name="host" value="localhost" size="10" />
    1098       端口:<input type="text" name="port" value="3306" size="10" />
    1099       用户名:<input type="text" name="login" size="10" />
    1100       密码:<input type="password" name="password" size="10" />
    1101     </td>
    1102     <td width="25%">
    1103       <input class="btn" type="submit" name="act" value="MySQL检测" />
    1104     </td>
    1105   </tr>
    1106 </table>
    1107   <?php
    1108   if ($_POST['act'] == 'MySQL检测') {
    1109       if(function_exists("mysql_close")==1) {
    1110           $link = @mysql_connect($host.":".$port,$login,$password);
    1111           if ($link){
    1112               echo "<script>alert('连接到MySql数据库正常')</script>";
    1113           } else {
    1114               echo "<script>alert('无法连接到MySql数据库!')</script>";
    1115           }
    1116       } else {
    1117           echo "<script>alert('服务器不支持MySQL数据库!')</script>";
    1118       }
    1119   }
    1120     ?>
    1121 <!--函数检测-->
    1122 <table width="100%" cellpadding="3" cellspacing="0" align="center">
    1123     <tr><th colspan="3" class="th_4">函数检测</th></tr>
    1124   <tr>
    1125     <td width="15%"></td>
    1126     <td width="60%">
    1127       请输入您要检测的函数:
    1128       <input type="text" name="funName" size="50" />
    1129     </td>
    1130     <td width="25%">
    1131       <input class="btn" type="submit" name="act" align="right" value="函数检测" />
    1132     </td>
    1133   </tr>
    1134   <?php
    1135   if ($_POST['act'] == '函数检测') {
    1136       echo "<script>alert('$funRe')</script>";
    1137   }
    1138   ?>
    1139 </table>
    1140 <!--邮件发送检测-->
    1141 <table width="100%" cellpadding="3" cellspacing="0" align="center">
    1142   <tr><th colspan="3" class="th_5">邮件发送检测</th></tr>
    1143   <tr>
    1144     <td width="15%"></td>
    1145     <td width="60%">
    1146       请输入您要检测的邮件地址:
    1147       <input type="text" name="mailAdd" size="50" />
    1148     </td>
    1149     <td width="25%">
    1150     <input class="btn" type="submit" name="act" value="邮件检测" />
    1151     </td>
    1152   </tr>
    1153   <?php
    1154   if ($_POST['act'] == '邮件检测') {
    1155       echo "<script>alert('$mailRe')</script>";
    1156   }
    1157   ?>
    1158 </table>
    1159 </form>
    1160 <a id="bottom"></a>
    1161 
    1162 <div id="footer">
    1163 &copy; 2012 <a href="http://lnmp.org" target="_blank">LNMP一键安装包</a><br />This Prober was based on Yahei Prober.<br />
    1164 <?php $run_time = sprintf('%0.4f', microtime_float() - $time_start);?>
    1165 Processed in <?php echo $run_time?> seconds. <?php echo memory_usage();?> memory usage.
    1166 
    1167 </div>
    1168 
    1169 </div>
    1170 </body>
    1171 </html>
  • 相关阅读:
    Remote Procedure Call (RPC) Locator与X3
    Delphi的悬浮窗口
    改变CSS样式
    JavaScript 打印Web页面指定区域的信息
    判断页面元素存在与否
    如何处理HTML标签属性
    jQuery 获取和设置表单元素
    如何添加/移除CSS类
    处理网页内容
    正则表达式 收集
  • 原文地址:https://www.cnblogs.com/mr-amazing/p/4421482.html
Copyright © 2020-2023  润新知