summaryrefslogtreecommitdiff
path: root/signin.php
diff options
context:
space:
mode:
authorcflip <36554078+cflip@users.noreply.github.com>2021-05-15 09:15:58 -0600
committerGitHub <noreply@github.com>2021-05-15 09:15:58 -0600
commit45acfc48b3dd80b945a1501edea9ad4faa700c0f (patch)
tree87319e8b64789564e5d9ae227361593c419d905b /signin.php
parent87b1dfd1f77b08915ee5e905da45e316ba2c0e7d (diff)
parent2b03ca63d06ec5da45c887ef7cb3daa35a8642f7 (diff)
Merge pull request #16 from cflip/h5p9sl
Add error handling
Diffstat (limited to 'signin.php')
-rw-r--r--signin.php10
1 files changed, 6 insertions, 4 deletions
diff --git a/signin.php b/signin.php
index 2c43309..c38845d 100644
--- a/signin.php
+++ b/signin.php
@@ -17,6 +17,7 @@
</form>
<?php
+include_once 'includes/error.php';
function validate($data)
{
@@ -42,17 +43,18 @@ 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 {
$user = new User();
$result = $user->get_by_name($user_name);
if (!$result) {
- echo 'There is no user with that name. Did you mean to <a href="register.php">create a new account?</a>';
+ trigger_error('There is no user with that name. Did you mean to <a href="register.php">create a new account?</a>');
} else {
if (!password_verify($user_pass, $user->password)) {
echo 'Password does not match!';