This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

add 500 error handling that may or may not work when it counts

  • Loading branch information...
ericoc committed Apr 26, 2014
1 parent 038100b commit 906a7d64882e91fa64d8ef492bc599fe41cd4b1b
Showing with 4 additions and 2 deletions.
  1. +1 −0 .htaccess.example
  2. +2 −1 gawsh.sql
  3. +1 −1 go.php
View
@@ -2,6 +2,7 @@ ErrorDocument 401 /go.php?x=401
ErrorDocument 403 /go.php?x=403
ErrorDocument 404 /go.php?x=404
ErrorDocument 410 /go.php?x=410
ErrorDocument 500 /go.php?x=500
ErrorDocument 503 /go.php?x=503
# Redirect any request that is not for a real file or directory to /go.php?x=
View
@@ -20,7 +20,8 @@ INSERT INTO `urls` (`id`, `alias`, `url`, `ip`, `time`, `status`) VALUES
(3, '403', '', '127.0.0.1', '1970-01-01 00:00:01', '-1'),
(4, '404', '', '127.0.0.1', '1970-01-01 00:00:01', '-1'),
(5, '410', '', '127.0.0.1', '1970-01-01 00:00:01', '-1'),
(6, '503', '', '127.0.0.1', '1970-01-01 00:00:01', '-1');
(6, '500', '', '127.0.0.1', '1970-01-01 00:00:01', '-1');
(7, '503', '', '127.0.0.1', '1970-01-01 00:00:01', '-1');
-- `visits` table
CREATE TABLE IF NOT EXISTS `visits` (
View
2 go.php
@@ -38,7 +38,7 @@ function showError ($error) {
} else {
// Create an array of possible HTTP error codes and their meanings
$errors = array('401' => 'Not Authorized', '403' => 'Forbidden', '404' => 'Not Found', '410' => 'Gone', '503' => 'Service Unavailable');
$errors = array('401' => 'Not Authorized', '403' => 'Forbidden', '404' => 'Not Found', '410' => 'Gone', '500' => 'Internal Server Error', '503' => 'Service Unavailable');
// Just show an error immediately for forced errors and stop further execution
if (array_key_exists($_GET['x'], $errors)) {

0 comments on commit 906a7d6

Please sign in to comment.