微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

phpnow php探针环境检测代码

<div class="jb51code">
<pre class="brush:PHP;">
<?PHP
/
http://PHPNow.org
YinzCN_at_Gmail.com
/

error_reporting(E_ALL);

define('TimeZone',+8.0);

function _GET($n) { return isset($_GET[$n]) ? $_GET[$n] : NULL; }
function _SERVER($n) { return isset($_SERVER[$n]) ? $_SERVER[$n] : '[undefine]'; }

if (_GET('act') == 'PHPinfo') {
if (function_exists('PHPinfo')) PHPinfo();
else echo 'PHPinfo() has been disabled.';
exit;
}

$Info = array();
$Info['PHP_ini_file'] = function_exists('PHP_ini_loaded_file') ? PHP_ini_loaded_file() : '[undefine]';

if (_GET('act') == 'getip') {
$i = _SERVER('SERVER_NAME').'|'._SERVER('REMOTE_ADDR').'|'._SERVER('SERVER_SOFTWARE').'|'.(function_exists('MysqL_close')?MysqL_get_client_info():'').'|'._SERVER('DOCUMENT_ROOT');
$c = @file_get_contents('http://PHPNow.org/myip.PHP?'.base64_encode($i));
if (preg_match('/^\d+.\d+.\d+.\d+$/',$c) == 1) echo $c;
else echo 'false';
exit;
}

function colorhost() {
$c = array('#87cefa','#ffa500','#ff6347','#9acd32','#32cd32','#ee82ee');
$a = str_split(_SERVER('SERVER_NAME'));
$k = $l = 0;
foreach ($a as &$d) {
while ($k==$l) $k = array_rand($c);
$d = '<b style="color: '.$c[$k].';">'.$d.'';
$l = $k;
}
return implode('',$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('YES','<span style="color: #008000; font-weight : bold;">Yes');
define('NO','<span style="color: #ff0000; font-weight : bold;">No');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
<html xmlns="http://www.w3.org/1999/xhtml"&gt;

<a href="https://www.jb51.cc/tag/PHP/" target="_blank" class="keywords">PHP</a><a href="https://www.jb51.cc/tag/Now/" target="_blank" class="keywords">Now</a> Works! <div style="height: 60px;">
<div style="float: right; margin: 5px; text-align: center;">

获取 IP 地址

<div style="float: left;">
<div style="font-weight: bold; font-size: 2.2em;"><a href="<?=_SERVER('PHP_SELF')?>?" style="text-decoration: none;"><?=colorhost()?>


<div style="margin: 5px auto;"># Let's <b style="color: #777BB4;">PHP <b style="color: #FF4500;">Now !


<table width="100%" class="info">
<tr>
<th colspan="2">Server information
</tr>

<tr>
<td class="item">SERVER_NAME</td>
<td><?=_SERVER('SERVER_NAME')?></td>
</tr>

<tr>
<td class="item">SERVER_ADDR:PORT</td>
<td><?=_SERVER('SERVER_ADDR').':'._SERVER('SERVER_PORT')?></td>
</tr>

<tr>
<td class="item">SERVER_SOFTWARE</td>
<td><?=stripos(_SERVER('SERVER_SOFTWARE'),'PHP')?_SERVER('SERVER_SOFTWARE'):_SERVER('SERVER_SOFTWARE').' PHP/'.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['php_ini_file']?></td>
</tr>

<tr>
<td class="item">网站主目录</td>
<td><?=_SERVER('DOCUMENT_ROOT')?></td>
</tr>

<tr>
<td class="item">Server Date / Time</td>
<td><?=gmdate('Y-m-d',time()+TimeZone3600)?> <?=gmdate('H:i:s',time()+TimeZone3600)?> <span style="color: #999999;">(<?=(TimeZone<0?'-':'+').gmdate('H:i',abs(TimeZone)*3600)?>)</td>
</tr>

<tr>
<td class="item">Other Links</td>
<td>
<a href='<?=_SERVER('PHP_SELF')?>?act=phpinfo'>phpinfo()
| <?=file_exists('phpMyAdmin') ? '<a href="/phpMyAdmin">phpMyAdmin' : '<a href="http://phpnow.org"&gt;PHPnow.org'?>
</td>
</tr>
</table>


<table width="100%" class="info">
<tr>
<th colspan="2">PHP 组件支持
</tr>

<tr>
<td class="item">Zend Optimizer</td>
<td><?=defined('OPTIMIZER_VERSION') ? YES.' / '.OPTIMIZER_VERSION : NO?></td>
</tr>

<tr>
<td class="item">MysqL 支持</td>
<td><?=function_exists('mysql_close') ? YES.' / client lib version '.mysql_get_client_info() : NO?></td>
</tr>

<tr>
<td class="item">GD library</td>
<td><?=function_exists('gd_info') ? YES.' / '.get_gd_info('GD Version') : NO?></td>
</tr>

<tr>
<td class="item">eAccelerator</td>
<td><?=function_exists('eaccelerator_info') ? YES.' / '.get_ea_info('version') : NO?></td>
</tr>
</table>


<form method="post" action="<?=_SERVER('PHP_SELF')?>">
<table width="100%" class="info">
<tr>
<th colspan="4">MysqL 连接测试
</tr>

<tr>
<td>MysqL 服务器</td>
<td></td>
<td>MysqL 数据库名</td>
<td></td>
</tr>

<tr>
<td>MysqL 用户名</td>
<td></td>
<td>MysqL 用户密码</td>
<td></td>
</tr>

<tr>
<td colspan="4" align="right"> </td>
</tr>
</table>

<?php if(isset($_POST['act'])) {?>

<table width="100%" class="info">
<tr>
<th colspan="4">MysqL 测试结果
</tr>

<?PHP
$link = @MysqL_connect($_POST['MysqLHost'],$_POST['MysqLUser'],$_POST['MysqLPassword']);
$errno = MysqL_errno();
if ($link) $str1 = '<span style="color: #008000; font-weight: bold;">OK ('.MysqL_get_server_info($link).')';
else $str1 = '<span style="color: #ff0000; font-weight: bold;">Failed
'.MysqL_error();
?>
<tr>
<td colspan="2">服务器 <?=$_POST['mysqlHost']?></td>
<td colspan="2"><?=$str1?></td>
</tr>

<tr>
<td colspan="2">数据库 <?=$_POST['mysqlDb']?></td>
<td colspan="2"><?=(@MysqL_select_db($_POST['MysqLDb'],$link))?'<span style="color: #008000; font-weight: bold;">OK':'<span style="color: #ff0000; font-weight: bold;">Failed'?></td>
</tr>
</table>
<?}?>


<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 href="http://zh.wikipedia.org/wiki/Copyleft" style="color: #008000;">Copyleft ! 2007-? by <a href="http://PHPNow.org">PHPNow.org

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐