Changeset 19 for minimanager/stat.php


Ignore:
Timestamp:
Aug 13, 2007, 9:05:34 PM (17 years ago)
Author:
george
Message:

Aktualizace MaNGOS Minimanageru na verzi 0.1.4a.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • minimanager/stat.php

    r5 r19  
    5555);
    5656
    57  $mysql = new MySQL;
    58  $mysql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);
    59  $query = $mysql->query("SELECT count(*) FROM account UNION SELECT count(*) FROM account WHERE gmlevel > 0");
    60  $total_acc = $mysql->result($query,0);
    61  $total_gms = $mysql->result($query,1);
     57 $sql = new SQL;
     58 $sql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);
     59 $query = $sql->query("SELECT count(*) FROM account UNION SELECT count(*) FROM account WHERE gmlevel > 0");
     60 $total_acc = $sql->result($query,0);
     61 $total_gms = $sql->result($query,1);
    6262
    63  $mysql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
    64  $query = $mysql->query("SELECT count(*) FROM `character`");
    65  $total_chars = $mysql->result($query,0);
     63 $sql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
     64 $query = $sql->query("SELECT count(*) FROM `character`");
     65 $total_chars = $sql->result($query,0);
    6666 
    67  $query = $mysql->query("SELECT AVG(uptime)/60,MAX(uptime)/60,(100*SUM(uptime)/(UNIX_TIMESTAMP()-MIN(starttime))) FROM uptime");
    68  $uptime = $mysql->fetch_row($query);
     67 $query = $sql->query("SELECT AVG(uptime)/60,MAX(uptime)/60,(100*SUM(uptime)/(UNIX_TIMESTAMP()-MIN(starttime))) FROM uptime");
     68 $uptime = $sql->fetch_row($query);
    6969 
    7070 if ($total_chars){
    7171 
    72  $order_race = (isset($_GET['race'])) ? "AND race =".$mysql->quote_smart($_GET['race']) : "";
    73  $order_class = (isset($_GET['class'])) ? "AND class =".$mysql->quote_smart($_GET['class']) : "";
     72 $order_race = (isset($_GET['race'])) ? "AND race =".$sql->quote_smart($_GET['race']) : "";
     73 $order_class = (isset($_GET['class'])) ? "AND class =".$sql->quote_smart($_GET['class']) : "";
    7474
    7575 if(isset($_GET['level'])){
    76         $lvl_min = $mysql->quote_smart($_GET['level']);
     76        $lvl_min = $sql->quote_smart($_GET['level']);
    7777        $lvl_max = $lvl_min + 4;
    7878        $order_level = "AND SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 35), ' ', -1) >= $lvl_min AND SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 35), ' ', -1) <= $lvl_max";
     
    8080       
    8181 if(isset($_GET['side'])) {
    82         if ($mysql->quote_smart($_GET['side']) == "h") $order_side = "AND race IN(2,5,6,8,10)";
    83                 elseif ($mysql->quote_smart($_GET['side']) == "a") $order_side = "AND race IN (1,3,4,7,11)";
     82        if ($sql->quote_smart($_GET['side']) == "h") $order_side = "AND race IN(2,5,6,8,10)";
     83                elseif ($sql->quote_smart($_GET['side']) == "a") $order_side = "AND race IN (1,3,4,7,11)";
    8484        } else $order_side = "";
    8585       
     
    8888 
    8989 //there is always less hordies
    90  $query = $mysql->query("SELECT count(guid) FROM `character` WHERE race IN(2,5,6,8,10)");
    91  $horde_chars = $mysql->result($query,0);
     90 $query = $sql->query("SELECT count(guid) FROM `character` WHERE race IN(2,5,6,8,10)");
     91 $horde_chars = $sql->result($query,0);
    9292 $horde_pros = round(($horde_chars*100)/$total_chars ,1);
    9393 $allies_chars = $total_chars - $horde_chars;
     
    117117// RACE
    118118foreach ($race as $id){
    119         $query = $mysql->query("SELECT count(guid) FROM `character` WHERE race = $id[0] $order_class $order_level $order_side");
    120         $race[$id[0]][2] = $mysql->result($query,0);
     119        $query = $sql->query("SELECT count(guid) FROM `character` WHERE race = $id[0] $order_class $order_level $order_side");
     120        $race[$id[0]][2] = $sql->result($query,0);
    121121        $race[$id[0]][3] = round((($race[$id[0]][2])*100)/$total_chars,1);
    122122 }
     
    140140// CLASS
    141141foreach ($class as $id){
    142                 $query = $mysql->query("SELECT count(guid) FROM `character` WHERE class = $id[0] $order_race $order_level $order_side");
    143                 $class[$id[0]][2] = $mysql->result($query,0);
     142                $query = $sql->query("SELECT count(guid) FROM `character` WHERE class = $id[0] $order_race $order_level $order_side");
     143                $class[$id[0]][2] = $sql->result($query,0);
    144144                $class[$id[0]][3] = round((($class[$id[0]][2])*100)/$total_chars,1);
    145145 }
     
    163163// LEVEL
    164164foreach ($level as $id){
    165                 $query = $mysql->query("SELECT count(guid) FROM `character` WHERE SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 35), ' ', -1) >= $id[1]
     165                $query = $sql->query("SELECT count(guid) FROM `character` WHERE SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 35), ' ', -1) >= $id[1]
    166166                                                                AND SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 35), ' ', -1) <= $id[2] $order_race $order_class $order_side");
    167                 $level[$id[0]][3] = $mysql->result($query,0);
     167                $level[$id[0]][3] = $sql->result($query,0);
    168168                $level[$id[0]][4] = round((($level[$id[0]][3])*100)/$total_chars,1);
    169169 }
     
    189189        </center>";
    190190
    191  $mysql->close();
     191 $sql->close();
    192192 
    193193} else {
    194         $mysql->close();
     194        $sql->close();
    195195        error($lang_global['err_no_result']);
    196196        }
Note: See TracChangeset for help on using the changeset viewer.