The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
Custom error-handler based on vBulletin templates Details »» | |||||||||||||||||||||||||||
Custom error-handler based on vBulletin templates
Developer Last Online: Jul 2021
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
|
Comments |
#52
|
|||
|
|||
Okay - I was so happy with this hack that I'm going to help improve it. Hopefully, you will find this usefull...
What this does is, for 404 and 500 errors, the server will send you an email notifying you of the error, and providing some information that will assist you in resolving it. open error.php and find: Code:
$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."; Code:
$error_message = "An attempt to get a file (". $_SERVER['REQUEST_URI'] . ") failed. Please investigate!\r\n"; if (isset($_SERVER['HTTP_REFERER'])){ $error_message .= "The user came from " . $_SERVER['HTTP_REFERER'] . "\r\n"; if (!preg_match ("/.*?domain.com.*?/i", $_SERVER['HTTP_REFERER'])) { $error_message .= "You may wish to contact the administrator of that domain.\r\n"; } } $error_message .= "User agent: " . $_SERVER['HTTP_USER_AGENT'] . "\r\n"; $error_message .= "Remote Address: " . $_SERVER['REMOTE_ADDR'] . "\r\n"; $error_message .= "Remote Port: " . $_SERVER['REMOTE_PORT'] . "\r\n"; Code:
$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."; Code:
$error_message = "An attempt to get a file (". $_SERVER['REQUEST_URI'] . ") caused an error. Please investigate!\r\n"; if (isset($_SERVER['HTTP_REFERER'])){ $error_message .= "The user came from " . $_SERVER['HTTP_REFERER'] . "\r\n"; } find Code:
eval("print_output(\"".fetch_template('ERROR_SHELL')."\");"); Code:
$error_headers = ""; $error_headers .= "FROM:domain.com Error Manager <errors@domain.com>\n"; $error_headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $error_headers .= "X-Mailer: PHP " . phpversion() . "\r\n"; $error_headers .= "Importance: High\r\n"; $error_headers .= "X-Priority: 5 (High)\r\n"; $error_headers .= "Return-Path: <errors@domain.com>\r\n"; if ((($_SERVER['REDIRECT_STATUS']=="404")&&($_SERVER['REQUEST_URI'] != "/error.php?eid=404"))||($_SERVER['REDIRECT_STATUS']=="500")){ $error_subject = $eid . " error!"; $error_mail = mail("webmaster <webmaster@domain.com>","$error_subject","$error_message","$error_headers"); } Save and upload the file and test by going to a non-existing page on your site. You should receive the email right after that. |
#53
|
|||
|
|||
couple things with that.
missing the headers to do html mail or something. the error_start and error_footer will never get appended to the body |
#54
|
|||
|
|||
You are correct. I could have swore I removed the error_start and error_footer stuff before I posted that. I use that for something else.
Also, I've changed some of the hard coded email addresses to the $vboptions['webmasteremail'] variable. Would it be easier (and allowed) for me to just attach the php file here? It's just the original error page with my stuff added. Whatever is convenient (and doesn't break the rules)..... |
#55
|
||||
|
||||
Nice addition, 58sniper!
I'd be only worried to be flooded with e-mails (at least if you have a high traffic site). Although my site is relatively small, for June 2004 I had 3864 404-Document Not-Found-errors, in May even 5048 of these errors. Not because I am sloppy with html programming, but because people (or bots, in majority) were trying to access and spider outdated links. |
#56
|
|||
|
|||
The biggest problem I've seen is the PowerPC version of IE. It apparently has poor support for images in CSS. I think I'm going to filter that.
What's the rule about modifying hacks? Do I just post the new file here or do I need to start a new thread and give props? I ask because I'd like to switch all of the IF statements to a switch, and make a few more changes, and I think the new version would be beneficial. |
#57
|
|||
|
|||
Great addition. Thanks.
|
#58
|
|||
|
|||
Okay - here we go. This is an 'extension' of this hack, which includes:
- Emailing of the webmaster for 404 and 500 errors. - Changed all of the IF ELSE statements to a single SWITCH - Used more vBulletin variables so that no code modification is required to implement this. I've tested this for a couple of days, and haven't seen any problems. Let me know if you spot any. To install, just drop this in your forum folder, overwriting the original (which, of course, you backed up). |
#59
|
|||
|
|||
Updated with the following changes:
Subject of error email now indicates type of error. Address of referring page (if it exists) is now a link. This is a straight drop-in replacement for the above. |
#60
|
|||
|
|||
This hack was Wrorking With me B4 After We update our Server . it dont work
Can i know what this hack need from me to install any software or anything .. Thankyou |
#61
|
|||
|
|||
Quote:
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|