当前位置:Gxlcms > PHP教程 > phpnowphp探针环境检测代码_PHP

phpnowphp探针环境检测代码_PHP

时间:2021-07-01 10:21:17 帮助过:46人阅读

PHPNow

<?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 = ''.$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', 'Yes');
define('NO', 'No');
?>



PHPnow Works!











 
  为何只能本地访问?
  正在获取 IP 地址
 

 
  ?" style="text-decoration: none;"><?=colorhost()?>
  # Let's PHP now !
 



Server Information
SERVER_NAME <?=_SERVER('SERVER_NAME')?>
SERVER_ADDR:PORT <?=_SERVER('SERVER_ADDR').':'._SERVER('SERVER_PORT')?>
SERVER_SOFTWARE <?=stripos(_SERVER('SERVER_SOFTWARE'), 'PHP')?_SERVER('SERVER_SOFTWARE'):_SERVER('SERVER_SOFTWARE').' PHP/'.PHP_VERSION?>
PHP_SAPI <?=PHP_SAPI?>
php.ini <?=$Info['php_ini_file']?>
网站主目录 <?=_SERVER('DOCUMENT_ROOT')?>
Server Date / Time <?=gmdate('Y-m-d', time()+TimeZone*3600)?> <?=gmdate('H:i:s', time()+TimeZone*3600)?> (<?=(TimeZone<0?'-':'+').gmdate('H:i', abs(TimeZone)*3600)?>)
Other Links ?act=phpinfo'>phpinfo() | <?=file_exists('phpMyAdmin') ? 'phpMyAdmin' : 'PHPnow.org'?>

PHP 组件支持
Zend Optimizer <?=defined('OPTIMIZER_VERSION') ? YES.' / '.OPTIMIZER_VERSION : NO?>
MySQL 支持 <?=function_exists('mysql_close') ? YES.' / client lib version '.mysql_get_client_info() : NO?>
GD library <?=function_exists('gd_info') ? YES.' / '.get_gd_info('GD Version') : NO?>
eAccelerator <?=function_exists('eaccelerator_info') ? YES.' / '.get_ea_info('version') : NO?>

<?php if(isset($_POST['act'])) {?>
<?php $link = @mysql_connect($_POST['mysqlHost'], $_POST['mysqlUser'], $_POST['mysqlPassword']); $errno = mysql_errno(); if ($link) $str1 = 'OK ('.mysql_get_server_info($link).')'; else $str1 = 'Failed
'.mysql_error(); ?>
MySQL 测试结果
服务器 <?=$_POST['mysqlHost']?> <?=$str1?>
数据库 <?=$_POST['mysqlDb']?> <?=(@mysql_select_db($_POST['mysqlDb'],$link))?'OK':'Failed'?>
<?}?>

Valid XHTML 1.0 Strict / Copyleft ! 2007-? by PHPnow.org

人气教程排行