summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
Diffstat (limited to 'includes')
-rw-r--r--includes/Session.php2
-rw-r--r--includes/error.php25
2 files changed, 26 insertions, 1 deletions
diff --git a/includes/Session.php b/includes/Session.php
index 7951d70..ceaa765 100644
--- a/includes/Session.php
+++ b/includes/Session.php
@@ -54,4 +54,4 @@ class Session
return $result;
}
-} \ No newline at end of file
+}
diff --git a/includes/error.php b/includes/error.php
new file mode 100644
index 0000000..5e33212
--- /dev/null
+++ b/includes/error.php
@@ -0,0 +1,25 @@
+<?php
+function user_notice($message) {
+ echo '<p class="error">'. $message .'</p>';
+}
+
+function handle_error($errno, $errstr, $errfile, $errline) {
+ if (!(error_reporting() & $errno)) {
+ // This error code is not included in error_reporting, so let it fall
+ // through to the standard PHP error handler
+ return false;
+ }
+
+ switch ($errno) {
+ // See https://www.php.net/manual/en/errorfunc.constants.php
+ case E_USER_NOTICE:
+ user_notice($errstr);
+ break;
+ default:
+ return false;
+ }
+ return true;
+}
+
+$old_error_handler = set_error_handler('handle_error');
+?>