diff options
author | cflip <36554078+cflip@users.noreply.github.com> | 2021-05-15 09:15:58 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-15 09:15:58 -0600 |
commit | 45acfc48b3dd80b945a1501edea9ad4faa700c0f (patch) | |
tree | 87319e8b64789564e5d9ae227361593c419d905b /register.php | |
parent | 87b1dfd1f77b08915ee5e905da45e316ba2c0e7d (diff) | |
parent | 2b03ca63d06ec5da45c887ef7cb3daa35a8642f7 (diff) |
Merge pull request #16 from cflip/h5p9sl
Add error handling
Diffstat (limited to 'register.php')
-rw-r--r-- | register.php | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/register.php b/register.php index 02fbe58..4c42610 100644 --- a/register.php +++ b/register.php @@ -21,6 +21,7 @@ <?php include_once './includes/functions_user.php'; +include_once './includes/error.php'; if ($_SERVER['REQUEST_METHOD'] == 'POST') { $errors = array(); @@ -61,15 +62,16 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') { } if (!empty($errors)) { - echo 'Please check the following problems: <ul>'; + $errstr = 'Please check the following problems: <ul>'; foreach ($errors as $err) { - echo '<li>' . $err . '</li>'; + $errstr .= '<li>' . $err . '</li>'; } - echo '</ul>'; + $errstr .= '</ul>'; + trigger_error($errstr); } else { $pass_hash = password_hash($user_pass, PASSWORD_DEFAULT); register_user($user_name, $pass_hash); - echo 'Account successfully registered! You can now <a href="signin.php">sign in</a>'; + echo '<p class="success">Account successfully registered! You can now <a href="signin.php">sign in</a></p>'; } } ?> |