请教PHP高手,这段代码的功能能否用ASP实现.分不多但请帮忙

killzone 2007-01-17 07:34:00
<?
$Server="广州新力量网吧CS1.6";
$DatPath="../CSServer/cstrike/addons/amx/csstats.dat";
$Top=50;
?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><?echo $Server?>-#1实时排行</title>
<body TOPMARGIN=0>
<style>
body{
font-family:Arial,sans-serif;
font-size:12px;color:#FFCC99;
background-color:#000000;margin-left:8px;
margin-top:3px }
.header{background-color:#9C0000;
}
td{
font-size:14px
}
</style>
<center>
<h3><?echo $Server?>-#1实时排行</h2>
<a href="csinfo.php" ><?echo $Server?>-#1即时状态</a> <a href="csinfo.php?ip=127.0.0.1:27015" ><?echo $Server?>-#2即时状态</a>
<br>
<table width=800 >
<tr class="header">
<th align="center">排名
<th align="center">名字
<th align="center">杀人数
<th align="center">爆头(%)
<th align="center">死
<th align="center">命中/子弹数(命中率)
<th align="center">得分(爆头*2+杀人数-死)
<?
function timer() {
global $_timer;
if(empty($_timer['start'])) {
$mtime = explode(' ', microtime());
$_timer['start'] = $mtime[1] + $mtime[0];
} else {
$mtime = explode(' ', microtime());
return number_format(($mtime[1] + $mtime[0] - $_timer['start']), 6);
}
}
timer();

function bin2int($bin)
{return ord($bin)+ord($bin[1])*256;
}
$fp=fopen($DatPath,"rb");
//if(bin2int(fread($fp,2))!=5) exit("请安装CSStats!"); //amx 0.97
if(bin2int(fread($fp,2))!=11) exit("请安装CSStats!"); //amxx1.0
for($i=1;$i<=$Top;$i++)
{if(!$namelen=bin2int(fread($fp,2))) break;//WORD名字长度(包括\0)
$bgcolor =($i % 2) ? "#310000" : "#630000";
$player=fread($fp,$namelen-1);
fseek($fp,$namelen+3,SEEK_CUR);
//$a=unpack("V15stats",fread($fp,60)); //amx 0.97
$a=unpack("V15stats",fread($fp,80)); //amxx1.0
//15个DWORD依次为1?,2Damage,3Death,4Kill,5Shots,6Hits,7Headshots,8?,9head,10chest,11stomach,12leftarm,13rightarm,14leftleg,15rightleg
echo "<tr bgcolor=$bgcolor onmouseover=this.bgColor='#9C0000'; onmouseout=this.bgColor='$bgcolor'; ><td >$i<td>$player<td>".$a["stats4"]."<td>".$a["stats7"]."(".round($a["stats7"]/$a["stats4"]*100,1)."%)<td>".$a["stats3"]."<td>".$a["stats6"]."/".$a["stats5"]."=".round($a["stats6"]/$a["stats5"]*100,1)."%)<td>".($a["stats4"]+$a["stats7"]*2-$a["stats3"]) ;
}
fclose($fp);
?></table>
<br>

<hr size=1 width=95%>

<font color=white >如有更好意见或建议请<a target=_blank href="http://nPower.vicp.net/book.asp">留言</a>!
</center>
<p align="right"><u><font face="Fixedsys">Yan Online</u>,<br><a href="http://yanexp.126.com" target=_blank title="最后更新日期Yan!"></a>
<script>document.write(document.lastModified);</script><br>
...全文
205 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
killzone 2007-01-18
  • 打赏
  • 举报
回复
没有高手了吗
killzone 2007-01-17
  • 打赏
  • 举报
回复
我看了 有个exe 能调用 csstats.dat 好像VB做的 那么ASP怎么去调用这个库

21,886

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧