Difference between revisions of "NATS4 custom errors.php"
m |
(No difference)
|
Revision as of 12:52, 17 December 2008
NATS has normally displays errors in the form of a very simple error message. This error is for support personnel and does not contain much information for you as a program owner and administrator, but now you can use custom_errors.php to customize how NATS's error handling.
custom_errors.php
Create a file in nats/includes/ called custom_errors.php. This file may contain anything you want to display o the surfer, affiliate, or admin -- and can also to record this error. Before creating your own custom_errors.php script, please read this entire article, including the last section, Warnings and Recommendations. You have access to the following PHP variables in custom_errors.php:
- $errstr - This variable contains the actual text of the error message.
- $errfile - This variable contains the file from which the error was encountered.
- $errline - This variable contains the line number of the file contained in $errfile.
Note: You can't use the error file and line number yourself. All Too Much Media product PHP files are encoded and cannot be debugged by end-users.
Since custom_errors.php is a PHP script, you have access to all of the PHP "superglobal" variables and the full power of PHP. You can make your custom_errors.php script do pretty much anything you want it to do.
Warnings and Recommendations
This script will not always run; in some errors or server crashes, this script may not execute. If there is a critical PHP component that's failing, for example, NATS won't run long enough to process the error.
If you're reporting your errors to a MySQL database and NATS has a problem with the MySQL server, there is no way for custom_errors.php to report the error to the database.
WARNING: do not use the NATS database to log errors. If you're reporting your errors to a MySQL database, create separate database. If your script includes the database username, password, and host information in plain text and if you use the NATS database login information or that of any other secure database, you risk exposing your login information to the public. If this script modifies the content of the NATS database table structure or data content, we will not be able fix your problems.
WARNING: do not display sensitive data.