To wrap up our Intro series, we're offering tips and ideas on how to customize a program to suit your needs.
For this page, we'll use a popular program, birdtrap.cgi, by
BigNoseBird. Birdtrap is a program that "traps"
errors on your web site, such as the Bad Request (Error 400), Authorization Required (Error 401),
Forbidden (Error 403), File Not Found (Error 404), Internal Server Error (500) and the really strange, don't
know what to do with it "Unknown" error.
If you wish to follow along with customizations, feel free to download birdtrap using one of
the following download links:
Download the source code for birdtrap.cgi:
102 tar unix file or
82k DOS file
birdtrap.cgi home page
Before you start customizing your programs, first make sure the program works on your server by
installing and testing it. After you know it works, make a backup copy before you start customizing.
You may also wish to read through the program once, at least reading the comments to see what belongs
where. A lot of programmers include plenty of comments (in plain English), so you can understand what's
going on.
Customizations to birdtrap.cgi
-
The first thing I always do when customizing a program is add a font variable that I can use throughout
the program. I always put this near the other variables so they they're all in one place.
So, near the top of birdtrap.cgi, I entered:
$font = '<FONT FACE="Arial,Helvetica,sans serif" SIZE=2>';
Now, anywhere in the program, I can simply add $font, and when an error page is displayed, it uses the
font I want.
- The next thing I usually do is create two subroutines (or variables) for a header and a footer. Doing
this will help make it easier to update the look of your page without having to copy and paste code
throughout each output section. For example, birdtrap.cgi has 6 output pages, one for each of the errors.
So, back to the top of birdtrap.cgi, but beneath $font.
You can enter something like this: