求助:请问这个代码是什么意思?

q47513 2008-04-13 11:26:01
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="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;
}
-->
</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;
}
?>
...全文
312 点赞 收藏 11
写回复
11 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
phpboy 2008-10-12
顶! PHP探针
测试过了,可以用
回复
wapysun 2008-10-12
http://ip.changeip.com
回复
meiZiNick 2008-04-30
以后需再关注,现在先帮你顶一下
回复
q47513 2008-04-27
谢谢5楼
6楼那位,去Google慢慢查吧。
回复
ten789 2008-04-15
没有包含外部文件

帮你测试过了 正常
回复
boystone 2008-04-15
什么是PHP探针
回复
q47513 2008-04-14
这是PHPnow的一个用于显示主机信息的网页,里面有一个可以显示主机的外网IP的地方。
分离后得:
<?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;
}
?>


我把这个放在我现在的主机上总是显示获取失败,我又试了一下源程序,照旧。
请问它有没有调用什么外部库?
若有请说明
回复
胡爷爷 2008-04-14
同一楼PHP探针一枚!
回复
jackydrl 2008-04-14
这里面的功能多了,楼主好像是把某个整站系统的安装程序源码拷过来了,这样好像没什么针对性啊!
开头是侦测发给页面的指令,
中间是检测服务器的运行环境,
下面是自定义数据库,然后执行
回复
faisun 2008-04-13
貌似 PHP 探针
回复
相关推荐
发帖
基础编程
创建于2007-09-28

2.1w+

社区成员

从PHP安装配置,PHP入门,PHP基础到PHP应用
申请成为版主
帖子事件
创建了帖子
2008-04-13 11:26
社区公告
暂无公告