function update_esuser_from_form()
{
    global $msg, $charset, $dbh, $id;
    global $esuser_username, $esuser_fullname, $esuser_password, $esuser_esgroup;
    if ($esuser_esgroup) {
        //Vérifions que le groupe existe
        if (!es_esgroup::id_exists($esuser_esgroup)) {
            print $msg['es_user_error_unknowngroup'];
            show_esuser_form(0, stripslashes($esuser_username), stripslashes($esuser_fullname), stripslashes($esuser_password), stripslashes($esuser_esgroup));
            return false;
        }
    }
    if (!$id) {
        //Ajout d'un nouvel utilisateur
        if (!$esuser_username) {
            print $msg['es_user_error_emptyfield'];
            show_esuser_form(0, stripslashes($esuser_username), stripslashes($esuser_fullname), stripslashes($esuser_password), stripslashes($esuser_esgroup));
            return false;
        }
        if (es_esuser::username_exists($esuser_username)) {
            print $msg['es_user_error_usernamealreadyexists'];
            show_esuser_form(0, stripslashes($esuser_username), stripslashes($esuser_fullname), stripslashes($esuser_password), stripslashes($esuser_esgroup));
            return false;
        }
        $new_esuser = es_esuser::add_new();
        $new_esuser->esuser_username = $esuser_username;
        $new_esuser->esuser_fullname = $esuser_fullname;
        $new_esuser->esuser_password = $esuser_password;
        $new_esuser->esuser_group = $esuser_esgroup;
        $new_esuser->commit_to_db();
    } else {
        $theuser = new es_esuser($id);
        if ($the_user->error) {
            return false;
        }
        $theuser->esuser_username = $esuser_username;
        $theuser->esuser_fullname = $esuser_fullname;
        $theuser->esuser_password = $esuser_password;
        $theuser->esuser_group = $esuser_esgroup;
        $theuser->commit_to_db();
    }
    return true;
}