Example #1
0
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>";
}
Example #2
0
function do_del_team()
{
    global $characters_db, $realm_id, $user_lvl, $user_id, $sql;
    require_once "libs/del_lib.php";
    if (isset($_POST["check"]) && $_POST["check"] != "") {
        $check = $sql["logon"]->quote_smart($_POST["check"]);
        $check = explode("-", $check);
    }
    for ($i = 1; $i < count($check); $i++) {
        if ($check[$i] != "") {
            if (del_arenateam($check[$i], $realm_id)) {
                $deleted_guilds++;
            }
        }
    }
    redirect("arenateam.php");
}