require_once 'class/LoginUser.class.php'; // Initialize the json object $rjo = new API(); // Save user settings if (isset($_REQUEST["action"]) && $_REQUEST["action"] == "updateUserSettings") { $updates = array(); if (!isset($_REQUEST["userid"])) { error_out("No user id set."); } $user = new LoginUser(); $user->id = intval(trim($_REQUEST["userid"])); $update = new SQLUpdate("login_user"); $update->selectors = array("id" => $_REQUEST["userid"]); foreach (array("firstname", "lastname", "email") as $field) { 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."); }