while ($result = mysql_fetch_object($query)) {
        if (file_exists("include/files/" . $result->demo_file)) {
            //delete the file(s)
            if (file_exists("include/files/" . $result->demo_file . "_thumb")) {
                unlink("include/files/" . $result->demo_file . "_thumb");
            }
            if (unlink("include/files/" . $result->demo_file)) {
                //if file deleted, remove db entry
                $query2 = mysql_query("DELETE FROM `" . $config->db_prefix . "_files` WHERE `id`=" . $result->id . " LIMIT 1") or die(mysql_error());
            }
        }
    }
    //delete all comments for the ban
    $query = mysql_query("DELETE FROM `" . $config->db_prefix . "_comments` WHERE `bid`=" . $bid) or die(mysql_error());
    //get ban details
    $ban_row = sql_get_ban_details($bid);
    //delete the ban
    $query = mysql_query("DELETE FROM `" . $config->db_prefix . "_bans` WHERE `bid`=" . $bid . " LIMIT 1") or die(mysql_error());
    log_to_db("Ban edit", "Deleted ban: ID " . $bid . " (<" . sql_safe($ban_row["player_nick"]) . "> <" . sql_safe($ban_row["player_id"]) . ">)");
    //redirect to start page
    if ($query) {
        header("Location:index.php");
        exit;
    }
}
$smarty->assign("meta", "");
$smarty->assign("title", $title);
$smarty->assign("title2", $title2);
$smarty->assign("version_web", $config->v_web);
// amxbans.css included in the design? if not use it from default
if (file_exists("templates/" . $config->design . "/amxbans.css")) {
        #header('Content-Type: application/download');
        #header('Content-Length: '.filesize($file_local));
        #header('Pragma: public');
        #set_time_limit(0);
        #readfile($file_local);
        $file = fopen("{$file_local}", "r");
        header("Content-Type: application/download");
        header('Content-Disposition: attachment; filename="' . basename($file_real) . '"');
        fpassthru($file);
        fclose($file);
        unset($_POST["down_demo_x"]);
    }
    $smarty->assign("upload_error", $error);
}
//get ban details
$ban_details = sql_get_ban_details($bid);
//aktive bans holen
$activ_count = 0;
$ban_details_activ = sql_get_ban_details_activ($ban_details["player_id"], $activ_count, $bid);
//abgelaufene bans holen
$exp_count = 0;
$ban_details_exp = sql_get_ban_details_exp($ban_details["player_id"], $exp_count, $bid);
//ban edits holen
$query = mysql_query("SELECT * FROM " . $config->db_prefix . "_bans_edit WHERE bid=" . $bid);
while ($row = mysql_fetch_assoc($query)) {
    $edit_count++;
    $ban_details_edits[] = $row;
}
//generate steamcomid
if (!empty($ban_details["player_id"])) {
    $ban_details["player_comid"] = GetFriendId($ban_details["player_id"]);