Example #1
0
        if (isset($_REQUEST[$field])) {
            $update->add_value($field, $_REQUEST[$field]);
        }
    }
    if (isset($_REQUEST["password1"]) && $_REQUEST["password1"] != "") {
        if (!isset($_REQUEST["password2"]) && $_REQUEST["password2"] != "") {
            error_out("Please retype password.");
        } else {
            if ($_REQUEST["password1"] != $_REQUEST["password2"]) {
                error_out("Passwords do not match.");
            } else {
                $hash = db_hash_password($_REQUEST['password1']);
                if ($hash) {
                    $update->add_value("pass", $hash);
                } else {
                    error_out("Problem hashing password. Please retry.");
                }
            }
        }
    } else {
        if (isset($_REQUEST["password2"]) && $_REQUEST["password2"] != "") {
            error_out("Please type password in both fields.");
        }
    }
    $update->execute();
    $user->dbGet();
    $rjo->query = $update->query;
    $rjo->status = "success";
    $rjo->successMessage = "Saved user settings.";
}
echo $rjo->printjson();