summaryrefslogtreecommitdiff
path: root/register.php
diff options
context:
space:
mode:
authorh5p9sl <21267024+h5p9sl@users.noreply.github.com>2021-05-13 22:07:11 -0600
committerh5p9sl <21267024+h5p9sl@users.noreply.github.com>2021-05-14 02:37:13 -0600
commitfe41f57df59c7f2a11d80eaaebf08d3a3a51a6d5 (patch)
tree8917741bbe991d6ddf4f23953309288975f56eb2 /register.php
parent4145fa13230d25d9978c003a8cccd1b7c2e11aaf (diff)
Add error handling
Diffstat (limited to 'register.php')
-rw-r--r--register.php10
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>';
}
}
?>