Version: 1.00, by AlexanderT
Developer Last Online: Jul 2021
Version: 3.0.0
Rating:
Released: 05-10-2004
Last Update: Never
Installs: 34
No support by the author.
What this hack does?
---------------------------
UPDATE: Improved instruction.txt, fixed for those who use external style sheets
This hack adds a custom error-handler to your site using the vBulletin template engine to display the appropriate errors (e.g. 404 File not Found, 403 Forbidden, etc).
Demo
-------
Go to my site and enter some non-existing url. E.g. Random 404 Error. Or try to access my /cgi-bin path to receive a 403 error.
What to do?
----------------
queries to run: 0
templates changed: 0
templates added: 1 (ERROR_SHELL)
files changed: 1 (.htaccess)
files added: 1 (error.php)
Time needed to install
----------------------------
< 5 mins
Show Your Support
This modification may not be copied, reproduced or published elsewhere without author's permission.
I believe that Zachery has posted code that gives an absolute path to the link href statement to call stylesheets - that's why I didn't notice it not working ... it did for me
As I mentioned in the post above, this code can be more efficient (and easier to add new error codes) witha switch statement:
Find:
PHP Code:
if(isset($_SERVER['REDIRECT_STATUS'])) { if ($_SERVER['REDIRECT_STATUS']=="404") { $error['title'] = "404 File Not Found"; $error['description'] = "The web server cannot find the file you asked for. Check the URL to ensure that the path is correct."; $error['contact'] = "Please <a href=\"$vboptions[bburl]/$vboptions[contactuslink]\">contact</a> us if you believe that the mistake is on our part."; } elseif ($_SERVER['REDIRECT_STATUS']=="403") { $error['title'] = "403 Forbidden"; $error['description'] = "You don't have permission to access this document on this server."; $error['contact'] = "Please <a href=\"$vboptions[bburl]/$vboptions[contactuslink]\">contact</a> us if you think that there is a mistake."; } elseif ($_SERVER['REDIRECT_STATUS']=="401") { $error['title'] = "401 Unauthorized"; $error['description'] = "The URL you are requesting requires proper authentication."; $error['contact'] = "Please <a href=\"$vboptions[bburl]/$vboptions[contactuslink]\">contact</a> us if you think that there is a mistake."; } elseif ($_SERVER['REDIRECT_STATUS']=="500") { $error['title'] = "500 Internal Server Error"; $error['description'] = "We encountered an unexpected condition."; $error['contact'] = "Please <a href=\"$vboptions[bburl]/$vboptions[contactuslink]\">contact</a> us to report this problem."; } elseif ($_SERVER['REDIRECT_STATUS']=="503") { $error['title'] = "503 Service Unavailable"; $error['description'] = "We are currently unable to handle your request due to a temporary overloading or maintenance of the server."; $error['contact'] = "Please <a href=\"$vboptions[bburl]/$vboptions[contactuslink]\">contact</a> us if this problem persists."; } else { $error['title'] = "Unknown Error: " . $_SERVER['REDIRECT_STATUS']; $error['description'] = "We are currently unable to handle this error."; $error['contact'] = "Please <a href=\"$vboptions[bburl]/$vboptions[contactuslink]\">contact</a> us if this problem persists."; } } else { $error['title'] = "Unknown Error"; $error['description'] = "We are currently unable to handle this error."; $error['contact'] = "Please <a href=\"$vboptions[bburl]/$vboptions[contactuslink]\">contact</a> us if this problem persists."; }
Replace with:
PHP Code:
if(!isset($_SERVER['REDIRECT_STATUS'])) { $error['title'] = "Unknown Error"; $error['description'] = "We are currently unable to handle this error."; $error['contact'] = "Please <a href=\"$vboptions[bburl]/$vboptions[contactuslink]\">contact</a> us if this problem persists."; } else switch($_SERVER['REDIRECT_STATUS']) { case("404"): $error['title'] = "404 File Not Found"; $error['description'] = "The web server cannot find the file you asked for. Check the URL to ensure that the path is correct."; $error['contact'] = "Please <a href=\"$vboptions[bburl]/$vboptions[contactuslink]\">contact</a> us if you believe that the mistake is on our part."; break; case("403"): $error['title'] = "403 Forbidden"; $error['description'] = "You don't have permission to access this document on this server."; $error['contact'] = "Please <a href=\"$vboptions[bburl]/$vboptions[contactuslink]\">contact</a> us if you think that there is a mistake."; break; case("401"): $error['title'] = "401 Unauthorized"; $error['description'] = "The URL you are requesting requires proper authentication."; $error['contact'] = "Please <a href=\"$vboptions[bburl]/$vboptions[contactuslink]\">contact</a> us if you think that there is a mistake."; break; case("500"): $error['title'] = "500 Internal Server Error"; $error['description'] = "We encountered an unexpected condition."; $error['contact'] = "Please <a href=\"$vboptions[bburl]/$vboptions[contactuslink]\">contact</a> us to report this problem."; break; case("503"): $error['title'] = "503 Service Unavailable"; $error['description'] = "We are currently unable to handle your request due to a temporary overloading or maintenance of the server."; $error['contact'] = "Please <a href=\"$vboptions[bburl]/$vboptions[contactuslink]\">contact</a> us if this problem persists."; default: $error['title'] = "Unknown Error: " . $_SERVER['REDIRECT_STATUS']; $error['description'] = "We are currently unable to handle this error."; $error['contact'] = "Please <a href=\"$vboptions[bburl]/$vboptions[contactuslink]\">contact</a> us if this problem persists."; }
Also (to follow all those W3C tips about the TITLE tags) ...
I dunno dude, I kind of like my one of a kind styles. But hey, if I ever feel like coming up with a more generic version of it... I guess I could release it, you think it'd be a good idea?
I dunno dude, I kind of like my one of a kind styles. But hey, if I ever feel like coming up with a more generic version of it... I guess I could release it, you think it'd be a good idea?