Changeset 19 for minimanager/stat.php
- Timestamp:
- Aug 13, 2007, 9:05:34 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
minimanager/stat.php
r5 r19 55 55 ); 56 56 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); 62 62 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); 66 66 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); 69 69 70 70 if ($total_chars){ 71 71 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']) : ""; 74 74 75 75 if(isset($_GET['level'])){ 76 $lvl_min = $ mysql->quote_smart($_GET['level']);76 $lvl_min = $sql->quote_smart($_GET['level']); 77 77 $lvl_max = $lvl_min + 4; 78 78 $order_level = "AND SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 35), ' ', -1) >= $lvl_min AND SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 35), ' ', -1) <= $lvl_max"; … … 80 80 81 81 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)"; 84 84 } else $order_side = ""; 85 85 … … 88 88 89 89 //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); 92 92 $horde_pros = round(($horde_chars*100)/$total_chars ,1); 93 93 $allies_chars = $total_chars - $horde_chars; … … 117 117 // RACE 118 118 foreach ($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); 121 121 $race[$id[0]][3] = round((($race[$id[0]][2])*100)/$total_chars,1); 122 122 } … … 140 140 // CLASS 141 141 foreach ($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); 144 144 $class[$id[0]][3] = round((($class[$id[0]][2])*100)/$total_chars,1); 145 145 } … … 163 163 // LEVEL 164 164 foreach ($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] 166 166 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); 168 168 $level[$id[0]][4] = round((($level[$id[0]][3])*100)/$total_chars,1); 169 169 } … … 189 189 </center>"; 190 190 191 $ mysql->close();191 $sql->close(); 192 192 193 193 } else { 194 $ mysql->close();194 $sql->close(); 195 195 error($lang_global['err_no_result']); 196 196 }
Note:
See TracChangeset
for help on using the changeset viewer.