Changeset 19 for minimanager/index.php
- Timestamp:
- Aug 13, 2007, 9:05:34 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
minimanager/index.php
r5 r19 13 13 14 14 require_once("scripts/get_lib.php"); 15 require_once("scripts\bbcode_lib.php"); 15 16 16 $ mysql = new MySQL;17 $ mysql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);17 $sql = new SQL; 18 $sql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']); 18 19 19 20 $output .= "<div class=\"top\">"; 20 21 if (test_port($server[$realm_id]['addr'],$server[$realm_id]['game_port'])) { 21 22 22 $query = $ mysql->query("SELECT uptime/60 FROM uptime ORDER BY starttime DESC LIMIT 1");23 $uptime = $ mysql->result($query, 0);23 $query = $sql->query("SELECT uptime/60 FROM uptime ORDER BY starttime DESC LIMIT 1"); 24 $uptime = $sql->result($query, 0); 24 25 $output .= "<h1><font color=\"#55aa55\">{$lang_index['realm']} ".get_realm_name($realm_id)." {$lang_index['online']} : (".(int)($uptime/60).":".(($uptime >= 60 )?(int)($uptime-60*(int)($uptime/60)):(int)$uptime)."h)</font></h1>"; 25 26 $online = true; … … 30 31 $output .= "Mangos: {$server[$realm_id]['rev']} Using DB: {$mangos_db[$realm_id]['db_rev']}</div>"; 31 32 32 $ mysql->db($mangos_db[$realm_id]['name']);33 $sql->db($mangos_db[$realm_id]['name']); 33 34 //MOTD part 34 $start = (isset($_GET['start'])) ? $ mysql->quote_smart($_GET['start']) : 0;35 $start = (isset($_GET['start'])) ? $sql->quote_smart($_GET['start']) : 0; 35 36 36 $query_1 = $ mysql->query("SELECT count(*) FROM bugreport");37 $all_record = $ mysql->result($query_1, 0);37 $query_1 = $sql->query("SELECT count(*) FROM bugreport"); 38 $all_record = $sql->result($query_1, 0); 38 39 40 if ($user_lvl > 0) $output .= "<script type=\"text/javascript\"> 41 answerbox.btn_ok='{$lang_global['yes_low']}'; 42 answerbox.btn_cancel='{$lang_global['no']}'; 43 var del_motd = 'motd.php?action=delete_motd&id='; 44 </script>"; 39 45 $output .= "<center> 40 46 <table class=\"lined\"> 41 47 <tr> 42 <t d class=\"head\"align=\"right\">";43 if ($user_lvl) $output .= "<a href=\"motd.php?action=add_motd\" class=\"head_link\">{$lang_index['add_motd']}</a>";48 <th align=\"right\">"; 49 if ($user_lvl) $output .= "<a href=\"motd.php?action=add_motd\">{$lang_index['add_motd']}</a>"; 44 50 $output .= "</td></tr>"; 45 51 if($all_record){ 46 $result = $ mysql->query("SELECT id, type, content FROM bugreport ORDER BY id DESC LIMIT $start, 3");47 while($post = $ mysql->fetch_row($result)){48 $output .= "<tr><td align=\"left\" class=\"large\"><blockquote> $post[2]</blockquote></td></tr>52 $result = $sql->query("SELECT id, type, content FROM bugreport ORDER BY id DESC LIMIT $start, 3"); 53 while($post = $sql->fetch_row($result)){ 54 $output .= "<tr><td align=\"left\" class=\"large\"><blockquote>".bbcode2html($post[2])."</blockquote></td></tr> 49 55 <tr><td align=\"right\">$post[1] "; 50 if ($user_lvl > 0) $output .= "<a href=\"motd.php?action=delete_motd&id=$post[0]\">{$lang_index['delete']}</a>"; 51 $output .= "</td></tr> 56 if ($user_lvl > 0) $output .= "<img src=\"img/cross.png\" width=\"12\" height=\"12\" onclick=\"answerBox('{$lang_global['delete']}: <font color=white>{$post[0]}</font><br />{$lang_global['are_you_sure']}', del_motd + $post[0]);\" style=\"cursor:pointer;\" /> 57 <a href=\"motd.php?action=edit_motd&id=$post[0]\"><img src=\"img/edit.png\" width=\"14\" height=\"14\" /></a>"; 58 $output .= "</th></tr> 52 59 <tr><td class=\"hidden\"></td></tr>"; 53 60 } … … 58 65 //print online chars 59 66 if ($online){ 60 $order_by = (isset($_GET['order_by'])) ? $ mysql->quote_smart($_GET['order_by']) : "name";67 $order_by = (isset($_GET['order_by'])) ? $sql->quote_smart($_GET['order_by']) : "name"; 61 68 62 $dir = (isset($_GET['dir'])) ? $ mysql->quote_smart($_GET['dir']) : 1;69 $dir = (isset($_GET['dir'])) ? $sql->quote_smart($_GET['dir']) : 1; 63 70 $order_dir = ($dir) ? "ASC" : "DESC"; 64 71 $dir = ($dir) ? 0 : 1; 65 72 66 $result = $ mysql->query("SELECT count(*) FROM `character` WHERE `online`= 1");67 $total_online = $ mysql->result($result, 0);73 $result = $sql->query("SELECT count(*) FROM `character` WHERE `online`= 1"); 74 $total_online = $sql->result($result, 0); 68 75 69 76 if( !$user_lvl && !$server[$realm_id]['both_factions']){ 70 $result = $ mysql->query("SELECT race FROM `character` WHERE account = '$user_id' AND totaltime = (SELECT MAX(totaltime) FROM `character` WHERE account = '$user_id') LIMIT 1");71 if ($ mysql->num_rows($result)){72 $order_side = (in_array($ mysql->result($result, 0, 'race'),array(2,5,6,8,10))) ?77 $result = $sql->query("SELECT race FROM `character` WHERE account = '$user_id' AND totaltime = (SELECT MAX(totaltime) FROM `character` WHERE account = '$user_id') LIMIT 1"); 78 if ($sql->num_rows($result)){ 79 $order_side = (in_array($sql->result($result, 0, 'race'),array(2,5,6,8,10))) ? 73 80 " AND race IN (2,5,6,8,10) " : " AND race IN (1,3,4,7,11) "; 74 81 } else $order_side = ""; … … 77 84 require_once("scripts/defines.php"); 78 85 79 $result = $ mysql->query("SELECT guid,name,race,class,position_x,position_y,map,86 $result = $sql->query("SELECT guid,name,race,class,zone,map, 80 87 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_HONOR_KILL+1)."), ' ', -1) AS UNSIGNED) AS highest_rank, 81 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_LEVEL+1)."), ' ', -1) AS UNSIGNED) AS level,account 88 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_LEVEL+1)."), ' ', -1) AS UNSIGNED) AS level,account 82 89 FROM `character` WHERE `online`= 1 $order_side ORDER BY $order_by $order_dir"); 83 90 … … 86 93 <table class=\"lined\"> 87 94 <tr> 88 <t d width=\"22%\" class=\"head\"><a href=\"index.php?order_by=name&dir=$dir\" class=\"head_link\">{$lang_index['name']}</a></td>89 <t d width=\"10%\" class=\"head\"><a href=\"index.php?order_by=race&dir=$dir\" class=\"head_link\">{$lang_index['race']}</a></td>90 <t d width=\"10%\" class=\"head\"><a href=\"index.php?order_by=class&dir=$dir\" class=\"head_link\">{$lang_index['class']}</a></td>91 <t d width=\"5%\" class=\"head\"><a href=\"index.php?order_by=level&dir=$dir\" class=\"head_link\">{$lang_index['level']}</a></td>92 <t d width=\"20%\" class=\"head\"><a href=\"index.php?order_by=map&dir=$dir\" class=\"head_link\">{$lang_index['map']}</a></td>93 <t d width=\"25%\" class=\"head\">{$lang_index['zone']}</td>94 <t d width=\"8%\" class=\"head\"><a href=\"index.php?order_by=highest_rank&dir=$dir\" class=\"head_link\">{$lang_index['honor_kills']}</a></td>95 <th width=\"26%\"><a href=\"index.php?order_by=name&dir=$dir\">".($order_by=='name' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_index['name']}</a></th> 96 <th width=\"7%\"><a href=\"index.php?order_by=race&dir=$dir\">".($order_by=='race' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_index['race']}</a></th> 97 <th width=\"7%\"><a href=\"index.php?order_by=class&dir=$dir\">".($order_by=='class' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_index['class']}</a></th> 98 <th width=\"7%\"><a href=\"index.php?order_by=level&dir=$dir\">".($order_by=='level' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_index['level']}</a></th> 99 <th width=\"20%\"><a href=\"index.php?order_by=map&dir=$dir\">".($order_by=='map' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_index['map']}</a></th> 100 <th width=\"25%\">{$lang_index['zone']}</td> 101 <th width=\"10%\"><a href=\"index.php?order_by=highest_rank&dir=$dir\">".($order_by=='highest_rank' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_index['honor_kills']}</a></th> 95 102 </tr>"; 96 103 97 104 require_once("scripts/id_tab.php"); 98 105 99 while($char = $ mysql->fetch_row($result)){106 while($char = $sql->fetch_row($result)){ 100 107 $output .= "<tr> 101 108 <td><a href=\"char.php?id=$char[0]\">$char[1]</a></td> 102 <td>".get_player_race($char[2])."</td> 103 <td>".get_player_class($char[3])."</td> 104 <td>$char[8]</td> 105 <td>".get_map_name($char[6])."</td> 106 <td>".get_zone_name($char[6], $char[4], $char[5])."</td> 109 <td><img src='img/c_icons/{$char[2]}-0.gif' onmousemove='toolTip(\"".get_player_race($char[2])."\",\"item_tooltip\")' onmouseout='toolTip()' /></td> 110 <td><img src='img/c_icons/{$char[3]}.gif' onmousemove='toolTip(\"".get_player_class($char[3])."\",\"item_tooltip\")' onmouseout='toolTip()' /></td> 107 111 <td>$char[7]</td> 112 <td>".get_map_name($char[5])."</td> 113 <td>".get_zone_name($char[4])."</td> 114 <td>$char[6]</td> 108 115 </tr>"; 109 116 } 110 117 $output .= "</table><br /></center>"; 111 118 } 112 $ mysql->close();119 $sql->close(); 113 120 114 121 require_once("footer.php");
Note:
See TracChangeset
for help on using the changeset viewer.