function updateDatabase($_version, $_link, $_prefix)
{
    global $GROUPS;
    $versions = array("3.1.8.1", "3.1.8.2", "3.1.8.3", "3.1.8.4");
    if (!in_array($_version, $versions)) {
        return "Invalid version! (" . $_version . ")";
    }
    while ($_version != VERSION) {
        if ($_version == $versions[0]) {
            $_version = $versions[1];
        }
        if ($_version == $versions[1]) {
            $_version = $versions[2];
        }
        if ($_version == $versions[2]) {
            $result = up_3183_3184($_prefix, $_link);
            if ($result === TRUE) {
                $_version = VERSION;
            } else {
                return $result;
            }
        }
    }
    @mysql_query("UPDATE `" . mysql_real_escape_string($_prefix) . DATABASE_INFO . "` SET `version`='" . VERSION . "'", $_link);
    return true;
}
function updateDatabase($_version, $_link, $_prefix)
{
    global $GROUPS;
    $versions = array("3.1.8.1", "3.1.8.2", "3.1.8.3", "3.1.8.4", "3.1.8.5", "3.1.8.6", "3.2.0.0", "3.2.0.1", "3.2.0.2", "3.2.0.3", "3.3.0.0", "3.3.1.0", "3.3.1.1", "3.3.1.2", "3.3.1.3", "3.3.2.0", "3.3.2.1", "3.3.2.2");
    if (!in_array($_version, $versions)) {
        return "Invalid version! (" . $_version . ")";
    }
    while ($_version != VERSION) {
        if ($_version == $versions[0]) {
            $_version = $versions[1];
        }
        if ($_version == $versions[1]) {
            $_version = $versions[2];
        }
        if ($_version == $versions[2]) {
            $result = up_3183_3184($_prefix, $_link);
            if ($result === TRUE) {
                $_version = $versions[3];
            } else {
                return $result;
            }
        }
        if ($_version == $versions[3]) {
            $_version = $versions[4];
        }
        if ($_version == $versions[4]) {
            $_version = $versions[5];
        }
        if ($_version == $versions[5]) {
            $result = up_3186_3200($_prefix, $_link);
            if ($result === TRUE) {
                $_version = $versions[6];
            } else {
                return $result;
            }
        }
        if ($_version == $versions[6]) {
            $result = up_3200_3201($_prefix, $_link);
            if ($result === TRUE) {
                $_version = $versions[7];
            } else {
                return $result;
            }
        }
        if ($_version == $versions[7]) {
            $_version = $versions[9];
        }
        if ($_version == $versions[8]) {
            $_version = $versions[9];
        }
        if ($_version == $versions[9]) {
            $result = up_3203_3300($_prefix, $_link);
            if ($result === TRUE) {
                $_version = $versions[10];
            } else {
                return $result;
            }
        }
        if ($_version == $versions[10]) {
            $result = up_3300_3310($_prefix, $_link);
            if ($result === TRUE) {
                $_version = $versions[11];
            } else {
                return $result;
            }
        }
        if ($_version == $versions[11]) {
            $result = up_3310_3311($_prefix, $_link);
            if ($result === TRUE) {
                $_version = $versions[12];
            } else {
                return $result;
            }
        }
        if ($_version == $versions[12]) {
            $result = up_3311_3312($_prefix, $_link);
            if ($result === TRUE) {
                $_version = $versions[13];
            } else {
                return $result;
            }
        }
        if ($_version == $versions[13]) {
            $_version = $versions[14];
        }
        if ($_version == $versions[14]) {
            $result = up_3313_3320($_prefix, $_link);
            if ($result === TRUE) {
                $_version = $versions[15];
            } else {
                return $result;
            }
        }
        if ($_version == $versions[15]) {
            $_version = $versions[16];
        }
        if ($_version == $versions[16]) {
            $_version = $versions[17];
        }
    }
    @mysql_query("UPDATE `" . @mysql_real_escape_string($_prefix) . "info` SET `version`='" . VERSION . "'", $_link);
    return true;
}