Exemplo n.º 1
0
    if ($inputData == "" or $inputData == null) {
        $errorMsg = urlencode("Missing form field");
        header("Location: ../teams.php?status={$errorMsg}");
        exit;
    }
}
try {
    //trim any whitespace
    $firstName = trim($_POST['firstName']);
    $lastName = trim($_POST['lastName']);
    $userName = trim($_POST['userName']);
    $password = trim($_POST['password']);
    $emailAddress = trim($_POST['email']);
    $studentId = trim($_POST['studentNumber']);
    $address = trim($_POST['address']);
    $major = trim($_POST['major']);
    // this code is used to hash the password into DB. when we register a user.
    $password_hash = $password;
    //TODO REIMPLEMENT HASH password_hash($password, PASSWORD_DEFAULT);
    //store the user in the DB.
    $persistenceId = $logicLayer->createStudent($firstName, $lastName, $userName, $password_hash, $emailAddress, $studentId, $major, $address);
    header("Location: ../login.php?status=Success");
    //echo $persistenceId;
} catch (\edu\uga\cs\recdawgs\RDException $rde) {
    $error_msg = urlencode($rde->string);
    header("Location: ../register.php?status={$error_msg}");
} catch (Exception $e) {
    $errorMsg = urlencode("Unexpected error");
    header("Location: ../register.php?status={$errorMsg}");
}
exit;