RT<?php
@header("content-Type: text/html; charset=utf-8");
error_reporting(E_ALL);
//set_time_limit(10);
define("YES","<span style=\"color: #008000;font-weight : bold;\">Yes</span>");
define("NO","<span style=\"color: #ff0000;font-weight : bold;\">No</span>");
$act=isset($_GET['act'])?$_GET['act']:"";
if($act=="phpinfo"){phpinfo();exit();}
?>
<!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="[email protected]" />
<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;
}
-->
</style>
</head>
<body>
<div style="margin-left: auto;margin-right: auto;width: 600px;"><script type="text/JavaScript">
function get_ip() {
document.getElementById("getipButton").disabled = true;
document.getElementById("ip").innerHTML = '请稍后 ...';
window.location = ('?act=getip');
}
</script><div style="width: 100px; float: right; padding: 4px;text-align: center;">
<input type="button" value="获取外网 IP" onclick="get_ip();" id="getipButton" />
<span id="ip">
<?php
if($act=='getip'){
$ip=get_ip();
$tmp=$_SERVER['SERVER_PORT'];
$tmp=$tmp==80?"":":".$tmp;
if($ip)echo '此服务器外网 IP<br /><a href="http://'.$ip.$tmp.'">'.$ip.'</a>';
else echo '<br />获取失败';
}
?>
</span></div><table style="text-align: center;">
<tr><td>
<span style="font-weight: bold;font-size: 2.2em;">
<a href="<?=$_SERVER['PHP_SELF']?>?" style="text-decoration: none;">
<?php
$c=array("87cefa","ffa500","ff6347","9acd32","32cd32","ee82ee");$s=ucfirst($_SERVER['SERVER_NAME']);
$a=explode(".",$s);
if($a[0]=="Www"||$a[0]=="Bbs"){
$a[1]=ucwords($a[1]);
$a[0]=strtolower($a[0]);
}$ran = rand(0, count($c));
$s=implode(".",$a);$s=preg_replace("/([a-zA-Z]+|[0-9]+)/","<span style=\"color: #".$c[rand(0, count($c))%count($c)]."\">\$1</span>",$s,1);//rand(0, count($c))
for($i=1;$i<=24;$i++)$s=preg_replace("/>([a-zA-Z]+|[0-9]+|\.|-)([^<]*$)/","><span style=\"color: #".$c[($i+$ran)%count($c)].";\">\$1</span>$2",$s,1);
echo $s;
?>
</a><br />
</span>
+ Powered by PHPnow 1.4 +
</td>
</tr>
</table><br /><table width="100%" class="info"> <tr>
<th colspan="2">Server Information</th>
</tr> <tr>
<td>主机名 (IP:端口)</td>
<td><?=$_SERVER['SERVER_NAME']?> (<?=$_SERVER['SERVER_ADDR'].":".$_SERVER['SERVER_PORT']?>)</td>
</tr> <tr>
<td>服务器软件</td>
<td><?=$_SERVER['SERVER_SOFTWARE']?></td>
</tr> <tr>
<td>PHP 运行方式</td>
<td><?=PHP_SAPI?></td>
</tr> <tr>
<td>网站主目录</td>
<td><?=$_SERVER["DOCUMENT_ROOT"]?></td>
</tr> <tr>
<td>服务器时间</td>
<td><?=gmdate("Y-m-d H:i:s", time()+8*60*60)?> <span style="color: #999999;">(+08:00)</span></td>
</tr> <tr>
<td>Other Links</td>
<td>
<a href='<?=$_SERVER['PHP_SELF']?>?act=phpinfo'>phpinfo()</a>
| <?=file_exists('phpMyAdmin')?"<a href='/phpMyAdmin'>phpMyAdmin</a>":"<a href='http://phpnow.org'>PHPnow.org</a>"?>
</td>
</tr>
</table><hr /><table width="100%" class="info">
<tr>
<th colspan="2">PHP 组件支持</th>
</tr> <tr>
<td>Zend Optimizer</td>
<td><?=defined("OPTIMIZER_VERSION")?YES." / ".OPTIMIZER_VERSION:NO?></td>
</tr> <tr>
<td>MySQL 支持</td>
<td><?=function_exists("mysql_close")?YES." / client lib version ".mysql_get_client_info():NO?></td>
</tr> <tr>
<td>GD library</td>
<td><?=function_exists("gd_info")?YES." / ".get_gd_info("GD Version"):NO?></td>
</tr> <tr>
<td>eAccelerator</td>
<td><?=function_exists('eaccelerator_info')?YES." / ".get_ea_info("version"):NO?></td>
</tr>
</table><hr /><form method="post" action="<?=$_SERVER['PHP_SELF']?>">
<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['act'])) {?>
<br /><table width="100%" class="info">
<tr>
<th colspan="4">MySQL 测试结果</th>
</tr><?php
$link=@mysql_connect($_POST['mysqlHost'],$_POST['mysqlUser'],$_POST['mysqlPassword']);
$errno=mysql_errno();
if($link)$str1='<span style="color: #008000;">连接正常</span> ('.mysql_get_server_info($link).')';
else $str1='<span style="color: #ff0000;">连接失败</span><br />'.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\">连接正常</span>":"<span style=\"color: #ff0000;\">连接失败</span>"?></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://wiki.w3china.org/wiki/index.php/Copyleft" style="color: #008000;"><b>Copyleft</b></a> ! 2007 - ? <a href="http://phpnow.org">PHPnow.org</a></p></div>
</body>
</html>
<?php
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];}
function get_ip(){
$c=@file_get_contents('http://phpnow.org/myip.php');
//$c = file_get_contents('http://ip.changeip.com:8245');
//$c = substr($c, 0, strpos($c, 13));
return $c;
}
?>
@header("content-Type: text/html; charset=utf-8");
error_reporting(E_ALL);
//set_time_limit(10);
define("YES","<span style=\"color: #008000;font-weight : bold;\">Yes</span>");
define("NO","<span style=\"color: #ff0000;font-weight : bold;\">No</span>");
$act=isset($_GET['act'])?$_GET['act']:"";
if($act=="phpinfo"){phpinfo();exit();}
?>
<!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="[email protected]" />
<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;
}
-->
</style>
</head>
<body>
<div style="margin-left: auto;margin-right: auto;width: 600px;"><script type="text/JavaScript">
function get_ip() {
document.getElementById("getipButton").disabled = true;
document.getElementById("ip").innerHTML = '请稍后 ...';
window.location = ('?act=getip');
}
</script><div style="width: 100px; float: right; padding: 4px;text-align: center;">
<input type="button" value="获取外网 IP" onclick="get_ip();" id="getipButton" />
<span id="ip">
<?php
if($act=='getip'){
$ip=get_ip();
$tmp=$_SERVER['SERVER_PORT'];
$tmp=$tmp==80?"":":".$tmp;
if($ip)echo '此服务器外网 IP<br /><a href="http://'.$ip.$tmp.'">'.$ip.'</a>';
else echo '<br />获取失败';
}
?>
</span></div><table style="text-align: center;">
<tr><td>
<span style="font-weight: bold;font-size: 2.2em;">
<a href="<?=$_SERVER['PHP_SELF']?>?" style="text-decoration: none;">
<?php
$c=array("87cefa","ffa500","ff6347","9acd32","32cd32","ee82ee");$s=ucfirst($_SERVER['SERVER_NAME']);
$a=explode(".",$s);
if($a[0]=="Www"||$a[0]=="Bbs"){
$a[1]=ucwords($a[1]);
$a[0]=strtolower($a[0]);
}$ran = rand(0, count($c));
$s=implode(".",$a);$s=preg_replace("/([a-zA-Z]+|[0-9]+)/","<span style=\"color: #".$c[rand(0, count($c))%count($c)]."\">\$1</span>",$s,1);//rand(0, count($c))
for($i=1;$i<=24;$i++)$s=preg_replace("/>([a-zA-Z]+|[0-9]+|\.|-)([^<]*$)/","><span style=\"color: #".$c[($i+$ran)%count($c)].";\">\$1</span>$2",$s,1);
echo $s;
?>
</a><br />
</span>
+ Powered by PHPnow 1.4 +
</td>
</tr>
</table><br /><table width="100%" class="info"> <tr>
<th colspan="2">Server Information</th>
</tr> <tr>
<td>主机名 (IP:端口)</td>
<td><?=$_SERVER['SERVER_NAME']?> (<?=$_SERVER['SERVER_ADDR'].":".$_SERVER['SERVER_PORT']?>)</td>
</tr> <tr>
<td>服务器软件</td>
<td><?=$_SERVER['SERVER_SOFTWARE']?></td>
</tr> <tr>
<td>PHP 运行方式</td>
<td><?=PHP_SAPI?></td>
</tr> <tr>
<td>网站主目录</td>
<td><?=$_SERVER["DOCUMENT_ROOT"]?></td>
</tr> <tr>
<td>服务器时间</td>
<td><?=gmdate("Y-m-d H:i:s", time()+8*60*60)?> <span style="color: #999999;">(+08:00)</span></td>
</tr> <tr>
<td>Other Links</td>
<td>
<a href='<?=$_SERVER['PHP_SELF']?>?act=phpinfo'>phpinfo()</a>
| <?=file_exists('phpMyAdmin')?"<a href='/phpMyAdmin'>phpMyAdmin</a>":"<a href='http://phpnow.org'>PHPnow.org</a>"?>
</td>
</tr>
</table><hr /><table width="100%" class="info">
<tr>
<th colspan="2">PHP 组件支持</th>
</tr> <tr>
<td>Zend Optimizer</td>
<td><?=defined("OPTIMIZER_VERSION")?YES." / ".OPTIMIZER_VERSION:NO?></td>
</tr> <tr>
<td>MySQL 支持</td>
<td><?=function_exists("mysql_close")?YES." / client lib version ".mysql_get_client_info():NO?></td>
</tr> <tr>
<td>GD library</td>
<td><?=function_exists("gd_info")?YES." / ".get_gd_info("GD Version"):NO?></td>
</tr> <tr>
<td>eAccelerator</td>
<td><?=function_exists('eaccelerator_info')?YES." / ".get_ea_info("version"):NO?></td>
</tr>
</table><hr /><form method="post" action="<?=$_SERVER['PHP_SELF']?>">
<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['act'])) {?>
<br /><table width="100%" class="info">
<tr>
<th colspan="4">MySQL 测试结果</th>
</tr><?php
$link=@mysql_connect($_POST['mysqlHost'],$_POST['mysqlUser'],$_POST['mysqlPassword']);
$errno=mysql_errno();
if($link)$str1='<span style="color: #008000;">连接正常</span> ('.mysql_get_server_info($link).')';
else $str1='<span style="color: #ff0000;">连接失败</span><br />'.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\">连接正常</span>":"<span style=\"color: #ff0000;\">连接失败</span>"?></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://wiki.w3china.org/wiki/index.php/Copyleft" style="color: #008000;"><b>Copyleft</b></a> ! 2007 - ? <a href="http://phpnow.org">PHPnow.org</a></p></div>
</body>
</html>
<?php
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];}
function get_ip(){
$c=@file_get_contents('http://phpnow.org/myip.php');
//$c = file_get_contents('http://ip.changeip.com:8245');
//$c = substr($c, 0, strpos($c, 13));
return $c;
}
?>
分离后得:
<?php
@header("content-Type: text/html; charset=utf-8");
error_reporting(E_ALL);
$act=isset($_GET['act'])?$_GET['act']:"";
?>
<!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>Leo's Host</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<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;
}
-->
</style>
</head>
<body>
<script type="text/JavaScript">
function get_ip() {
document.getElementById("getipButton").disabled = true;
document.getElementById("ip").innerHTML = '请稍后 ...';
window.location = ('?act=getip');
}
</script><div style="width: 100px; float: right; padding: 4px;text-align: center;">
<input type="button" value="获取外网 IP" onclick="get_ip();" id="getipButton" />
<span id="ip">
<?php
if($act=='getip'){
$ip=get_ip();
$tmp=$_SERVER['SERVER_PORT'];
$tmp=$tmp==80?"":":".$tmp;
if($ip)echo '此服务器外网 IP<br /><a href="http://'.$ip.$tmp.'">'.$ip.'</a>';
else echo '<br />获取失败';
}
?>
</span>
</div><table width="100%" class="info"> <tr>
<th colspan="2">Server Information</th>
</tr> <tr>
<td>主机名 (IP:端口)</td>
<td><?=$_SERVER['SERVER_NAME']?> (<?=$_SERVER['SERVER_ADDR'].":".$_SERVER['SERVER_PORT']?>)</td>
</tr> <tr>
<td>网站主目录</td>
<td><?=$_SERVER["DOCUMENT_ROOT"]?></td>
</tr></table></body>
</html>
<?php
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];}
function get_ip(){
$c=@file_get_contents('http://phpnow.org/myip.php');
//$c = file_get_contents('http://ip.changeip.com:8245');
//$c = substr($c, 0, strpos($c, 13));
return $c;
}
?>我把这个放在我现在的主机上总是显示获取失败,我又试了一下源程序,照旧。
请问它有没有调用什么外部库?
若有请说明
6楼那位,去Google慢慢查吧。
测试过了,可以用