奇迹MU在线状态代码
Published: Comment: No Comments
Last Modified:2024-09-01 23:53:50
奇迹MU在线状态代码,可用不同的颜色显示不同的在线人数
<style type="text/css">
<!--
.style6 { font-family: "Charlemagne Std";
color: #CC6633;
}
-->
</style>
Server:<span class="style6">
<?php
require 'config.php';
if ($fp=@fsockopen($host,$port,$ERROR_NO,$ERROR_STR,(float)0.1))
{
fclose($fp);
echo "<font color='green'>游戏在线</font>";
}
else
{
echo "<font color='red'>游戏关闭</font>";
}
?>
</span><br />
在线玩家:<span class="style6"> <b><font color="#FFFFFF">
<?php
$sql = mssql_query("SELECT count(*) FROM MEMB_STAT WHERE ConnectStat = '1'");
if( mssql_result($sql, 0, 0) <= 50){
echo "<font color=green>";
echo mssql_result($sql, 0, 0);}
elseif( mssql_result($sql, 0, 0) >= 50 AND mssql_result($sql, 0, 0) <= 100){
echo "<font color=darkgreen>";
echo mssql_result($sql, 0, 0);}
elseif( mssql_result($sql, 0, 0) >= 80 AND mssql_result($sql, 0, 0) <= 150){
echo "<font color=blue>";
echo mssql_result($sql, 0, 0);}
elseif( mssql_result($sql, 0, 0) >= 80 AND mssql_result($sql, 0, 0) <= 200){
echo "<font color=darkblue>";
echo mssql_result($sql, 0, 0);}
elseif( mssql_result($sql, 0, 0) >= 80 AND mssql_result($sql, 0, 0) <= 250){
echo "<font color=red>";
echo mssql_result($sql, 0, 0);}
elseif( mssql_result($sql, 0, 0) > 250){
echo "<font color=darkred>";
echo mssql_result($sql, 0, 0);} echo "";?>
</font></b></span>
<?php
$host = "127.0.0.1";
$server = "回首Mu服务器状态";
$port = "55901";
?>
以上代码的功能为先检查服务器是否开启,如果没有开启红色字体显示“游戏关闭”,如果服务器开启了,就以绿色字体显示“游戏在线”,并统计以绿、深绿、蓝、深蓝、红、深红的颜色显示当前在线玩家数量