diff options
author | Erich Eckner <git@eckner.net> | 2018-04-17 09:36:08 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-04-17 09:36:08 +0200 |
commit | 8af016645fee5c0b22e69d46de9b3401c1bc82d3 (patch) | |
tree | 992acf6649f005c3d6891d767a5509fdbb91024b /lib/http.php | |
parent | 951d045cb95cc8e0d07c97104a2b9a5e9ea5ffc8 (diff) | |
download | archweb32-8af016645fee5c0b22e69d46de9b3401c1bc82d3.tar.xz |
lib/ new
Diffstat (limited to 'lib/http.php')
-rw-r--r-- | lib/http.php | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/http.php b/lib/http.php new file mode 100644 index 0000000..5fe87dc --- /dev/null +++ b/lib/http.php @@ -0,0 +1,18 @@ +<?php + + +# do not include twice +if (function_exists("throw_http_error")) + return; + +function throw_http_error($error_number, $error_message, $extra_message = "") { + header("Status: " . $error_number . " " . $error_message); + print "Error " . $error_number . ": " . $error_message . "\n"; + if ($extra_message != "") + print "<br>\n" . $extra_message; + die(); +}; + +function die_500($message) { + throw_http_error(500, "Internal Server Error", $message); +}; |