phpnow php探针环境检测代码,phpnow探针

PHP中文网
发布: 2023-02-28 18:00:02
原创
2346 人浏览过

phpnow php探针环境检测代码,phpnow探针

<?php
/*
 http://phpnow.org
 YinzCN_at_Gmail.com
*/
 
error_reporting(E_ALL);
 
define(&#39;TimeZone&#39;, +8.0);
 
function _GET($n) { return isset($_GET[$n]) ? $_GET[$n] : NULL; }
function _SERVER($n) { return isset($_SERVER[$n]) ? $_SERVER[$n] : &#39;[undefine]&#39;; }
 
if (_GET(&#39;act&#39;) == &#39;phpinfo&#39;) {
 if (function_exists(&#39;phpinfo&#39;)) phpinfo();
 else echo &#39;phpinfo() has been disabled.&#39;;
 exit;
}
 
$Info = array();
$Info[&#39;php_ini_file&#39;] = function_exists(&#39;php_ini_loaded_file&#39;) ? php_ini_loaded_file() : &#39;[undefine]&#39;;
 
if (_GET(&#39;act&#39;) == &#39;getip&#39;) {
 $i = _SERVER(&#39;SERVER_NAME&#39;).&#39;|&#39;._SERVER(&#39;REMOTE_ADDR&#39;).&#39;|&#39;._SERVER(&#39;SERVER_SOFTWARE&#39;).&#39;|&#39;.
 (function_exists(&#39;mysql_close&#39;)?mysql_get_client_info():&#39;&#39;).&#39;|&#39;._SERVER(&#39;DOCUMENT_ROOT&#39;);
 $c = @file_get_contents(&#39;http://phpnow.org/myip.php?&#39;.base64_encode($i));
 if (preg_match(&#39;/^\d+\.\d+\.\d+\.\d+$/&#39;, $c) == 1) echo $c;
 else echo &#39;false&#39;;
 exit;
}
 
function colorhost() {
 $c = array(&#39;#87cefa&#39;, &#39;#ffa500&#39;, &#39;#ff6347&#39;, &#39;#9acd32&#39;, &#39;#32cd32&#39;, &#39;#ee82ee&#39;);
 $a = str_split(_SERVER(&#39;SERVER_NAME&#39;));
 $k = $l = 0;
 foreach ($a as &$d) {
  while ($k==$l) $k = array_rand($c);
  $d = &#39;<b style="color: &#39;.$c[$k].&#39;;">&#39;.$d.&#39;</b>&#39;;
  $l = $k;
 }
 return implode(&#39;&#39;, $a);
}
 
function get_ea_info($name) { $ea_info = eaccelerator_info(); return $ea_info[$name]; }
function get_gd_info($name) { $gd_info = gd_info(); return $gd_info[$name]; }
 
define(&#39;YES&#39;, &#39;<span style="color: #008000; font-weight : bold;">Yes</span>&#39;);
define(&#39;NO&#39;, &#39;<span style="color: #ff0000; font-weight : bold;">No</span>&#39;);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>PHPnow Works!</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="author" content="YinzCN" />
<meta name="reply-to" content="YinzCN@Gmail.com" />
<meta name="copyright" content="YinzCN" />
<style type="text/css">
<!--
body {
font-family : verdana, tahoma;
font-size : 12px;
margin-top : 10px;
}
 
form {
margin : 0;
}
 
table {
border-collapse : collapse;
}
 
.info tr td {
border : 1px solid #000000;
padding : 3px 10px 3px 10px ;
}
 
.info th {
border : 1px solid #000000;
font-weight : bold;
height : 16px;
padding : 3px 10px 3px 10px;
background-color : #9acd32;
}
 
input {
border : 1px solid #000000;
background-color : #fafafa;
}
 
a {
text-decoration : none;
color : #000000;
}
 
a:hover {
text-decoration : underline;
}
 
a.arrow {
font-family : webdings, sans-serif;
font-size : 10px;
}
 
a.arrow:hover {
color : #ff0000;
text-decoration : none;
}
 
.item {
white-space: nowrap;
text-align: right;
}
-->
</style>
<script type="text/JavaScript">
function $(id) { return document.getElementById(id); }
 
function get_ip() {
 var XMLHttp, r;
 XMLHttp = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");
 XMLHttp.onreadystatechange = function() {
  if (XMLHttp.readyState == 4)
  {
   r = XMLHttp.responseText;
   if (r == &#39;false&#39;) $(&#39;ip_r&#39;).innerHTML = &#39;获取外网 IP 失败!&#39;;
   else $(&#39;ip_r&#39;).innerHTML = &#39;此服务器互联网 IP<br /><a href="http://&#39;+r+&#39;" style="color: #999999;">&#39;+r+&#39;</a>&#39;;
  }
 }
 XMLHttp.open("GET", "?act=getip", true);
 XMLHttp.send();
}
</script>
</head>
<body onload="get_ip();">
<div style="margin: 0 auto; width: 600px;">
 
<div style="height: 60px;">
 <div style="float: right; margin: 5px; text-align: center;">
  <div><a style="color: #ffa500;" href="http://phpnow.org/go.php?id=1005">为何只能本地访问?</a></div>
  <div id="ip_r" style="color: #999999;">正在获取 IP 地址</div>
 </div>
 
 <div style="float: left;">
  <div style="font-weight: bold; font-size: 2.2em;">
  <a href="<?=_SERVER(&#39;PHP_SELF&#39;)?>?" style="text-decoration: none;"><?=colorhost()?></a></div>
  <div style="margin: 5px auto;"># Let&#39;s <b style="color: #777BB4;">PHP</b> 
  <b style="color: #FF4500;">now</b> <b>!</b></div>
 </div>
</div>
 
<br />
 
<table width="100%" class="info">
 <tr>
  <th colspan="2">Server Information</th>
 </tr>
 
 <tr>
  <td class="item">SERVER_NAME</td>
  <td><?=_SERVER(&#39;SERVER_NAME&#39;)?></td>
 </tr>
 
 <tr>
  <td class="item">SERVER_ADDR:PORT</td>
  <td><?=_SERVER(&#39;SERVER_ADDR&#39;).&#39;:&#39;._SERVER(&#39;SERVER_PORT&#39;)?></td>
 </tr>
 
 <tr>
  <td class="item">SERVER_SOFTWARE</td>
  <td><?=stripos(_SERVER(&#39;SERVER_SOFTWARE&#39;), &#39;PHP&#39;)?_SERVER(&#39;SERVER_SOFTWARE&#39;):_SERVER(&#39;SERVER_SOFTWARE&#39;).
  &#39; PHP/&#39;.PHP_VERSION?></td>
 </tr>
 
 <tr>
  <td class="item">PHP_SAPI</td>
  <td><?=PHP_SAPI?></td>
 </tr>
 
 <tr>
  <td class="item" style="color: #ff0000;">php.ini</td>
  <td><?=$Info[&#39;php_ini_file&#39;]?></td>
 </tr>
 
 <tr>
  <td class="item">网站主目录</td>
  <td><?=_SERVER(&#39;DOCUMENT_ROOT&#39;)?></td>
 </tr>
 
 <tr>
  <td class="item">Server Date / Time</td>
  <td><?=gmdate(&#39;Y-m-d&#39;, time()+TimeZone*3600)?> <?=gmdate(&#39;H:i:s&#39;, time()+TimeZone*3600)?> 
  <span style="color: #999999;">(<?=(TimeZone<0?&#39;-&#39;:&#39;+&#39;).gmdate(&#39;H:i&#39;, abs(TimeZone)*3600)?>)</span></td>
 </tr>
 
 <tr>
  <td class="item">Other Links</td>
  <td>
  <a href=&#39;<?=_SERVER(&#39;PHP_SELF&#39;)?>?act=phpinfo&#39;>phpinfo()</a>
  | <?=file_exists(&#39;phpMyAdmin&#39;) ? &#39;<a href="/phpMyAdmin">phpMyAdmin</a>&#39; : 
  &#39;<a href="http://phpnow.org">PHPnow.org</a>&#39;?>
  </td>
 </tr>
</table>
 
<hr />
 
<table width="100%" class="info">
 <tr>
  <th colspan="2">PHP 组件支持</th>
 </tr>
 
 <tr>
  <td class="item">Zend Optimizer</td>
  <td><?=defined(&#39;OPTIMIZER_VERSION&#39;) ? YES.&#39; / &#39;.OPTIMIZER_VERSION : NO?></td>
 </tr>
 
 <tr>
  <td class="item">MySQL 支持</td>
  <td><?=function_exists(&#39;mysql_close&#39;) ? YES.&#39; / client lib version &#39;.mysql_get_client_info() : NO?></td>
 </tr>
 
 <tr>
  <td class="item">GD library</td>
  <td><?=function_exists(&#39;gd_info&#39;) ? YES.&#39; / &#39;.get_gd_info(&#39;GD Version&#39;) : NO?></td>
 </tr>
 
 <tr>
  <td class="item">eAccelerator</td>
  <td><?=function_exists(&#39;eaccelerator_info&#39;) ? YES.&#39; / &#39;.get_ea_info(&#39;version&#39;) : NO?></td>
 </tr>
</table>
 
<hr />
 
<form method="post" action="<?=_SERVER(&#39;PHP_SELF&#39;)?>">
<table width="100%" class="info">
 <tr>
  <th colspan="4">MySQL 连接测试</th>
 </tr>
 
 <tr>
  <td>MySQL 服务器</td>
  <td><input type="text" name="mysqlHost" value="localhost" /></td>
  <td>MySQL 数据库名</td>
  <td><input type="text" name="mysqlDb" value="test" /></td>
 </tr>
 
 <tr>
  <td>MySQL 用户名</td>
  <td><input type="text" name="mysqlUser" value="root" /></td>
  <td>MySQL 用户密码</td>
  <td><input type="text" name="mysqlPassword" /></td>
 </tr>
 
 <tr>
  <td colspan="4" align="right"><input type="submit" value="连接" name="act" />  </td>
 </tr>
</table>
</form>
 
<?php if(isset($_POST[&#39;act&#39;])) {?>
<br />
 
<table width="100%" class="info">
 <tr>
  <th colspan="4">MySQL 测试结果</th>
 </tr>
 
<?php
$link = @mysql_connect($_POST[&#39;mysqlHost&#39;], $_POST[&#39;mysqlUser&#39;], $_POST[&#39;mysqlPassword&#39;]);
$errno = mysql_errno();
if ($link) $str1 = &#39;<span style="color: #008000; 
font-weight: bold;">OK</span> (&#39;.mysql_get_server_info($link).&#39;)&#39;;
else $str1 = &#39;<span style="color: #ff0000; font-weight: bold;">Failed</span><br />&#39;.mysql_error();
?>
 <tr>
  <td colspan="2">服务器 <?=$_POST[&#39;mysqlHost&#39;]?></td>
  <td colspan="2"><?=$str1?></td>
 </tr>
 
 <tr>
  <td colspan="2">数据库 <?=$_POST[&#39;mysqlDb&#39;]?></td>
  <td colspan="2"><?=(@mysql_select_db($_POST[&#39;mysqlDb&#39;],$link))?&#39;
  <span style="color: #008000; font-weight: bold;">OK</span>&#39;:&#39;
  <span style="color: #ff0000; font-weight: bold;">Failed</span>&#39;?></td>
 </tr>
</table>
<?}?>
<hr />
 
<p style="text-align: right; margin: 0;">
<a href="http://validator.w3.org/check?uri=referer" style="color: #999999;">Valid XHTML 1.0 Strict</a> / 
<a href="http://zh.wikipedia.org/wiki/Copyleft" style="color: #008000;">
<b>Copyleft</b></a> ! 2007-? by <a href="http://phpnow.org">PHPnow.org</a></p>
 
</div>
</body>
</html>
登录后复制

 以上就是phpnow php探针环境检测代码,phpnow探针的内容,更多相关内容请关注PHP中文网(www.php.cn)!

来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板