Ignore:
Timestamp:
Nov 23, 2007, 11:29:33 PM (17 years ago)
Author:
george
Message:

Minimanager 0.1.5b

File:
1 edited

Legend:

Unmodified
Added
Removed
  • minimanager/char_list.php

    r19 r142  
    88 * License: GNU General Public License v2(GPL)
    99 */
    10  
     10
    1111require_once("header.php");
    1212valid_login(1);
     
    1818//########################################################################################################################
    1919function 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,
    2121                $user_lvl,$user_name;
    2222
    2323 $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']);
    2525
    2626 $start = (isset($_GET['start'])) ? $sql->quote_smart($_GET['start']) : 0;
    2727 $order_by = (isset($_GET['order_by'])) ? $sql->quote_smart($_GET['order_by']) :"guid";
    28  
     28
    2929 $dir = (isset($_GET['dir'])) ? $sql->quote_smart($_GET['dir']) : 1;
    3030 $order_dir = ($dir) ? "ASC" : "DESC";
     
    3636 $query = $sql->query("SELECT guid,name,account,race,class,zone,map,
    3737                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
    3939                FROM `character` ORDER BY $order_by $order_dir LIMIT $start, $itemperpage");
    4040 $this_page = $sql->num_rows($query) or die(error($lang_global['err_no_result']));
     
    4444                        <center><table class=\"top_hidden\">
    4545                        <tr><td>
    46                                 <table class=\"hidden\"> 
     46                                <table class=\"hidden\">
    4747                                        <tr><td>";
    4848 makebutton($lang_char_list['cleanup'], "cleanup.php", 110);
     
    8282        <input type=\"hidden\" name=\"start\" value=\"$start\" />
    8383  <table class=\"lined\">
    84    <tr> 
     84   <tr>
    8585        <th width=\"5%\"><input name=\"allbox\" type=\"checkbox\" value=\"Check All\" onclick=\"CheckAll(document.form1);\" /></th>
    8686        <th width=\"5%\"><a href=\"char_list.php?order_by=guid&amp;start=$start&amp;dir=$dir\">".($order_by=='guid' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_char_list['id']}</a></th>
     
    9999
    100100 $sql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);
    101  
     101
    102102 for ($i=1; $i<=$looping; $i++) {
    103103    $char = $sql->fetch_row($query) or die(error($lang_global['err_no_user']));
     
    138138 </table>
    139139 </form><br /></center>";
    140  
     140
    141141 $sql->close();
    142142}
     
    147147//########################################################################################################################
    148148function 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,
    150150                $user_lvl, $user_name, $sql_search_limit;
    151151
     
    154154 $sql = new SQL;
    155155 $sql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);
    156  
     156
    157157 $search_value = $sql->quote_smart($_GET['search_value']);
    158158 $search_by = (isset($_GET['search_by'])) ? $sql->quote_smart($_GET['search_by']) : "name";
    159159 $order_by = (isset($_GET['order_by'])) ? $sql->quote_smart($_GET['order_by']) : "guid";
    160  
     160
    161161 $dir = (isset($_GET['dir'])) ? $sql->quote_smart($_GET['dir']) : 1;
    162162 $order_dir = ($dir) ? "ASC" : "DESC";
    163163 $dir = ($dir) ? 0 : 1;
    164  
     164
    165165 switch ($search_by){
    166166 //need to get the acc id from other table since input comes as name
     
    169169        $result = $sql->query("SELECT id FROM account WHERE username LIKE '%$search_value%' LIMIT $sql_search_limit");
    170170
    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
    178181        FROM `character` WHERE $where_out ORDER BY $order_by $order_dir LIMIT $sql_search_limit";
    179182 break;
     
    183186        $sql_query = "SELECT guid,name,account,race,class,zone,map,
    184187        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`
    186189        WHERE SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_LEVEL+1)."), ' ', -1) = $search_value ORDER BY $order_by $order_dir LIMIT $sql_search_limit";
    187190 break;
     
    191194        $sql_query = "SELECT guid,name,account,race,class,zone,map,
    192195        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`
    194197        WHERE SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_LEVEL+1)."), ' ', -1) > $search_value ORDER BY $order_by $order_dir LIMIT $sql_search_limit";
    195198 break;
     
    199202        $sql_query = "SELECT guid,name,account,race,class,zone,map,
    200203        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`
    202205        WHERE SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', ".(CHAR_DATA_OFFSET_GOLD+1)."), ' ', -1) > $search_value ORDER BY $order_by $order_dir LIMIT $sql_search_limit";
    203206 break;
    204  
     207
    205208 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']);
    207210        $result = $sql->query("SELECT guildid FROM guild WHERE name LIKE '%$search_value%'");
    208211        $guildid = $sql->result($result, 0, 'guildid');
    209212
    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);
    211217
    212218        $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`
    219228        WHERE $where_out ORDER BY $order_by $order_dir LIMIT $sql_search_limit";
    220229 break;
    221230
    222231  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']);
    224233        $result = $sql->query("SELECT guid FROM character_inventory WHERE item_template = '$search_value'");
    225234
    226235        $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`
    233245        WHERE $where_out ORDER BY $order_by $order_dir LIMIT $sql_search_limit";
    234246 break;
    235  
     247
    236248 case "greater_rank":
    237249        if (!is_numeric($search_value)) $search_value = 0;
    238250        $sql_query = "SELECT guid,name,account,race,class,zone,map,
    239251        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`
    241253        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";
    242254 break;
     
    245257        $sql_query = "SELECT guid,name,account,race,class,zone,map,
    246258        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`
    248260        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";
    249261 break;
     
    252264    $sql_query = "SELECT guid,name,account,race,class,zone,map,
    253265        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`
    255267        WHERE $search_by LIKE '%$search_value%' ORDER BY $order_by $order_dir LIMIT $sql_search_limit";
    256268 }
    257269
    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']);
    259271
    260272 $query = $sql->query($sql_query);
     
    298310         <input type=\"hidden\" name=\"action\" value=\"del_char_form\" />
    299311   <table class=\"lined\">
    300    <tr> 
     312   <tr>
    301313        <th width=\"5%\"><input name=\"allbox\" type=\"checkbox\" value=\"Check All\" onclick=\"CheckAll(document.form1);\" /></td>
    302314        <th width=\"5%\><a href=\"char_list.php?action=search&amp;error=3&amp;search_value=$search_value&amp;search_by=$search_by&amp;order_by=guid&amp;dir=$dir\">".($order_by=='guid' ? "<img src=\"img/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_char_list['id']}</a></th>
     
    313325
    314326 $sql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);
    315  
     327
    316328 while ($char = $sql->fetch_row($query)){
    317329
     
    319331        $owner_gmlvl = $sql->result($result, 0, 'gmlevel');
    320332        $owner_acc_name = $sql->result($result, 0, 'username');
    321        
     333
    322334  if (($user_lvl >= $owner_gmlvl)||($owner_acc_name == $user_name)){
    323335                 $output .= "<tr>";
     
    361373//########################################################################################################################
    362374function del_char_form() {
    363 global  $lang_global, $lang_char_list, $output, $realm_id, $mangos_db;
     375global  $lang_global, $lang_char_list, $output, $realm_id, $characters_db;
    364376 if(isset($_GET['check'])) $check = $_GET['check'];
    365377        else redirect("char_list.php?error=1");
     
    372384
    373385 $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']);
    375387
    376388 for ($i=0; $i<count($check); $i++){
     
    381393
    382394 $sql->close();
    383  
     395
    384396 $output .= "<br />{$lang_global['will_be_erased']}</font><br /><br />
    385397                <table class=\"hidden\">
     
    397409//########################################################################################################################
    398410function 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;
    401413
    402414 $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
    405417 if(isset($_GET['check'])) $check = $sql->quote_smart($_GET['check']);
    406418        else redirect("char_list.php?error=1");
     
    408420 $deleted_chars = 0;
    409421 require_once("./scripts/del_lib.php");
    410  
     422
    411423 for ($i=0; $i<count($check); $i++) {
    412424    if ($check[$i] != "" ) {
     
    417429 $sql->close();
    418430 $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>";
    420432   else $output .= "<h1><font class=\"error\">{$lang_char_list['total']} <font color=blue>$deleted_chars</font> {$lang_char_list['chars_deleted']}</font></h1>";
    421433 $output .= "<br /><br />";
     
    453465
    454466switch ($action) {
    455 case "browse_chars": 
     467case "browse_chars":
    456468   browse_chars();
    457469   break;
    458 case "search": 
     470case "search":
    459471   search();
    460472   break;
    461 case "del_char_form": 
     473case "del_char_form":
    462474   del_char_form();
    463475   break;
    464 case "dodel_char": 
     476case "dodel_char":
    465477   dodel_char();
    466478   break;
Note: See TracChangeset for help on using the changeset viewer.