Exemplo n.º 1
0
        $lastName = trim($_POST['lastName']);
    }
    if (trim($_POST['password'])) {
        $password = trim($_POST['password']);
        //$password_hash = password_hash($password, PASSWORD_DEFAULT);
    }
    if (trim($_POST['email'])) {
        $emailAddress = trim($_POST['email']);
    }
    if (trim($_POST['studentNumber'])) {
        $studentId = trim($_POST['studentNumber']);
    }
    if (trim($_POST['address'])) {
        $address = trim($_POST['address']);
    }
    if (trim($_POST['major'])) {
        $major = trim($_POST['major']);
    }
    // update user
    $logicLayer->updateUser($_SESSION['userId'], $firstName, $lastName, null, $password, $emailAddress, $studentId, $major, $address);
    $successMsg = urlencode("User successfully updated!");
    header("Location: ../profile.php?status={$successMsg}");
    //echo $persistenceId;
} catch (\edu\uga\cs\recdawgs\RDException $rde) {
    $error_msg = urlencode($rde->string);
    header("Location: ../editProfile.php?status={$error_msg}");
} catch (Exception $e) {
    $errorMsg = urlencode("Unexpected error");
    header("Location: ../editProfile.php?status={$errorMsg}");
}
exit;