index : archweb32 | |
Archlinux32 website | gitolite user |
summaryrefslogtreecommitdiff |
-rw-r--r-- | lib/http.php | 17 |
diff --git a/lib/http.php b/lib/http.php new file mode 100644 index 0000000..9b63337 --- /dev/null +++ b/lib/http.php @@ -0,0 +1,17 @@ +<?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); +}; |