Changeset 142 for minimanager/char_list.php
- Timestamp:
- Nov 23, 2007, 11:29:33 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
minimanager/char_list.php
r19 r142 8 8 * License: GNU General Public License v2(GPL) 9 9 */ 10 10 11 11 require_once("header.php"); 12 12 valid_login(1); … … 18 18 //######################################################################################################################## 19 19 function browse_chars() { 20 global $lang_char_list, $lang_global, $output, $realm_db, $ mangos_db, $realm_id, $itemperpage,20 global $lang_char_list, $lang_global, $output, $realm_db, $characters_db, $realm_id, $itemperpage, 21 21 $user_lvl,$user_name; 22 22 23 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']);24 $sql->connect($characters_db[$realm_id]['addr'], $characters_db[$realm_id]['user'], $characters_db[$realm_id]['pass'], $characters_db[$realm_id]['name']); 25 25 26 26 $start = (isset($_GET['start'])) ? $sql->quote_smart($_GET['start']) : 0; 27 27 $order_by = (isset($_GET['order_by'])) ? $sql->quote_smart($_GET['order_by']) :"guid"; 28 28 29 29 $dir = (isset($_GET['dir'])) ? $sql->quote_smart($_GET['dir']) : 1; 30 30 $order_dir = ($dir) ? "ASC" : "DESC"; … … 36 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 online,CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_LEVEL+1)."), ' ', -1) AS UNSIGNED) AS level 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 40 $this_page = $sql->num_rows($query) or die(error($lang_global['err_no_result'])); … … 44 44 <center><table class=\"top_hidden\"> 45 45 <tr><td> 46 <table class=\"hidden\"> 46 <table class=\"hidden\"> 47 47 <tr><td>"; 48 48 makebutton($lang_char_list['cleanup'], "cleanup.php", 110); … … 82 82 <input type=\"hidden\" name=\"start\" value=\"$start\" /> 83 83 <table class=\"lined\"> 84 <tr> 84 <tr> 85 85 <th width=\"5%\"><input name=\"allbox\" type=\"checkbox\" value=\"Check All\" onclick=\"CheckAll(document.form1);\" /></th> 86 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> … … 99 99 100 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 103 $char = $sql->fetch_row($query) or die(error($lang_global['err_no_user'])); … … 138 138 </table> 139 139 </form><br /></center>"; 140 140 141 141 $sql->close(); 142 142 } … … 147 147 //######################################################################################################################## 148 148 function search() { 149 global $lang_char_list, $lang_global, $output, $realm_db, $ mangos_db, $realm_id, $itemperpage,149 global $lang_char_list, $lang_global, $output, $realm_db, $characters_db, $realm_id, $itemperpage, 150 150 $user_lvl, $user_name, $sql_search_limit; 151 151 … … 154 154 $sql = new SQL; 155 155 $sql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']); 156 156 157 157 $search_value = $sql->quote_smart($_GET['search_value']); 158 158 $search_by = (isset($_GET['search_by'])) ? $sql->quote_smart($_GET['search_by']) : "name"; 159 159 $order_by = (isset($_GET['order_by'])) ? $sql->quote_smart($_GET['order_by']) : "guid"; 160 160 161 161 $dir = (isset($_GET['dir'])) ? $sql->quote_smart($_GET['dir']) : 1; 162 162 $order_dir = ($dir) ? "ASC" : "DESC"; 163 163 $dir = ($dir) ? 0 : 1; 164 164 165 165 switch ($search_by){ 166 166 //need to get the acc id from other table since input comes as name … … 169 169 $result = $sql->query("SELECT id FROM account WHERE username LIKE '%$search_value%' LIMIT $sql_search_limit"); 170 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, 176 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_HONOR_KILL+1)."), ' ', -1) AS UNSIGNED) AS highest_rank,online, 177 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_LEVEL+1)."), ' ', -1) AS UNSIGNED) AS level 171 $where_out = " account IN (0 "; 172 while ($char = $sql->fetch_row($result)) { 173 $where_out .= " ,"; 174 $where_out .= $char[0]; 175 }; 176 $where_out .= ") "; 177 178 $sql_query = "SELECT guid,name,account,race,class,zone,map, 179 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_HONOR_KILL+1)."), ' ', -1) AS UNSIGNED) AS highest_rank,online, 180 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_LEVEL+1)."), ' ', -1) AS UNSIGNED) AS level 178 181 FROM `character` WHERE $where_out ORDER BY $order_by $order_dir LIMIT $sql_search_limit"; 179 182 break; … … 183 186 $sql_query = "SELECT guid,name,account,race,class,zone,map, 184 187 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_HONOR_KILL+1)."), ' ', -1) AS UNSIGNED) AS highest_rank,online, 185 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_LEVEL+1)."), ' ', -1) AS UNSIGNED) AS level FROM `character` 188 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_LEVEL+1)."), ' ', -1) AS UNSIGNED) AS level FROM `character` 186 189 WHERE SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_LEVEL+1)."), ' ', -1) = $search_value ORDER BY $order_by $order_dir LIMIT $sql_search_limit"; 187 190 break; … … 191 194 $sql_query = "SELECT guid,name,account,race,class,zone,map, 192 195 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_HONOR_KILL+1)."), ' ', -1) AS UNSIGNED) AS highest_rank,online, 193 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_LEVEL+1)."), ' ', -1) AS UNSIGNED) AS level FROM `character` 196 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_LEVEL+1)."), ' ', -1) AS UNSIGNED) AS level FROM `character` 194 197 WHERE SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_LEVEL+1)."), ' ', -1) > $search_value ORDER BY $order_by $order_dir LIMIT $sql_search_limit"; 195 198 break; … … 199 202 $sql_query = "SELECT guid,name,account,race,class,zone,map, 200 203 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_HONOR_KILL+1)."), ' ', -1) AS UNSIGNED) AS highest_rank,online, 201 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_LEVEL+1)."), ' ', -1) AS UNSIGNED) AS level FROM `character` 204 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_LEVEL+1)."), ' ', -1) AS UNSIGNED) AS level FROM `character` 202 205 WHERE SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_GOLD+1)."), ' ', -1) > $search_value ORDER BY $order_by $order_dir LIMIT $sql_search_limit"; 203 206 break; 204 207 205 208 case "guild": 206 $sql->connect($ mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);209 $sql->connect($characters_db[$realm_id]['addr'], $characters_db[$realm_id]['user'], $characters_db[$realm_id]['pass'], $characters_db[$realm_id]['name']); 207 210 $result = $sql->query("SELECT guildid FROM guild WHERE name LIKE '%$search_value%'"); 208 211 $guildid = $sql->result($result, 0, 'guildid'); 209 212 210 $result = $sql->query("SELECT guid FROM guild_member WHERE guildid = $guildid"); 213 $Q1 = "SELECT guid FROM guild_member WHERE guildid = "; 214 $Q1 .= $guildid; 215 216 $result = $sql->query($Q1); 211 217 212 218 $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, 217 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_HONOR_KILL+1)."), ' ', -1) AS UNSIGNED) AS highest_rank,online, 218 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_LEVEL+1)."), ' ', -1) AS UNSIGNED) AS level FROM `character` 219 while ($char = $sql->fetch_row($result)) { 220 $where_out .= " ,"; 221 $where_out .= $char[0]; 222 }; 223 $where_out .= ") "; 224 225 $sql_query = "SELECT guid,name,account,race,class,zone,map, 226 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_HONOR_KILL+1)."), ' ', -1) AS UNSIGNED) AS highest_rank,online, 227 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_LEVEL+1)."), ' ', -1) AS UNSIGNED) AS level FROM `character` 219 228 WHERE $where_out ORDER BY $order_by $order_dir LIMIT $sql_search_limit"; 220 229 break; 221 230 222 231 case "item": 223 $sql->connect($ mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);232 $sql->connect($characters_db[$realm_id]['addr'], $characters_db[$realm_id]['user'], $characters_db[$realm_id]['pass'], $characters_db[$realm_id]['name']); 224 233 $result = $sql->query("SELECT guid FROM character_inventory WHERE item_template = '$search_value'"); 225 234 226 235 $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, 231 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_HONOR_KILL+1)."), ' ', -1) AS UNSIGNED) AS highest_rank,online, 232 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_LEVEL+1)."), ' ', -1) AS UNSIGNED) AS level FROM `character` 236 while ($char = $sql->fetch_row($result)) { 237 $where_out .= " ,"; 238 $where_out .= $char[0]; 239 }; 240 $where_out .= ") "; 241 242 $sql_query = "SELECT guid,name,account,race,class,zone,map, 243 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_HONOR_KILL+1)."), ' ', -1) AS UNSIGNED) AS highest_rank,online, 244 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_LEVEL+1)."), ' ', -1) AS UNSIGNED) AS level FROM `character` 233 245 WHERE $where_out ORDER BY $order_by $order_dir LIMIT $sql_search_limit"; 234 246 break; 235 247 236 248 case "greater_rank": 237 249 if (!is_numeric($search_value)) $search_value = 0; 238 250 $sql_query = "SELECT guid,name,account,race,class,zone,map, 239 251 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_HONOR_KILL+1)."), ' ', -1) AS UNSIGNED) AS highest_rank,online, 240 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_LEVEL+1)."), ' ', -1) AS UNSIGNED) AS level FROM `character` 252 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_LEVEL+1)."), ' ', -1) AS UNSIGNED) AS level FROM `character` 241 253 WHERE SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_HONOR_KILL+1)."), ' ', -1) > $search_value ORDER BY $order_by $order_dir LIMIT $sql_search_limit"; 242 254 break; … … 245 257 $sql_query = "SELECT guid,name,account,race,class,zone,map, 246 258 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_HONOR_KILL+1)."), ' ', -1) AS UNSIGNED) AS highest_rank,online, 247 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_LEVEL+1)."), ' ', -1) AS UNSIGNED) AS level FROM `character` 259 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_LEVEL+1)."), ' ', -1) AS UNSIGNED) AS level FROM `character` 248 260 WHERE SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_HONOR_KILL+1)."), ' ', -1) = $search_value ORDER BY $order_by $order_dir LIMIT $sql_search_limit"; 249 261 break; … … 252 264 $sql_query = "SELECT guid,name,account,race,class,zone,map, 253 265 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_HONOR_KILL+1)."), ' ', -1) AS UNSIGNED) AS highest_rank,online, 254 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_LEVEL+1)."), ' ', -1) AS UNSIGNED) AS level FROM `character` 266 CAST( SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_LEVEL+1)."), ' ', -1) AS UNSIGNED) AS level FROM `character` 255 267 WHERE $search_by LIKE '%$search_value%' ORDER BY $order_by $order_dir LIMIT $sql_search_limit"; 256 268 } 257 269 258 $sql->connect($ mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);270 $sql->connect($characters_db[$realm_id]['addr'], $characters_db[$realm_id]['user'], $characters_db[$realm_id]['pass'], $characters_db[$realm_id]['name']); 259 271 260 272 $query = $sql->query($sql_query); … … 298 310 <input type=\"hidden\" name=\"action\" value=\"del_char_form\" /> 299 311 <table class=\"lined\"> 300 <tr> 312 <tr> 301 313 <th width=\"5%\"><input name=\"allbox\" type=\"checkbox\" value=\"Check All\" onclick=\"CheckAll(document.form1);\" /></td> 302 314 <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> … … 313 325 314 326 $sql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']); 315 327 316 328 while ($char = $sql->fetch_row($query)){ 317 329 … … 319 331 $owner_gmlvl = $sql->result($result, 0, 'gmlevel'); 320 332 $owner_acc_name = $sql->result($result, 0, 'username'); 321 333 322 334 if (($user_lvl >= $owner_gmlvl)||($owner_acc_name == $user_name)){ 323 335 $output .= "<tr>"; … … 361 373 //######################################################################################################################## 362 374 function del_char_form() { 363 global $lang_global, $lang_char_list, $output, $realm_id, $ mangos_db;375 global $lang_global, $lang_char_list, $output, $realm_id, $characters_db; 364 376 if(isset($_GET['check'])) $check = $_GET['check']; 365 377 else redirect("char_list.php?error=1"); … … 372 384 373 385 $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']);386 $sql->connect($characters_db[$realm_id]['addr'], $characters_db[$realm_id]['user'], $characters_db[$realm_id]['pass'], $characters_db[$realm_id]['name']); 375 387 376 388 for ($i=0; $i<count($check); $i++){ … … 381 393 382 394 $sql->close(); 383 395 384 396 $output .= "<br />{$lang_global['will_be_erased']}</font><br /><br /> 385 397 <table class=\"hidden\"> … … 397 409 //######################################################################################################################## 398 410 function dodel_char() { 399 global $lang_global, $lang_char_list, $output, $realm_db, $ mangos_db, $realm_id, $user_lvl,400 $tab_del_user_ mangos, $user_name;411 global $lang_global, $lang_char_list, $output, $realm_db, $characters_db, $realm_id, $user_lvl, 412 $tab_del_user_characters, $user_name; 401 413 402 414 $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 415 $sql->connect($characters_db[$realm_id]['addr'], $characters_db[$realm_id]['user'], $characters_db[$realm_id]['pass'], $characters_db[$realm_id]['name']); 416 405 417 if(isset($_GET['check'])) $check = $sql->quote_smart($_GET['check']); 406 418 else redirect("char_list.php?error=1"); … … 408 420 $deleted_chars = 0; 409 421 require_once("./scripts/del_lib.php"); 410 422 411 423 for ($i=0; $i<count($check); $i++) { 412 424 if ($check[$i] != "" ) { … … 417 429 $sql->close(); 418 430 $output .= "<center>"; 419 if (!$deleted_chars) $output .= "<h1><font class=\"error\">{$lang_char_list['no_chars_del']}</font></h1>"; 431 if (!$deleted_chars) $output .= "<h1><font class=\"error\">{$lang_char_list['no_chars_del']}</font></h1>"; 420 432 else $output .= "<h1><font class=\"error\">{$lang_char_list['total']} <font color=blue>$deleted_chars</font> {$lang_char_list['chars_deleted']}</font></h1>"; 421 433 $output .= "<br /><br />"; … … 453 465 454 466 switch ($action) { 455 case "browse_chars": 467 case "browse_chars": 456 468 browse_chars(); 457 469 break; 458 case "search": 470 case "search": 459 471 search(); 460 472 break; 461 case "del_char_form": 473 case "del_char_form": 462 474 del_char_form(); 463 475 break; 464 case "dodel_char": 476 case "dodel_char": 465 477 dodel_char(); 466 478 break;
Note:
See TracChangeset
for help on using the changeset viewer.