Ignore:
Timestamp:
Aug 13, 2007, 9:05:34 PM (17 years ago)
Author:
george
Message:

Aktualizace MaNGOS Minimanageru na verzi 0.1.4a.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • minimanager/scripts/del_lib.php

    r5 r19  
    1616        global $mangos_db, $realm_db, $user_lvl, $user_id, $tab_del_user_mangos;
    1717
    18         $mysql_01 = new MySQL;
    19         $mysql_01->connect($mangos_db[$realm]['addr'], $mangos_db[$realm]['user'], $mangos_db[$realm]['pass'], $mangos_db[$realm]['name']);
    20         $query = $mysql_01->query("SELECT account,online FROM `character` WHERE guid ='$guid' LIMIT 1");
    21         $owner_acc_id = $mysql_01->result($query, 0, 'account');
    22         $mysql_01->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);
    23         $query1 = $mysql_01->query("SELECT gmlevel FROM account WHERE id ='$owner_acc_id'");
    24         $owner_gmlvl = $mysql_01->result($query1, 0, 'gmlevel');
     18        $sql_01 = new SQL;
     19        $sql_01->connect($mangos_db[$realm]['addr'], $mangos_db[$realm]['user'], $mangos_db[$realm]['pass'], $mangos_db[$realm]['name']);
     20        $query = $sql_01->query("SELECT account,online FROM `character` WHERE guid ='$guid' LIMIT 1");
     21        $owner_acc_id = $sql_01->result($query, 0, 'account');
     22        $sql_01->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);
     23        $query1 = $sql_01->query("SELECT gmlevel FROM account WHERE id ='$owner_acc_id'");
     24        $owner_gmlvl = $sql_01->result($query1, 0, 'gmlevel');
    2525        unset($query1);
    2626       
    2727        if (($user_lvl > $owner_gmlvl)||($owner_acc_id == $user_id)) {
    28                 $mysql_01->connect($mangos_db[$realm]['addr'], $mangos_db[$realm]['user'], $mangos_db[$realm]['pass'], $mangos_db[$realm]['name']);
     28                $sql_01->connect($mangos_db[$realm]['addr'], $mangos_db[$realm]['user'], $mangos_db[$realm]['pass'], $mangos_db[$realm]['name']);
    2929
    30                 if (!$mysql_01->result($query, 0, 'online')){
     30                if (!$sql_01->result($query, 0, 'online')){
    3131                        foreach ($tab_del_user_mangos as $value){
    32                                 $query = $mysql_01->query("DELETE FROM {$value[0]} WHERE {$value[1]} = '$guid'");
     32                                $query = $sql_01->query("DELETE FROM {$value[0]} WHERE {$value[1]} = '$guid'");
    3333                                }
    3434
    35                         $mysql_01->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);
    36                         $query_2 = $mysql_01->query("SELECT numchars FROM realmcharacters WHERE acctid ='$owner_acc_id' AND realmid = '$realm'");
    37                         $chars_in_acc = $mysql_01->result($query_2, 0, 'numchars');
     35                        $sql_01->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);
     36                        $query_2 = $sql_01->query("SELECT numchars FROM realmcharacters WHERE acctid ='$owner_acc_id' AND realmid = '$realm'");
     37                        $chars_in_acc = $sql_01->result($query_2, 0, 'numchars');
    3838                        if ($chars_in_acc) $chars_in_acc--;
    3939                                else $chars_in_acc = 0;
    40                         $query_2 = $mysql_01->query("UPDATE realmcharacters SET numchars='$chars_in_acc' WHERE acctid ='$owner_acc_id' AND realmid = '$realm'");
     40                        $query_2 = $sql_01->query("UPDATE realmcharacters SET numchars='$chars_in_acc' WHERE acctid ='$owner_acc_id' AND realmid = '$realm'");
    4141
    42                         $mysql_01->close();
     42                        $sql_01->close();
    4343                        return true;
    4444                        }
    4545                }
    46         $mysql_01->close();
     46        $sql_01->close();
    4747        return false;
    4848}
     
    5555        $del_char = 0;
    5656
    57         $mysql_01 = new MySQL;
    58         $mysql_01->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);
    59         $query = $mysql_01->query("SELECT gmlevel,online FROM account WHERE id ='$acc_id'");
    60         $gmlevel = $mysql_01->result($query, 0, 'gmlevel');
     57        $sql_01 = new SQL;
     58        $sql_01->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);
     59        $query = $sql_01->query("SELECT gmlevel,online FROM account WHERE id ='$acc_id'");
     60        $gmlevel = $sql_01->result($query, 0, 'gmlevel');
    6161
    6262        if (($user_lvl > $gmlevel)||($acc_id == $user_id)) {
    63                 if (!$mysql_01->result($query, 0, 'online')){
     63                if (!$sql_01->result($query, 0, 'online')){
    6464                foreach ($mangos_db as $db){
    65                         $mysql_01->connect($db['addr'], $db['user'], $db['pass'], $db['name']);
    66                         $result = $mysql_01->query("SELECT guid FROM `character` WHERE account='$acc_id'");
    67                         while ($row = $mysql_01->fetch_array($result)) {
     65                        $sql_01->connect($db['addr'], $db['user'], $db['pass'], $db['name']);
     66                        $result = $sql_01->query("SELECT guid FROM `character` WHERE account='$acc_id'");
     67                        while ($row = $sql_01->fetch_array($result)) {
    6868                                        foreach ($tab_del_user_mangos as $value)
    69                                         $query = $mysql_01->query("DELETE FROM $value[0] WHERE $value[1] = '$row[0]'");
     69                                        $query = $sql_01->query("DELETE FROM $value[0] WHERE $value[1] = '$row[0]'");
    7070                                $del_char++;
    7171                        }
    7272                }
    7373
    74                 $mysql_01->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);
     74                $sql_01->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);
    7575
    7676                foreach ($tab_del_user_realmd as $value){
    77                                 $query = $mysql_01->query("DELETE FROM $value[0] WHERE $value[1] = '$acc_id'");
     77                                $query = $sql_01->query("DELETE FROM $value[0] WHERE $value[1] = '$acc_id'");
    7878                                }
    79                 if ($mysql_01->affected_rows()) {
    80                         $mysql_01->close();
     79                if ($sql_01->affected_rows()) {
     80                        $sql_01->close();
    8181                        return array(true,$del_char);
    8282                        }
    8383                }
    8484        }
    85         $mysql_01->close();
     85        $sql_01->close();
    8686        return array(false,$del_char);
    8787}
     
    9595        require_once("scripts/defines.php");
    9696       
    97         $mysql_01 = new MySQL;
    98         $mysql_01->connect($mangos_db[$realm]['addr'], $mangos_db[$realm]['user'], $mangos_db[$realm]['pass'], $mangos_db[$realm]['name']);
    99         $query = $mysql_01->query("DELETE FROM guild WHERE guildid = '$guid'");
    100         $query = $mysql_01->query("DELETE FROM guild_rank WHERE guildid = '$guid'");
     97        $sql_01 = new SQL;
     98        $sql_01->connect($mangos_db[$realm]['addr'], $mangos_db[$realm]['user'], $mangos_db[$realm]['pass'], $mangos_db[$realm]['name']);
     99        $query = $sql_01->query("DELETE FROM guild WHERE guildid = '$guid'");
     100        $query = $sql_01->query("DELETE FROM guild_rank WHERE guildid = '$guid'");
    101101               
    102102        //clean data inside character.data field
    103         $temp = $mysql_01->query("SELECT guid FROM guild_member WHERE guildid = '$guid'");
    104         while ($guild_member = $mysql_01->fetch_row($temp)){
    105                 $char_data = $mysql_01->query("SELECT data FROM `character` WHERE guid = '$guild_member[0]'");
    106                 $data = $mysql_01->result($char_data, 0, 'data');
     103        $temp = $sql_01->query("SELECT guid FROM guild_member WHERE guildid = '$guid'");
     104        while ($guild_member = $sql_01->fetch_row($temp)){
     105                $char_data = $sql_01->query("SELECT data FROM `character` WHERE guid = '$guild_member[0]'");
     106                $data = $sql_01->result($char_data, 0, 'data');
    107107                $data = explode(' ',$data);
    108108                $data[CHAR_DATA_OFFSET_GUILD_ID] = 0;
    109109                $data[CHAR_DATA_OFFSET_GUILD_RANK] = 0;
    110110                $data = implode(" ",$data);
    111                 $query = $mysql_01->query("UPDATE `character` SET data = '$data' WHERE guid = '$guild_member[0]'");
     111                $query = $sql_01->query("UPDATE `character` SET data = '$data' WHERE guid = '$guild_member[0]'");
    112112                }
    113113
    114         $query = $mysql_01->query("DELETE FROM guild_member WHERE guildid = '$guid'");
     114        $query = $sql_01->query("DELETE FROM guild_member WHERE guildid = '$guid'");
    115115
    116         if ($mysql_01->affected_rows()){
    117                 $mysql_01->close();
     116        if ($sql_01->affected_rows()){
     117                $sql_01->close();
    118118                return true;
    119119                } else {
    120                                 $mysql_01->close();
     120                                $sql_01->close();
    121121                                return false;
    122122                                }
Note: See TracChangeset for help on using the changeset viewer.