NATS4 custom errors.php

From TMM Wiki
Revision as of 12:52, 17 December 2008 by Trinidadr (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search
NATS 4
Members Admin
The Members Admin
View Member Details
Add Member
MySQL Auth
Mod Authn DB
Multisite Access
Member Logging
Member Password Retrieval
OpenID Connect
Mod Auth OpenIDC
ID Numbers
Skins and Templates Admin
The Skins and Templates Admin
Skins
Templates
Site Templates
Language Skins
Language Files
custom_errors.php
Join Page Variables
Skipping NATS Join Form
Post URL Variables
Member Usernames & Passwords
Form Validation
Username Recommendations
Password Retrieval
Post-Biller Templates
Geo-Target Join Options
Random Usernames and Passwords
Smarty
Smarty print array
Smarty Plugins
Available Smarty Functions
Affiliate Support Template
Adding a Verification Image
Custom Program and Campaign Selection Pages
Output An Affiliate's Last Paid Date
Affiliate Signup Email
Affiliate Join Page Linkcodes
Approval/Upgrade/Denial Variables
Approval/Upgrade/Denial Template Variables
CSS Theme Builder

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.