HIKARUKAI 發表於 2010-5-27 07:57:59

fix Starsgames Control Panel 4.6.2 入面線上人數的問題

將header_bar.php入面的文字換做下面的就可以了

<?php
if(!$SERVER['system_safe'])
    header("location:index.php?act=idx");
if ($CONFIG_check_server) {
    if ($CONFIG_maintenance) {
      $accsrv = "<font class=\"status_main\">$lang</font>";
      $charsrv = "<font class=\"status_main\">$lang</font>";
      $mapsrv = "<font class=\"status_main\">$lang</font>";
      $total_online = "<font class=\"status_main\">N/A</font>";
    } else {
      $query = "SELECT * FROM $CONFIG_sql_cpdbname.status";
      $sql->result = $sql->execute_query($query,'header_bar.php',0);$sql->total_query++;
      if (!$sql->count_rows()) {
            $sql->result = $sql->execute_query("INSERT INTO $CONFIG_sql_cpdbname.status ( `last_checked` , `login` , `char` , `map` ) VALUES (NOW() , 0, 0, 0)",'header_bar.php',0);$sql->total_query++;
      }
      $line = $sql->fetch_row();
      $timediff = $CP - $line;
      if($timediff > $CONFIG_time_check_intervals) {
            $acc = @fsockopen ($CONFIG_server_ip, $CONFIG_loginport, $errno, $errstr, 1);
            $char = @fsockopen ($CONFIG_server_ip, $CONFIG_charport, $errno, $errstr, 1);
            $map = @fsockopen ($CONFIG_server_ip, $CONFIG_mapport, $errno, $errstr, 1);
            $acc = $acc?1:0;
            $char = $char?1:0;
            $map = $map?1:0;
            $sql->execute_query("UPDATE $CONFIG_sql_cpdbname.status SET `last_checked` = \"$CP\" ,`login` = \"$acc\",`char` = \"$char\",`map` = \"$map\"",'header_bar.php',0);$sql->total_query++;
      } else {
            $acc = $line;
            $char = $line;
            $map = $line;
      }
      if (!$acc) {
            $accsrv="<font class=\"status_off\">$lang</font>";
      } else {
            $accsrv="<font class=\"status_on\">$lang</font>";
      }
      if (!$char) {
            $charsrv="<font class=\"status_off\">$lang</font>";
      } else {
            $charsrv="<font class=\"status_on\">$lang</font>";
      }
      if (!$map) {
            $mapsrv="<font class=\"status_off\">$lang</font>";
      } else {
            $mapsrv="<font class=\"status_on\">$lang</font>";
      }
include "config.php";
$link = mysql_connect($CONFIG_sql_host,$CONFIG_sql_username,$CONFIG_sql_password);
@mysql_select_db($CONFIG['sql_dbname'],$link);
      $query = "SELECT COUNT(*) as total FROM `char` WHERE online = '1'";
      //$sql->result = $sql->execute_query($query,'header_bar.php',0);$sql->total_query++;
      //$row = $sql->fetch_row();
      $result = mysql_query($query,$link);
         mysql_close($sql);
      $arr = mysql_fetch_array($result);
      $total_online =$arr["total"];
      
if( !$total_online ){ $total_online = '0';}
   {

      }
    }
} else {
    $accsrv = "<font class=\"status_hide\">$lang</font>";
    $charsrv = "<font class=\"status_hide\">$lang</font>";
    $mapsrv = "<font class=\"status_hide\">$lang</font>";
    $total_online = "<font class=\"status_hide\">N/A</font>";
}
?>

vul31p4d93 發表於 2012-7-19 13:17:30

本帖最後由 vul31p4d93 於 2012-7-19 01:20 PM 編輯

<?php
if(!$SERVER['system_safe']):
    header("location:index.php?act=idx");
if ($CONFIG_check_server) {
    if ($CONFIG_maintenance) {
      $accsrv = "<font class=\"status_main\">$lang</font>";
      $charsrv = "<font class=\"status_main\">$lang</font>";
      $mapsrv = "<fontclass=\"status_main\">$lang</font>";
      $total_online = "<font class=\"status_main\">N/A</font>";
    } else {
      $query = "SELECT * FROM $CONFIG_sql_cpdbname.status";
      $sql->result ==$sql->execute_query($query,'header_bar.php',0);$sql->total_query++;
      if (!$sql->count_rows()) { $sql->result = $sql->execute_query("INSERT INTO $CONFIG_sql_cpdbname.status ( `last_checked` , `login` , `char` , `map` ) VALUES (NOW() , 0, 0, 0)",'header_bar.php',0);$sql->total_query++;1 }
   $line = $sql->fetch_row();
   $timediff = $CP - $line;
   if($timediff > $CONFIG_time_check_intervals) {
$acc = @fsockopen ($CONFIG_server_ip, $CONFIG_loginport, $errno, $errstr, 1); $char = @fsockopen ($CONFIG_server_ip, $CONFIG_charport, $errno, $errstr, 1);
$map = @fsockopen ($CONFIG_server_ip, $CONFIG_mapport, $errno, $errstr, 1);
            $acc = $acc?1:0;
            $char = $char?1:0;
            $map = $map?1:0;
$sql->execute_query("UPDATE $CONFIG_sql_cpdbname.status SET `last_checked` = \"$CP\" ,`login` = \"$acc\",`char` = \"$char\",`map` = \"$map\"",'header_bar.php',0);$sql->total_query++;2 }
      } else {
            $acc = $line;
            $char = $line;
            $map = $line;      }
      if (!$acc) {
            $accsrv="<font class=\"status_off\">$lang</font>";
      } else {
            $accsrv="<font class=\"status_on\">$lang</font>";
      }
      if (!$char) {
            $charsrv="<font class=\"status_off\">$lang</font>";
      } else {
            $charsrv="<font class=\"status_on\">$lang</font>";       }
      if (!$map) {
            $mapsrv="<font class=\"status_off\">$lang</font>";
      } else {
            $mapsrv="<font class=\"status_on\">$lang</font>";      }
include "config.php";
$link = mysql_connect($CONFIG_sql_host,$CONFIG_sql_username,$CONFIG_sql_password)
@mysql_select_db($CONFIG['sql_dbname'],$link);
      $query = "SELECT COUNT(*) as total FROM `char` WHERE online = '1'";
      //$sql->result = $sql->execute_query($query,'header_bar.php',0);$sql->total_query++;
      //$row = $sql->fetch_row();
      $result = mysql_query($query,$link);
         mysql_close($sql);
      $arr = mysql_fetch_array($result);
      $total_online =$arr["total"]
if( !$total_online ){ $total_online = '0';}
   {
}
    }
} else {
    $accsrv = "<font class=\"status_hide\">$lang</font>";
    $charsrv = "<font class=\"status_hide\">$lang</font>";
    $mapsrv = "<font class=\"status_hide\">$lang</font>";
    $total_online = "<font class=\"status_hide\">N/A</font>";
}
?>



無亂碼的修改
還有人要用嗎?
頁: [1]
查看完整版本: fix Starsgames Control Panel 4.6.2 入面線上人數的問題