function modify_index($iname)
{
    global $dbhandle, $indices, $ib_error, $lsql;
    // alter the active/inactive status if the change was selected
    if (isset($_POST['def_index_activ']) && $indices[$iname]['active'] == FALSE) {
        if (alter_index($iname, 'ACTIVE')) {
            $indices[$iname]['active'] = TRUE;
        } else {
            return FALSE;
        }
    } elseif (!isset($_POST['def_index_activ']) && $indices[$iname]['active'] == TRUE) {
        if (alter_index($iname, 'INACTIVE')) {
            $indices[$iname]['active'] = FALSE;
        } else {
            return FALSE;
        }
    }
    // check if the index properties are modified
    $uniq_flag = isset($_POST['def_index_uniq']) ? TRUE : FALSE;
    $acti_flag = isset($_POST['def_index_activ']) ? TRUE : FALSE;
    if ($indices[$iname]['table'] != $_POST['def_index_table'] || $iname != $_POST['def_index_name'] || $indices[$iname]['dir'] != $_POST['def_index_dir'] || $indices[$iname]['uniq'] != $uniq_flag || $indices[$iname]['active'] != $acti_flag || implode(',', $indices[$iname]['seg']) != strtoupper($_POST['def_index_segs'])) {
        // drop the old index
        $lsql = 'DROP INDEX ' . $iname;
        if (DEBUG) {
            add_debug('lsql', __FILE__, __LINE__);
        }
        if (!@fbird_query($dbhandle, $lsql)) {
            $ib_error = fbird_errmsg();
            return FALSE;
        }
        // try to recreate with the new properties
        if (create_index()) {
            return TRUE;
        } else {
            $lsql = 'CREATE ';
            if (isset($indices[$iname]['uniq'])) {
                $lsql .= 'UNIQUE ';
            }
            $lsql .= $indices[$iname]['dir'] . " INDEX {$iname} ON " . $indices[$iname]['table'] . ' (' . implode(',', $indices[$iname]['seg']) . ')';
            if (DEBUG) {
                add_debug('lsql', __FILE__, __LINE__);
            }
            if (!@fbird_query($trans, $lsql)) {
                fbird_rollback($trans);
                $ib_error = fbird_errmsg();
            }
            return FALSE;
        }
    }
    return TRUE;
}
 function _close()
 {
     if (!$this->autoCommit) {
         @fbird_rollback($this->_connectionID);
     }
     return @fbird_close($this->_connectionID);
 }
//
if ($sql != '') {
    if (DEBUG) {
        add_debug('$sql: ' . $sql, __FILE__, __LINE__);
    }
    $trans = fbird_trans(TRANS_WRITE, $dbhandle);
    if (fbird_query($trans, $sql)) {
        fbird_commit($trans);
        $s_tables_valid = FALSE;
        $s_create_table = '';
        $s_create_num = 0;
        $s_coldefs = array();
        $s_modify_col = '';
    } else {
        $ib_error = fbird_errmsg();
        fbird_rollback($trans);
        if (isset($mod_flag) && $mod_flag == TRUE) {
            $col_mod_flag = TRUE;
        }
        if (isset($add_flag) && $add_flag == TRUE) {
            $col_add_flag = TRUE;
        }
    }
}
if (have_panel_permissions($s_login['user'], 'tb_show')) {
    // include the javascript for detail requests
    $js_stack .= js_request_details();
    //
    // Reload button from the tb_show panel
    //
    if (isset($_POST['tb_show_reload'])) {