Changeset 19 for minimanager/char_list.php
- Timestamp:
- Aug 13, 2007, 9:05:34 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
minimanager/char_list.php
r5 r19 21 21 $user_lvl,$user_name; 22 22 23 $ mysql = new MySQL;24 $ mysql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);25 26 $start = (isset($_GET['start'])) ? $ mysql->quote_smart($_GET['start']) : 0;27 $order_by = (isset($_GET['order_by'])) ? $ mysql->quote_smart($_GET['order_by']) :"guid";28 29 $dir = (isset($_GET['dir'])) ? $ mysql->quote_smart($_GET['dir']) : 1;23 $sql = new SQL; 24 $sql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']); 25 26 $start = (isset($_GET['start'])) ? $sql->quote_smart($_GET['start']) : 0; 27 $order_by = (isset($_GET['order_by'])) ? $sql->quote_smart($_GET['order_by']) :"guid"; 28 29 $dir = (isset($_GET['dir'])) ? $sql->quote_smart($_GET['dir']) : 1; 30 30 $order_dir = ($dir) ? "ASC" : "DESC"; 31 31 $dir = ($dir) ? 0 : 1; 32 32 33 $query_1 = $ mysql->query("SELECT count(*) FROM `character`");34 $all_record = $ mysql->result($query_1,0);35 36 $query = $ mysql->query("SELECT guid,name,account,race,class,position_x,position_y,map,33 $query_1 = $sql->query("SELECT count(*) FROM `character`"); 34 $all_record = $sql->result($query_1,0); 35 36 $query = $sql->query("SELECT guid,name,account,race,class,zone,map, 37 37 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_HONOR_KILL+1)."), ' ', -1) AS UNSIGNED) AS highest_rank, 38 38 online,CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_LEVEL+1)."), ' ', -1) AS UNSIGNED) AS level 39 39 FROM `character` ORDER BY $order_by $order_dir LIMIT $start, $itemperpage"); 40 $this_page = $ mysql->num_rows($query) or die(error($lang_global['err_no_result']));40 $this_page = $sql->num_rows($query) or die(error($lang_global['err_no_result'])); 41 41 42 42 //==========================top tage navigaion starts here======================== … … 55 55 <input type=\"text\" size=\"14\" maxlength=\"50\" name=\"search_value\" /> 56 56 <select name=\"search_by\"> 57 <option value=\"name\">{$lang_char_list['by_name']}</option> 57 58 <option value=\"guid\">{$lang_char_list['by_id']}</option> 58 <option value=\"name\">{$lang_char_list['by_name']}</option>59 59 <option value=\"account\">{$lang_char_list['by_account']}</option> 60 60 <option value=\"level\">{$lang_char_list['by_level']}</option> … … 83 83 <table class=\"lined\"> 84 84 <tr> 85 <t d width=\"5%\" class=\"head\"><input name=\"allbox\" type=\"checkbox\" value=\"Check All\" onclick=\"CheckAll(document.form1);\" /></td>86 <t d width=\"5%\" class=\"head\"><a href=\"char_list.php?order_by=guid&start=$start&dir=$dir\" class=\"head_link\">{$lang_char_list['id']}</a></td>87 <t d width=\"15%\" class=\"head\"><a href=\"char_list.php?order_by=name&start=$start&dir=$dir\" class=\"head_link\">{$lang_char_list['char_name']}</a></td>88 <t d width=\"15%\" class=\"head\"><a href=\"char_list.php?order_by=account&start=$start&dir=$dir\" class=\"head_link\">{$lang_char_list['account']}</a></td>89 <t d width=\"7%\" class=\"head\"><a href=\"char_list.php?order_by=race&start=$start&dir=$dir\" class=\"head_link\">{$lang_char_list['race']}</a></td>90 <t d width=\"6%\" class=\"head\"><a href=\"char_list.php?order_by=class&start=$start&dir=$dir\" class=\"head_link\">{$lang_char_list['class']}</a></td>91 <t d width=\"5%\" class=\"head\"><a href=\"char_list.php?order_by=level&start=$start&dir=$dir\" class=\"head_link\">{$lang_char_list['level']}</a></td>92 <t d width=\"15%\" class=\"head\"><a href=\"char_list.php?order_by=map&start=$start&dir=$dir\" class=\"head_link\">{$lang_char_list['map']}</a></td>93 <t d width=\"17%\" class=\"head\">{$lang_char_list['zone']}</td>94 <t d width=\"5%\" class=\"head\"><a href=\"char_list.php?order_by=highest_rank&start=$start&dir=$dir\" class=\"head_link\">{$lang_char_list['honor_kills']}</a></td>95 <t d width=\"5%\" class=\"head\"><a href=\"char_list.php?order_by=online&start=$start&dir=$dir\" class=\"head_link\">{$lang_char_list['online']}</a></td>85 <th width=\"5%\"><input name=\"allbox\" type=\"checkbox\" value=\"Check All\" onclick=\"CheckAll(document.form1);\" /></th> 86 <th width=\"5%\"><a href=\"char_list.php?order_by=guid&start=$start&dir=$dir\">".($order_by=='guid' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_char_list['id']}</a></th> 87 <th width=\"15%\"><a href=\"char_list.php?order_by=name&start=$start&dir=$dir\">".($order_by=='name' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_char_list['char_name']}</a></th> 88 <th width=\"15%\"><a href=\"char_list.php?order_by=account&start=$start&dir=$dir\">".($order_by=='account' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_char_list['account']}</a></th> 89 <th width=\"7%\"><a href=\"char_list.php?order_by=race&start=$start&dir=$dir\">".($order_by=='race' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_char_list['race']}</a></th> 90 <th width=\"6%\"><a href=\"char_list.php?order_by=class&start=$start&dir=$dir\">".($order_by=='class' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_char_list['class']}</a></th> 91 <th width=\"5%\"><a href=\"char_list.php?order_by=level&start=$start&dir=$dir\">".($order_by=='level' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_char_list['level']}</a></th> 92 <th width=\"15%\"><a href=\"char_list.php?order_by=map&start=$start&dir=$dir\">".($order_by=='map' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_char_list['map']}</a></th> 93 <th width=\"17%\">{$lang_char_list['zone']}</th> 94 <th width=\"5%\"><a href=\"char_list.php?order_by=highest_rank&start=$start&dir=$dir\">".($order_by=='highest_rank' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_char_list['honor_kills']}</a></th> 95 <th width=\"5%\"><a href=\"char_list.php?order_by=online&start=$start&dir=$dir\">".($order_by=='online' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_char_list['online']}</a></th> 96 96 </tr>"; 97 97 98 98 $looping = ($this_page < $itemperpage) ? $this_page : $itemperpage; 99 99 100 $ mysql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);100 $sql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']); 101 101 102 102 for ($i=1; $i<=$looping; $i++) { 103 $char = $ mysql->fetch_row($query) or die(error($lang_global['err_no_user']));103 $char = $sql->fetch_row($query) or die(error($lang_global['err_no_user'])); 104 104 //to disalow lower lvl gm to view accounts of other gms 105 $result = $ mysql->query("SELECT gmlevel,username FROM account WHERE id ='$char[2]'");106 $owner_gmlvl = $ mysql->result($result, 0, 'gmlevel');107 $owner_acc_name = $ mysql->result($result, 0, 'username');105 $result = $sql->query("SELECT gmlevel,username FROM account WHERE id ='$char[2]'"); 106 $owner_gmlvl = $sql->result($result, 0, 'gmlevel'); 107 $owner_acc_name = $sql->result($result, 0, 'username'); 108 108 109 109 if (($user_lvl >= $owner_gmlvl)||($owner_acc_name == $user_name)){ … … 112 112 $output .= "<td><input type=\"checkbox\" name=\"check[]\" value=\"$char[0]\" onclick=\"CheckCheckAll(document.form1);\" /></td>"; 113 113 else $output .= "<td></td>"; 114 $output .= " 115 <td>$char[0]</td> 114 $output .= "<td>$char[0]</td> 116 115 <td><a href=\"char.php?id=$char[0]\">$char[1]</a></td> 117 116 <td><a href=\"user.php?action=edit_user&error=11&id=$char[2]\">$owner_acc_name</a></td> 118 <td> ".get_player_race($char[3])."</td>119 <td> ".get_player_class($char[4])."</td>120 <td>$char[ 10]</td>121 <td>".get_map_name($char[ 7])."</td>122 <td>".get_zone_name($char[ 7], $char[5], $char[6])."</td>123 <td>$char[ 8]</td>124 <td>".(($char[ 9]) ? "ON" : "-")."</td>117 <td><img src='img/c_icons/{$char[3]}-0.gif' onmousemove='toolTip(\"".get_player_race($char[3])."\",\"item_tooltip\")' onmouseout='toolTip()' /></td> 118 <td><img src='img/c_icons/{$char[4]}.gif' onmousemove='toolTip(\"".get_player_class($char[4])."\",\"item_tooltip\")' onmouseout='toolTip()' /></td> 119 <td>$char[9]</td> 120 <td>".get_map_name($char[6])."</td> 121 <td>".get_zone_name($char[5])."</td> 122 <td>$char[7]</td> 123 <td>".(($char[8]) ? "<img src=\"img/up.gif\" alt=\"\" />" : "-")."</td> 125 124 </tr>"; 126 125 }else{ … … 140 139 </form><br /></center>"; 141 140 142 $ mysql->close();141 $sql->close(); 143 142 } 144 143 … … 153 152 if(!isset($_GET['search_value'])) redirect("char_list.php?error=2"); 154 153 155 $ mysql = new MySQL;156 $ mysql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass']);157 158 $search_value = $ mysql->quote_smart($_GET['search_value']);159 $search_by = (isset($_GET['search_by'])) ? $ mysql->quote_smart($_GET['search_by']) : "name";160 $order_by = (isset($_GET['order_by'])) ? $ mysql->quote_smart($_GET['order_by']) : "guid";161 162 $dir = (isset($_GET['dir'])) ? $ mysql->quote_smart($_GET['dir']) : 1;154 $sql = new SQL; 155 $sql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']); 156 157 $search_value = $sql->quote_smart($_GET['search_value']); 158 $search_by = (isset($_GET['search_by'])) ? $sql->quote_smart($_GET['search_by']) : "name"; 159 $order_by = (isset($_GET['order_by'])) ? $sql->quote_smart($_GET['order_by']) : "guid"; 160 161 $dir = (isset($_GET['dir'])) ? $sql->quote_smart($_GET['dir']) : 1; 163 162 $order_dir = ($dir) ? "ASC" : "DESC"; 164 163 $dir = ($dir) ? 0 : 1; … … 167 166 //need to get the acc id from other table since input comes as name 168 167 case "account": 169 { 170 $mysql->db($realm_db['name']); 171 $result = $mysql->query("SELECT id FROM account WHERE username LIKE '%$search_value%' LIMIT $sql_search_limit"); 172 173 //acc = 0 added just in case there will be NO result 174 $where_out = "account = 0 "; 175 while ($acc = $mysql->fetch_row($result)){ 176 $where_out .= "OR account = $acc[0] "; 177 } 178 179 $sql = "SELECT guid,name,account,race,class,position_x,position_y,map, 168 $sql->db($realm_db['name']); 169 $result = $sql->query("SELECT id FROM account WHERE username LIKE '%$search_value%' LIMIT $sql_search_limit"); 170 171 $where_out = "account IN (0 "; 172 while ($char = $sql->fetch_row($result)) $where_out .= " ,$acc[0]"; 173 $where_out = ") "; 174 175 $sql_query = "SELECT guid,name,account,race,class,zone,map, 180 176 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_HONOR_KILL+1)."), ' ', -1) AS UNSIGNED) AS highest_rank,online, 181 177 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_LEVEL+1)."), ' ', -1) AS UNSIGNED) AS level 182 178 FROM `character` WHERE $where_out ORDER BY $order_by $order_dir LIMIT $sql_search_limit"; 183 }184 179 break; 185 180 186 181 case "level": 187 {188 182 if (!is_numeric($search_value)) $search_value = 1; 189 $sql = "SELECT guid,name,account,race,class,position_x,position_y,map,183 $sql_query = "SELECT guid,name,account,race,class,zone,map, 190 184 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_HONOR_KILL+1)."), ' ', -1) AS UNSIGNED) AS highest_rank,online, 191 185 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_LEVEL+1)."), ' ', -1) AS UNSIGNED) AS level FROM `character` 192 186 WHERE SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_LEVEL+1)."), ' ', -1) = $search_value ORDER BY $order_by $order_dir LIMIT $sql_search_limit"; 193 }194 187 break; 195 188 196 189 case "greater_level": 197 190 if (!is_numeric($search_value)) $search_value = 1; 198 $sql = "SELECT guid,name,account,race,class,position_x,position_y,map,191 $sql_query = "SELECT guid,name,account,race,class,zone,map, 199 192 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_HONOR_KILL+1)."), ' ', -1) AS UNSIGNED) AS highest_rank,online, 200 193 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_LEVEL+1)."), ' ', -1) AS UNSIGNED) AS level FROM `character` … … 203 196 204 197 case "gold": 205 {206 //used to avoid wrong input - cant use quotes on search value due to mysql bug.207 198 if (!is_numeric($search_value)) $search_value = 1; 208 $sql = "SELECT guid,name,account,race,class,position_x,position_y,map,199 $sql_query = "SELECT guid,name,account,race,class,zone,map, 209 200 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_HONOR_KILL+1)."), ' ', -1) AS UNSIGNED) AS highest_rank,online, 210 201 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_LEVEL+1)."), ' ', -1) AS UNSIGNED) AS level FROM `character` 211 202 WHERE SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_GOLD+1)."), ' ', -1) > $search_value ORDER BY $order_by $order_dir LIMIT $sql_search_limit"; 212 }213 203 break; 214 204 215 205 case "guild": 216 $mysql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']); 217 $result = $mysql->query("SELECT guildid FROM guild WHERE name LIKE '%$search_value%'"); 218 $guildid = $mysql->result($result, 0, 'guildid'); 219 220 $result = $mysql->query("SELECT guid FROM guild_member WHERE guildid = $guildid"); 221 222 //guid = 0 added just in case there will be NO result 223 $where_out = "guid = 0 "; 224 while ($char = $mysql->fetch_row($result)){ 225 $where_out .= " OR guid = $char[0]"; 226 } 227 228 $sql = "SELECT guid,name,account,race,class,position_x,position_y,map, 206 $sql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']); 207 $result = $sql->query("SELECT guildid FROM guild WHERE name LIKE '%$search_value%'"); 208 $guildid = $sql->result($result, 0, 'guildid'); 209 210 $result = $sql->query("SELECT guid FROM guild_member WHERE guildid = $guildid"); 211 212 $where_out = "guid IN (0 "; 213 while ($char = $sql->fetch_row($result)) $where_out .= " ,$char[0]"; 214 $where_out = ") "; 215 216 $sql_query = "SELECT guid,name,account,race,class,zone,map, 229 217 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_HONOR_KILL+1)."), ' ', -1) AS UNSIGNED) AS highest_rank,online, 230 218 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_LEVEL+1)."), ' ', -1) AS UNSIGNED) AS level FROM `character` … … 233 221 234 222 case "item": 235 $mysql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']); 236 $result = $mysql->query("SELECT guid FROM character_inventory WHERE item_template = '$search_value'"); 237 238 //guid = 0 added just in case there will be NO result 239 $where_out = " guid = 0"; 240 while ($char = $mysql->fetch_row($result)){ 241 $where_out .= " OR guid = $char[0]"; 242 } 243 244 $sql = "SELECT guid,name,account,race,class,position_x,position_y,map, 223 $sql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']); 224 $result = $sql->query("SELECT guid FROM character_inventory WHERE item_template = '$search_value'"); 225 226 $where_out = "guid IN (0 "; 227 while ($char = $sql->fetch_row($result)) $where_out .= " ,$char[0]"; 228 $where_out = ") "; 229 230 $sql_query = "SELECT guid,name,account,race,class,zone,map, 245 231 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_HONOR_KILL+1)."), ' ', -1) AS UNSIGNED) AS highest_rank,online, 246 232 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_LEVEL+1)."), ' ', -1) AS UNSIGNED) AS level FROM `character` … … 250 236 case "greater_rank": 251 237 if (!is_numeric($search_value)) $search_value = 0; 252 $sql = "SELECT guid,name,account,race,class,position_x,position_y,map,238 $sql_query = "SELECT guid,name,account,race,class,zone,map, 253 239 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_HONOR_KILL+1)."), ' ', -1) AS UNSIGNED) AS highest_rank,online, 254 240 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_LEVEL+1)."), ' ', -1) AS UNSIGNED) AS level FROM `character` … … 257 243 case "highest_rank": 258 244 if (!is_numeric($search_value)) $search_value = 0; 259 $sql = "SELECT guid,name,account,race,class,position_x,position_y,map,245 $sql_query = "SELECT guid,name,account,race,class,zone,map, 260 246 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_HONOR_KILL+1)."), ' ', -1) AS UNSIGNED) AS highest_rank,online, 261 247 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_LEVEL+1)."), ' ', -1) AS UNSIGNED) AS level FROM `character` … … 264 250 265 251 default: 266 $sql = "SELECT guid,name,account,race,class,position_x,position_y,map,252 $sql_query = "SELECT guid,name,account,race,class,zone,map, 267 253 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_HONOR_KILL+1)."), ' ', -1) AS UNSIGNED) AS highest_rank,online, 268 254 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_LEVEL+1)."), ' ', -1) AS UNSIGNED) AS level FROM `character` … … 270 256 } 271 257 272 $ mysql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);273 274 $query = $ mysql->query($sql);275 $total_found = $ mysql->num_rows($query);258 $sql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']); 259 260 $query = $sql->query($sql_query); 261 $total_found = $sql->num_rows($query); 276 262 277 263 //==========================top tage navigaion starts here======================== … … 288 274 <input type=\"text\" size=\"17\" maxlength=\"50\" name=\"search_value\" /> 289 275 <select name=\"search_by\"> 276 <option value=\"name\">{$lang_char_list['by_name']}</option> 290 277 <option value=\"guid\">{$lang_char_list['by_id']}</option> 291 <option value=\"name\">{$lang_char_list['by_name']}</option>292 278 <option value=\"account\">{$lang_char_list['by_account']}</option> 293 279 <option value=\"level\">{$lang_char_list['by_level']}</option> … … 313 299 <table class=\"lined\"> 314 300 <tr> 315 <t d width=\"5%\" class=\"head\"><input name=\"allbox\" type=\"checkbox\" value=\"Check All\" onclick=\"CheckAll(document.form1);\" /></td>316 <t d width=\"5%\" class=\"head\"><a href=\"char_list.php?action=search&error=3&search_value=$search_value&search_by=$search_by&order_by=guid&dir=$dir\" class=\"head_link\">{$lang_char_list['id']}</a></td>317 <t d width=\"15%\" class=\"head\"><a href=\"char_list.php?action=search&error=3&search_value=$search_value&search_by=$search_by&order_by=name&dir=$dir\" class=\"head_link\">{$lang_char_list['char_name']}</a></td>318 <t d width=\"15%\" class=\"head\"><a href=\"char_list.php?action=search&error=3&search_value=$search_value&search_by=$search_by&order_by=account&dir=$dir\" class=\"head_link\">{$lang_char_list['account']}</a></td>319 <t d width=\"7%\" class=\"head\"><a href=\"char_list.php?action=search&error=3&search_value=$search_value&search_by=$search_by&order_by=race&dir=$dir\" class=\"head_link\">{$lang_char_list['race']}</a></td>320 <t d width=\"6%\" class=\"head\"><a href=\"char_list.php?action=search&error=3&search_value=$search_value&search_by=$search_by&order_by=class&dir=$dir\" class=\"head_link\">{$lang_char_list['class']}</a></td>321 <t d width=\"5%\" class=\"head\"><a href=\"char_list.php?action=search&error=3&search_value=$search_value&search_by=$search_by&order_by=level&dir=$dir\" class=\"head_link\">{$lang_char_list['level']}</a></td>322 <t d width=\"17%\" class=\"head\"><a href=\"char_list.php?action=search&error=3&search_value=$search_value&search_by=$search_by&order_by=map&dir=$dir\" class=\"head_link\">{$lang_char_list['map']}</a></td>323 <t d width=\"15%\" class=\"head\">{$lang_char_list['zone']}</td>324 <t d width=\"5%\" class=\"head\"><a href=\"char_list.php?action=search&error=3&search_value=$search_value&search_by=$search_by&order_by=highest_rank&dir=$dir\" class=\"head_link\">{$lang_char_list['honor_kills']}</a></td>325 <t d width=\"5%\" class=\"head\"><a href=\"char_list.php?action=search&error=3&search_value=$search_value&search_by=$search_by&order_by=online&dir=$dir\" class=\"head_link\">{$lang_char_list['online']}</a></td>301 <th width=\"5%\"><input name=\"allbox\" type=\"checkbox\" value=\"Check All\" onclick=\"CheckAll(document.form1);\" /></td> 302 <th width=\"5%\><a href=\"char_list.php?action=search&error=3&search_value=$search_value&search_by=$search_by&order_by=guid&dir=$dir\">".($order_by=='guid' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_char_list['id']}</a></th> 303 <th width=\"15%\"><a href=\"char_list.php?action=search&error=3&search_value=$search_value&search_by=$search_by&order_by=name&dir=$dir\">".($order_by=='name' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_char_list['char_name']}</a></th> 304 <th width=\"15%\"><a href=\"char_list.php?action=search&error=3&search_value=$search_value&search_by=$search_by&order_by=account&dir=$dir\">".($order_by=='account' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_char_list['account']}</a></th> 305 <th width=\"7%\"><a href=\"char_list.php?action=search&error=3&search_value=$search_value&search_by=$search_by&order_by=race&dir=$dir\">".($order_by=='race' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_char_list['race']}</a></th> 306 <th width=\"6%\"><a href=\"char_list.php?action=search&error=3&search_value=$search_value&search_by=$search_by&order_by=class&dir=$dir\">".($order_by=='class' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_char_list['class']}</a></th> 307 <th width=\"5%\"><a href=\"char_list.php?action=search&error=3&search_value=$search_value&search_by=$search_by&order_by=level&dir=$dir\">".($order_by=='level' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_char_list['level']}</a></th> 308 <th width=\"17%\"><a href=\"char_list.php?action=search&error=3&search_value=$search_value&search_by=$search_by&order_by=map&dir=$dir\">".($order_by=='map' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_char_list['map']}</a></th> 309 <th width=\"15%\">{$lang_char_list['zone']}</th> 310 <th width=\"5%\"><a href=\"char_list.php?action=search&error=3&search_value=$search_value&search_by=$search_by&order_by=highest_rank&dir=$dir\">".($order_by=='highest_rank' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_char_list['honor_kills']}</a></th> 311 <th width=\"5%\"><a href=\"char_list.php?action=search&error=3&search_value=$search_value&search_by=$search_by&order_by=online&dir=$dir\">".($order_by=='online' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_char_list['online']}</a></th> 326 312 </tr>"; 327 313 328 $ mysql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);314 $sql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']); 329 315 330 for ($i=1; $i<=$total_found; $i++){ 331 $char = $mysql->fetch_row($query); 332 //to disalow lower lvl gm to view accounts of other gms 333 $result = $mysql->query("SELECT gmlevel,username FROM account WHERE id ='$char[2]'"); 334 $owner_gmlvl = $mysql->result($result, 0, 'gmlevel'); 335 $owner_acc_name = $mysql->result($result, 0, 'username'); 316 while ($char = $sql->fetch_row($query)){ 317 318 $result = $sql->query("SELECT gmlevel,username FROM account WHERE id ='$char[2]'"); 319 $owner_gmlvl = $sql->result($result, 0, 'gmlevel'); 320 $owner_acc_name = $sql->result($result, 0, 'username'); 336 321 337 if (($user_lvl >= $owner_gmlvl)||($owner_acc_name == $user_name)){322 if (($user_lvl >= $owner_gmlvl)||($owner_acc_name == $user_name)){ 338 323 $output .= "<tr>"; 339 324 if (($user_lvl > $owner_gmlvl)||($owner_acc_name == $user_name))$output .= " … … 344 329 <td><a href=\"char.php?id=$char[0]\">$char[1]</a></td> 345 330 <td><a href=\"user.php?action=edit_user&error=11&id=$char[2]\">$owner_acc_name</a></td> 346 <td> ".get_player_race($char[3])."</td>347 <td >".get_player_class($char[4])."</td>348 <td>$char[ 10]</td>349 <td>".get_map_name($char[ 7])."</td>350 <td>".get_zone_name($char[ 7], $char[5], $char[6])."</td>351 <td>$char[ 8]</td>352 <td>".(($char[ 9]) ? "ON" : "-")."</td>331 <td><img src='img/c_icons/{$char[3]}-0.gif' onmousemove='toolTip(\"".get_player_race($char[3])."\",\"item_tooltip\")' onmouseout='toolTip()' /></td> 332 <td><img src='img/c_icons/{$char[4]}.gif' onmousemove='toolTip(\"".get_player_class($char[4])."\",\"item_tooltip\")' onmouseout='toolTip()' /></td> 333 <td>$char[9]</td> 334 <td>".get_map_name($char[6])."</td> 335 <td>".get_zone_name($char[5])."</td> 336 <td>$char[7]</td> 337 <td>".(($char[8]) ? "<img src=\"img/up.gif\" alt=\"\" />" : "-")."</td> 353 338 </tr>"; 354 339 }else{ … … 368 353 </form><br /></center>"; 369 354 370 $ mysql->close();355 $sql->close(); 371 356 } 372 357 … … 376 361 //######################################################################################################################## 377 362 function del_char_form() { 378 global $lang_global, $lang_char_list, $output ;363 global $lang_global, $lang_char_list, $output, $realm_id, $mangos_db; 379 364 if(isset($_GET['check'])) $check = $_GET['check']; 380 365 else redirect("char_list.php?error=1"); 381 366 382 $output .= "<center>< h1><font class=\"error\">{$lang_global['are_you_sure']}</font></h1><br />";383 $output .= "<font class=\"bold\">{$lang_char_list['char_ids']}: "; 384 385 //this array needed to pass multiple values from check boxes down to delete by post method 367 $output .= "<center><img src=\"img/warn_red.gif\" width=\"48\" height=\"48\" alt=\"\" /> 368 <h1><font class=\"error\">{$lang_global['are_you_sure']}</font></h1><br /> 369 <font class=\"bold\">{$lang_char_list['char_ids']}: "; 370 386 371 $pass_array = ""; 387 372 373 $sql = new SQL; 374 $sql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']); 375 388 376 for ($i=0; $i<count($check); $i++){ 389 $output .= "<a href=\"char.php?id=$check[$i]\" target=\"_blank\">$check[$i], </a>"; 377 $name = $sql->result($sql->query("SELECT name FROM `character` WHERE guid = {$check[$i]}"),0); 378 $output .= "<a href=\"char.php?id=$check[$i]\" target=\"_blank\">$name, </a>"; 390 379 $pass_array .= "&check%5B%5D=$check[$i]"; 391 380 } 392 381 393 $output .= "<br />{$lang_global['will_be_erased']}</font><br /><br />"; 394 395 $output .= "<table class=\"hidden\"> 382 $sql->close(); 383 384 $output .= "<br />{$lang_global['will_be_erased']}</font><br /><br /> 385 <table class=\"hidden\"> 396 386 <tr><td>"; 397 387 makebutton($lang_global['yes'], "char_list.php?action=dodel_char$pass_array",120); … … 410 400 $tab_del_user_mangos, $user_name; 411 401 412 $ mysql = new MySQL;413 $ mysql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);414 415 if(isset($_GET['check'])) $check = $ mysql->quote_smart($_GET['check']);402 $sql = new SQL; 403 $sql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']); 404 405 if(isset($_GET['check'])) $check = $sql->quote_smart($_GET['check']); 416 406 else redirect("char_list.php?error=1"); 417 407 … … 425 415 } 426 416 427 $ mysql->close();417 $sql->close(); 428 418 $output .= "<center>"; 429 419 if (!$deleted_chars) $output .= "<h1><font class=\"error\">{$lang_char_list['no_chars_del']}</font></h1>";
Note:
See TracChangeset
for help on using the changeset viewer.