0) { $errors = array(); if (!isset($_POST['oldpassword']) or $_POST['oldpassword'] == '') { $errors[] = "Old Password is a required field."; } if (!isset($_POST['newpassword']) or $_POST['newpassword'] == '') { $errors[] = "New Password is a required field."; } if (!isset($_POST['newpassword2']) or $_POST['newpassword2'] == '') { $errors[] = "Confirm New Password is a required field."; } if (count($errors) == 0) { if ($_POST['newpassword'] != $_POST['newpassword2']) { $errors[] = "New password must match Confirm New Password"; } $user = getAccount($_SESSION['currentUser']['id']); if (sha1($_POST['oldpassword']) != $user['password']) { $errors[] = "Old Password does not match your current password."; } else { // Update the password updatePassword($_SESSION['currentUser']['id'], $_POST['newpassword']); header("Location: index.php"); } } if (count($errors) > 0) { $form['errors'] = "