function insertRow($properties, $table, $db) { // create the INSERT sql query $sql = "INSERT INTO `" . $table . "` ("; reset($properties); while ($value = each($properties)) { $sql .= "`" . $value[0] . "`, "; } del_char($sql, 2); $sql .= ") VALUES ("; reset($properties); while ($value = each($properties)) { $sql .= "'" . $value[1] . "', "; } del_char($sql, 2); $sql .= ")"; #echo "<br>SQL Query: ".$sql."<br><br>"; // send the query mysql_select_db($db); mysql_query($sql); // return the id of the inserted row return mysql_insert_id(); }
function del_acc($acc_id) { global $characters_db, $logon_db, $corem_db, $realm_id, $user_lvl, $user_id, $tab_del_user_realmd, $tab_del_user_char, $tab_del_user_characters, $sql, $core; $del_char = 0; // get username name to delete from account table if ($core == 1) { $query = $sql["logon"]->query("SELECT login AS username FROM accounts WHERE acct='" . $acc_id . "'"); } else { $query = $sql["logon"]->query("SELECT username FROM account WHERE id='" . $acc_id . "'"); } $acct_name = $sql["logon"]->result($query, 0, "username"); // get the account's owner's SecurityLevel (not 100% perfect since we don't use the core gm) $query = $sql["mgr"]->query("SELECT SecurityLevel FROM config_accounts WHERE Login='******'"); $gmlevel = $sql["mgr"]->result($query, 0, "SecurityLevel"); if ($user_lvl >= gmlevel($gmlevel) || $acc_id == $user_id) { if ($core == 1) { $char_count_query = "SELECT COUNT(*) FROM characters WHERE acct='" . $acct_id . "'"; } else { $char_count_query = "SELECT COUNT(*) FROM characters WHERE account='" . $acct_id . "'"; } $online = $sql["char"]->result($sql["char"]->query($char_count_query), 0); if (!$online > 0) { foreach ($characters_db as $db) { $sqlx = new SQL(); $sqlx->connect($db["addr"], $db["user"], $db["pass"], $db["name"], $db["encoding"]); if ($core == 1) { $result = $sqlx->query("SELECT guid FROM characters WHERE acct='" . $acc_id . "'"); } else { $result = $sqlx->query("SELECT guid FROM characters WHERE account='" . $acc_id . "'"); } while ($row = $sqlx->fetch_assoc($result)) { $temp = del_char($row["guid"], $db["id"]); $del_char++; } // MaNGOS: Delete character_tutorial if ($core == 2) { $sqlx->query("DELETE FROM character_tutorial WHERE account='" . $owner_acc_id . "'"); } // Trinity: Delete account_tutorial if ($core == 3) { $sqlx->query("DELETE FROM account_tutorial WHERE accountId='" . $owner_acc_id . "'"); } // ArcEmu: Delete account_data for this user if ($core == 1) { $sqlx->query("DELETE FROM account_data WHERE acct='" . $owner_acc_id . "'"); } } if ($core == 1) { $sql["logon"]->query("DELETE FROM accounts WHERE acct='" . $acc_id . "'"); } else { $sql["logon"]->query("DELETE FROM account WHERE id='" . $acc_id . "'"); } $sql["mgr"]->query("DELETE FROM point_system_invites WHERE PlayersAccount='" . $acc_id . "'"); $sql["mgr"]->query("DELETE FROM config_accounts WHERE Login='******'"); if ($sql["logon"]->affected_rows()) { return array(true, $del_char); } } } return array(false, $del_char); }
function docleanup() { global $lang_cleanup, $lang_global, $output, $realm_db, $characters_db, $realm_id, $user_lvl, $tab_del_user_characters, $tab_del_user_characters_trinity, $tab_del_user_realmd; if ($server_type) { $tab_del_user_characters = $tab_del_user_characters_trinity; } if (!isset($_POST['type']) || $_POST['type'] === '') { redirect("cleanup.php?error=1"); } $sql = new SQL(); $sql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']); $type = $sql->quote_smart($_POST['type']); if (isset($_POST['check']) && $_POST['check'] != '') { $check = $sql->quote_smart($_POST['check']); $check = explode('-', $check); } else { redirect("cleanup.php?error=1"); } $deleted_acc = 0; $deleted_chars = 0; $deleted_gulds = 0; require_once "./libs/del_lib.php"; switch ($type) { //we deleting account array case "acc": for ($i = 1; $i < count($check); $i++) { if ($check[$i] != "") { list($flag, $del_char) = del_acc($check[$i]); if ($flag) { $deleted_acc++; $deleted_chars += $del_char; } } } break; //we deleting character array //we deleting character array case "char": for ($i = 1; $i < count($check); $i++) { if ($check[$i] != "") { if (del_char($check[$i], $realm_id)) { $deleted_chars++; } } } break; //cleaning guilds //cleaning guilds case "guild": for ($i = 1; $i < count($check); $i++) { if ($check[$i] != "") { if (del_guild($check[$i], $realm_id)) { $deleted_gulds++; } } } break; //cleaning arena teams //cleaning arena teams case "arenateam": for ($i = 1; $i < count($check); $i++) { if ($check[$i] != "") { if (del_arenateam($check[$i], $realm_id)) { $deleted_arenateams++; } } } break; default: redirect("cleanup.php?error=1"); } $sql->close(); unset($sql); $output .= "<center>"; if ($type == "guild") { if (!$deleted_gulds) { $output .= "<h1><font class=\"error\">{$lang_cleanup['no_guilds_del']}</font></h1>"; } else { $output .= "<h1><font class=\"error\">{$lang_cleanup['total']} <font color=blue>{$deleted_gulds}</font> {$lang_cleanup['guilds_deleted']}</font></h1>"; } } else { if ($type == "arenateam") { if (!$deleted_arenateams) { $output .= "<h1><font class=\"error\">{$lang_cleanup['no_arenateams_del']}</font></h1>"; } else { $output .= "<h1><font class=\"error\">{$lang_cleanup['total']} <font color=blue>{$deleted_arenateams}</font> {$lang_cleanup['arenateams_deleted']}</font></h1>"; } } else { if ($deleted_acc + $deleted_chars == 0) { $output .= "<h1><font class=\"error\">{$lang_cleanup['no_acc_chars_deleted']}</font></h1>"; } else { $output .= "<h1><font class=\"error\">{$lang_cleanup['total']} <font color=blue>{$deleted_acc}</font> {$lang_cleanup['accs_deleted']}</font></h1><br />"; $output .= "<h1><font class=\"error\">{$lang_cleanup['total']} <font color=blue>{$deleted_chars}</font> {$lang_cleanup['chars_deleted']}</font></h1>"; } } } $output .= "<br /><br />"; $output .= "<table class=\"hidden\">\r\n <tr><td>"; makebutton($lang_cleanup['back_cleaning'], "cleanup.php", 200); $output .= "</td></tr>\r\n </table><br /></center>"; }
function dodel_char() { global $output, $characters_db, $realm_id, $action_permission, $tab_del_user_characters, $sql; valid_login($action_permission["delete"]); if (isset($_GET["check"])) { $check = $sql["char"]->quote_smart($_GET["check"]); } else { redirect("char_list.php?error=1"); } $deleted_chars = 0; require_once "libs/del_lib.php"; $n_check = count($check); for ($i = 0; $i < $n_check; ++$i) { if (!($check[$i] == "")) { if (del_char($check[$i], $realm_id)) { $deleted_chars++; } } } unset($n_check); unset($check); $output .= ' <div class="center">'; if ($deleted_chars) { $output .= ' <h1><span class="error">' . lang("char_list", "total") . ' <span style="color: blue;">' . $deleted_chars . '</span> ' . lang("char_list", "chars_deleted") . '</span></h1>'; } else { $output .= ' <h1><span class="error">' . lang("char_list", "no_chars_del") . '</span></h1>'; } unset($deleted_chars); $output .= ' <br /><br />'; $output .= ' <table class="hidden"> <tr> <td>'; makebutton(lang("char_list", "back_browse_chars"), "char_list.php", 220); $output .= ' </td> </tr> </table> <br /> </div>'; }
function dodel_char(&$sqlc) { global $output, $lang_global, $lang_char_list, $characters_db, $realm_id, $action_permission, $tab_del_user_characters; valid_login($action_permission['delete']); if (isset($_GET['check'])) { $check = $sqlc->quote_smart($_GET['check']); } else { redirect('char_list.php?error=1'); } $deleted_chars = 0; require_once 'libs/del_lib.php'; $n_check = count($check); for ($i = 0; $i < $n_check; ++$i) { if ($check[$i] == '') { } else { if (del_char($check[$i], $realm_id)) { $deleted_chars++; } } } unset($n_check); unset($check); $output .= ' <center>'; if ($deleted_chars) { $output .= ' <h1><font class="error">' . $lang_char_list['total'] . ' <font color=blue>' . $deleted_chars . '</font> ' . $lang_char_list['chars_deleted'] . '</font></h1>'; } else { $output .= ' <h1><font class="error">' . $lang_char_list['no_chars_del'] . '</font></h1>'; } unset($deleted_chars); $output .= ' <br /><br />'; $output .= ' <table class="hidden"> <tr> <td>'; makebutton($lang_char_list['back_browse_chars'], 'char_list.php', 220); $output .= ' </td> </tr> </table> <br /> </center>'; }