Changeset 19 for minimanager/cleanup.php
- Timestamp:
- Aug 13, 2007, 9:05:34 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
minimanager/cleanup.php
r5 r19 66 66 if( empty($_GET['cleanup_by']) || empty($_GET['cleanup_sign']) ) redirect("cleanup.php?error=1"); 67 67 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']); 74 74 75 75 switch ($cleanup_by) { 76 76 // clean by lvl 77 77 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); 82 82 83 83 $output .= "<center>"; … … 90 90 $pass_array = ""; 91 91 92 while($char = $ mysql->fetch_row($result)){92 while($char = $sql->fetch_row($result)){ 93 93 $output .= "<a href=\"char.php?id=$char[0]\" target=\"_blank\">$char[0], </a>"; 94 94 $pass_array .= "-$char[0]"; … … 117 117 //last loggin 118 118 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); 123 123 124 124 $output .= "<center>"; … … 131 131 $pass_array = ""; 132 132 133 while($acc = $ mysql->fetch_row($result)){133 while($acc = $sql->fetch_row($result)){ 134 134 $output .= "<a href=\"user.php?action=edit_user&id=$acc[0]\" target=\"_blank\">$acc[0], </a>"; 135 135 $pass_array .= "-$acc[0]"; … … 158 158 //failed loggin attempts 159 159 case "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); 164 164 165 165 $output .= "<center>"; … … 172 172 $pass_array = ""; 173 173 174 while($acc = $ mysql->fetch_row($result)){174 while($acc = $sql->fetch_row($result)){ 175 175 $output .= "<a href=\"user.php?action=edit_user&id=$acc[0]\" target=\"_blank\">$acc[0], </a>"; 176 176 $pass_array .= "-$acc[0]"; … … 200 200 //clean banned accounts 201 201 case "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); 206 206 207 207 $output .= "<center>"; … … 214 214 $pass_array = ""; 215 215 216 while($acc = $ mysql->fetch_row($result)){216 while($acc = $sql->fetch_row($result)){ 217 217 $output .= "<a href=\"user.php?action=edit_user&id=$acc[0]\" target=\"_blank\">$acc[0], </a>"; 218 218 $pass_array .= "-$acc[0]"; … … 241 241 //clean chars with given total time played 242 242 case "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); 247 247 248 248 $output .= "<center>"; … … 255 255 $pass_array = ""; 256 256 257 while($char = $ mysql->fetch_row($result)){257 while($char = $sql->fetch_row($result)){ 258 258 $output .= "<a href=\"char.php?id=$char[0]\" target=\"_blank\">$char[0], </a>"; 259 259 $pass_array .= "-$char[0]"; … … 283 283 //clean locked acc 284 284 case "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); 289 289 290 290 $output .= "<center>"; … … 297 297 $pass_array = ""; 298 298 299 while($acc = $ mysql->fetch_row($result)){299 while($acc = $sql->fetch_row($result)){ 300 300 $output .= "<a href=\"user.php?action=edit_user&id=$acc[0]\" target=\"_blank\">$acc[0], </a>"; 301 301 $pass_array .= "-$acc[0]"; … … 325 325 //accounts without chars or specified number of chars 326 326 case "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"); 330 330 331 331 $acc_output_array = array(); 332 332 333 while($acc = $ mysql->fetch_row($result)){333 while($acc = $sql->fetch_row($result)){ 334 334 $total_chars_in_acc = 0; 335 335 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); 340 340 } 341 341 … … 401 401 //guild without chars or specified number of chars 402 402 case "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"); 406 406 407 407 $guild_output_array = array(); 408 408 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); 412 412 413 413 switch ($cleanup_sign){ … … 473 473 } 474 474 475 $ mysql->close();475 $sql->close(); 476 476 } 477 477 … … 486 486 if (!isset($_POST['type']) || $_POST['type'] === '') redirect("cleanup.php?error=1"); 487 487 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']); 492 492 if(isset($_POST['check']) && $_POST['check'] != '') { 493 $check = $ mysql->quote_smart($_POST['check']);493 $check = $sql->quote_smart($_POST['check']); 494 494 $check = explode('-',$check); 495 495 } else redirect("cleanup.php?error=1"); … … 538 538 } 539 539 540 $ mysql->close();540 $sql->close(); 541 541 542 542 $output .= "<center>";
Note:
See TracChangeset
for help on using the changeset viewer.