Changeset 19 for minimanager/cleanup.php


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/cleanup.php

    r5 r19  
    6666 if( empty($_GET['cleanup_by']) || empty($_GET['cleanup_sign']) ) redirect("cleanup.php?error=1");
    6767
    68  $mysql = new MySQL;
    69  $mysql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass']);
    70 
    71  $cleanup_by = $mysql->quote_smart($_GET['cleanup_by']);
    72  $cleanup_sign = $mysql->quote_smart($_GET['cleanup_sign']);
    73  $cleanup_value = $mysql->quote_smart($_GET['cleanup_value']);
     68 $sql = new SQL;
     69 $sql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);
     70
     71 $cleanup_by = $sql->quote_smart($_GET['cleanup_by']);
     72 $cleanup_sign = $sql->quote_smart($_GET['cleanup_sign']);
     73 $cleanup_value = $sql->quote_smart($_GET['cleanup_value']);
    7474
    7575switch ($cleanup_by) {
    7676 // clean by lvl
    7777 case "char_lvl":
    78  $mysql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
    79 
    80  $result = $mysql->query("SELECT guid FROM `character` WHERE SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 35), ' ', -1) $cleanup_sign $cleanup_value");
    81  $total_chars = $mysql->num_rows($result);
     78 $sql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
     79
     80 $result = $sql->query("SELECT guid FROM `character` WHERE SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 35), ' ', -1) $cleanup_sign $cleanup_value");
     81 $total_chars = $sql->num_rows($result);
    8282
    8383 $output .= "<center>";
     
    9090        $pass_array = "";
    9191
    92          while($char = $mysql->fetch_row($result)){
     92         while($char = $sql->fetch_row($result)){
    9393                $output .= "<a href=\"char.php?id=$char[0]\" target=\"_blank\">$char[0], </a>";
    9494                $pass_array .= "-$char[0]";
     
    117117//last loggin
    118118 case "last_login":
    119   $mysql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);
    120 
    121   $result = $mysql->query("SELECT id FROM account WHERE last_login $cleanup_sign '$cleanup_value' AND gmlevel < $user_lvl");
    122   $total_accounts = $mysql->num_rows($result);
     119  $sql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);
     120
     121  $result = $sql->query("SELECT id FROM account WHERE last_login $cleanup_sign '$cleanup_value' AND gmlevel < $user_lvl");
     122  $total_accounts = $sql->num_rows($result);
    123123
    124124  $output .= "<center>";
     
    131131  $pass_array = "";
    132132
    133   while($acc = $mysql->fetch_row($result)){
     133  while($acc = $sql->fetch_row($result)){
    134134        $output .= "<a href=\"user.php?action=edit_user&amp;id=$acc[0]\" target=\"_blank\">$acc[0], </a>";
    135135        $pass_array .= "-$acc[0]";
     
    158158 //failed loggin attempts
    159159case "failed_login":
    160  $mysql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);
    161 
    162  $result = $mysql->query("SELECT id FROM account WHERE failed_logins $cleanup_sign $cleanup_value AND gmlevel < $user_lvl");
    163  $total_accounts = $mysql->num_rows($result);
     160 $sql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);
     161
     162 $result = $sql->query("SELECT id FROM account WHERE failed_logins $cleanup_sign $cleanup_value AND gmlevel < $user_lvl");
     163 $total_accounts = $sql->num_rows($result);
    164164
    165165 $output .= "<center>";
     
    172172 $pass_array = "";
    173173
    174  while($acc = $mysql->fetch_row($result)){
     174 while($acc = $sql->fetch_row($result)){
    175175                $output .= "<a href=\"user.php?action=edit_user&amp;id=$acc[0]\" target=\"_blank\">$acc[0], </a>";
    176176                $pass_array .= "-$acc[0]";
     
    200200//clean banned accounts
    201201case "banned":
    202  $mysql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);
    203 
    204  $result = $mysql->query("SELECT id FROM account_banned");
    205  $total_accounts = $mysql->num_rows($result);
     202 $sql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);
     203
     204 $result = $sql->query("SELECT id FROM account_banned");
     205 $total_accounts = $sql->num_rows($result);
    206206
    207207 $output .= "<center>";
     
    214214        $pass_array = "";
    215215
    216         while($acc = $mysql->fetch_row($result)){
     216        while($acc = $sql->fetch_row($result)){
    217217                $output .= "<a href=\"user.php?action=edit_user&amp;id=$acc[0]\" target=\"_blank\">$acc[0], </a>";
    218218                $pass_array .= "-$acc[0]";
     
    241241//clean chars with given total time played
    242242case "totaltime":
    243  $mysql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
    244 
    245  $result = $mysql->query("SELECT guid FROM `character` WHERE totaltime $cleanup_sign $cleanup_value");
    246  $total_chars = $mysql->num_rows($result);
     243 $sql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
     244
     245 $result = $sql->query("SELECT guid FROM `character` WHERE totaltime $cleanup_sign $cleanup_value");
     246 $total_chars = $sql->num_rows($result);
    247247
    248248 $output .= "<center>";
     
    255255        $pass_array = "";
    256256
    257         while($char = $mysql->fetch_row($result)){
     257        while($char = $sql->fetch_row($result)){
    258258                $output .= "<a href=\"char.php?id=$char[0]\" target=\"_blank\">$char[0], </a>";
    259259                $pass_array .= "-$char[0]";
     
    283283//clean locked acc
    284284case "locked":
    285  $mysql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);
    286 
    287  $result = $mysql->query("SELECT id FROM account WHERE locked $cleanup_sign $cleanup_value AND gmlevel < $user_lvl");
    288  $total_accounts = $mysql->num_rows($result);
     285 $sql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);
     286
     287 $result = $sql->query("SELECT id FROM account WHERE locked $cleanup_sign $cleanup_value AND gmlevel < $user_lvl");
     288 $total_accounts = $sql->num_rows($result);
    289289
    290290 $output .= "<center>";
     
    297297        $pass_array = "";
    298298
    299         while($acc = $mysql->fetch_row($result)){
     299        while($acc = $sql->fetch_row($result)){
    300300                $output .= "<a href=\"user.php?action=edit_user&amp;id=$acc[0]\" target=\"_blank\">$acc[0], </a>";
    301301                $pass_array .= "-$acc[0]";
     
    325325//accounts without chars or specified number of chars
    326326case "num_of_char_in_acc":
    327  $mysql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);
    328 
    329  $result = $mysql->query("SELECT id FROM account WHERE gmlevel < $user_lvl");
     327 $sql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);
     328
     329 $result = $sql->query("SELECT id FROM account WHERE gmlevel < $user_lvl");
    330330
    331331 $acc_output_array = array();
    332332
    333  while($acc = $mysql->fetch_row($result)){
     333 while($acc = $sql->fetch_row($result)){
    334334        $total_chars_in_acc = 0;
    335335        foreach ($mangos_db as $db){
    336                 $mysql->connect($db['addr'], $db['user'], $db['pass'], $db['name']);
    337 
    338                 $query = $mysql->query("SELECT count(*) FROM `character` WHERE account = '$acc[0]'");
    339                 $total_chars_in_acc = $total_chars_in_acc + $mysql->result($query, 0);
     336                $sql->connect($db['addr'], $db['user'], $db['pass'], $db['name']);
     337
     338                $query = $sql->query("SELECT count(*) FROM `character` WHERE account = '$acc[0]'");
     339                $total_chars_in_acc = $total_chars_in_acc + $sql->result($query, 0);
    340340        }
    341341
     
    401401//guild  without chars or specified number of chars
    402402case "num_of_char_in_guild":
    403  $mysql->connect($mangos_db[$realm_id]['addr'], $mangos_db[$realm_id]['user'], $mangos_db[$realm_id]['pass'], $mangos_db[$realm_id]['name']);
    404 
    405  $result = $mysql->query("SELECT guildid FROM guild");
     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 $result = $sql->query("SELECT guildid FROM guild");
    406406
    407407 $guild_output_array = array();
    408408
    409  while($guild = $mysql->fetch_row($result)){
    410         $query = $mysql->query("SELECT count(*) FROM guild_member WHERE guildid = '$guild[0]'");
    411         $total_chars_in_guild = $mysql->result($query, 0);
     409 while($guild = $sql->fetch_row($result)){
     410        $query = $sql->query("SELECT count(*) FROM guild_member WHERE guildid = '$guild[0]'");
     411        $total_chars_in_guild = $sql->result($query, 0);
    412412
    413413        switch ($cleanup_sign){
     
    473473}
    474474
    475  $mysql->close();
     475 $sql->close();
    476476}
    477477
     
    486486 if (!isset($_POST['type']) || $_POST['type'] === '') redirect("cleanup.php?error=1");
    487487
    488  $mysql = new MySQL;
    489  $mysql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass']);
    490 
    491  $type = $mysql->quote_smart($_POST['type']);
     488 $sql = new SQL;
     489 $sql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);
     490
     491 $type = $sql->quote_smart($_POST['type']);
    492492 if(isset($_POST['check']) && $_POST['check'] != '') {
    493                 $check = $mysql->quote_smart($_POST['check']);
     493                $check = $sql->quote_smart($_POST['check']);
    494494                $check = explode('-',$check);
    495495        } else redirect("cleanup.php?error=1");
     
    538538}
    539539
    540  $mysql->close();
     540 $sql->close();
    541541
    542542 $output .= "<center>";
Note: See TracChangeset for help on using the changeset viewer.