You can do quite a bit of cool stuff on your site using all the handy HTML functions — display text in interesting ways, add images, play music, and link to your friends' sites. The list goes on.
At some point, however, you'll probably want your page to be able to do some things that are a little more, you know... interesting. That's why Angelfire offers a CGI service, a way for you to take your pages from static and stoic to dynamic and dazzling. Want to gather information from your viewers? Build a guestbook? Or perhaps you'd like to write an online game that your visitors can interact with using cookies. CGI scripts can do some pretty amazing things!
New to the world of CGI? Don't despair — Angelfire's got you covered. We've written some useful scripts that you can plug directly into your page with little or no knowledge of programming! You'll find these tested and fine-tuned scripts in our Script Library. Angelfire offers ready-made scripts that you can use to build contact forms, perform search functions, and even add content from other sites that's updated automatically.
The scripts are fully customizable, so you can paste them right into your HTML pages or add extra functionality yourself. It really couldn't be simpler! You can access the Script Library through the Web Shell by clicking on the link in the Tool Center. Or go to the Script Library and have a look around.
If you're itching to use your own CGI scripts, whether you wrote them yourself or grabbed them from the Angelfire Script Library, we'll need to go over the basics of adding the scripts to your pages. Even if you are familiar with CGI and the programming language Perl, adding scripts to your pages is a little different on an Angelfire site than it might be elsewhere. Luckily, the whole process boils down to five basic steps:
Step 1: Your CGI Bin
If you are already familiar with CGI, then you're already half way to loading up on fresh dynamic content. If all of this is new to you, here's a quick definition:
An abbreviation for Common Gateway Interface, CGI refers to the way most Web servers communicate with scripts or programs. CGI is most commonly used in forms requiring the user to input information. This data is put into an HTML form by a script and can be utilized by the programmer in various ways. Perl is the language most commonly used to write CGI scripts; all of the scripts in the CGI Library are written in Perl. CGI is not itself a programming language; it's more of a protocol for communication between the Web server and a script.
No matter what level of expertise you may have in the area of CGI/perl, there are a few things you need to know about how CGI works on Angelfire. Different servers deal with CGI in different ways, and Angelfire's servers are no exception. You must place all of your CGI scripts, associated files, and modules into a designated directory on your Web server. On Angelfire, this directory is named "cgi-bin." Think of this as a home base for all of your scripted content. Angelfire's CGI service differs from other similar services in that all member-CGI scripts run on a special server named "cgi.angelfire.com." While your scripts are running, the CGI server doesn't contact any other server on Angelfire. Because of this, you need to be aware of two special considerations:
Since the CGI server won't contact any other servers on Angelfire, any HTML or other file that your script needs to access must be in your cgi-bin directory. You don't need to create a cgi-bin directory, we've done it for you. You can locate it in the Web Shell.
Secondly, while a CGI script is running, Angelfire's CGI server considers your cgi-bin to be the root directory. Some common items that you can expect to find in a standard member's cgi-bin would be:
- CGI scripts, with a .pl or .cgi extension
- Perl modules, ending in a .pm extension — these should include all the Angelfire modules and any module the user might have imported into the directory from another source
- Any HTML file or text file that needs to be accessed by any scripts in the cgi-bin
Step 2: Angelfire's Perl Modules
We've put together a few standard Perl modules for you to use in conjunction with the CGI scripts. Perl modules are basically packages of functions that the CGI scripts access in order to run a particular task. You'll need to put these Perl modules in the cgi-bin in your Angelfire member directory in order for your CGI scripts to work. Remember, all scripts, Perl modules, and associated files need to be in your cgi-bin, or our servers won't find them! You can use Angelfire's collection of Perl modules, along with your cgi-bin, to make scripts work on any of your Angelfire pages. These modules allow you to perform some common tasks, such as:
- Email a message to a visitor
- Get the current date and compare it against another date
- Grab and save data from a form
- Write a page to the screen with the dynamic content of your choice
All Angelfire modules are written in Perl, a common and extremely versatile Web programming language. Angelfire's CGI service fully supports any module written in Perl — just put them into your cgi-bin directory and your scripts will find them. In addition to the modules, you'll find a file in the cgi-bin directory called "modules_readme.html." This readme file contains detailed instructions on how to use modules in your scripts, and lets you know exactly what each module does. You'll need to read this file in order to effectively enable your scripts!
In order to utilize the tasks listed above, you'll need to upload the appropriate module. You only need to upload the module that's associated with the task you want to perform. For a detailed description of the functions contained within each module, read up on Module Specifics
Use the tool on this page to load the modules you'd like to use directly to your cgi-bin.
Step 3: Go get your scripts
Angelfire's CGI Service allows you to use both the scripts that we provide as well as scripts that you've written yourself or picked up some place else — provided you have the appropriate Perl module for the script to access if the script calls for one. All you need to do to make a CGI script work on your Angelfire page is to dump it into your cgi-bin. Get a copy of your script and move onto Step 4.
Step 4: Put your script and associated files in the CGI-Bin
By now we've told you several times that your scripts need to be put into your cgi-bin directory. Any CGI scripts you put in your cgi-bin must have either a .pl or a .cgi file extension, or they won't work. There are three ways to get your scripts into your Angelfire cgi-bin:
1. Write and upload your own scripts using the Web Shell Script Editor.
2. Get a copy of your script, and then go to the Angelfire Web Shell. Under your list of files, select New File, and name your file in the field below. (Don't forget to use the correct extension: .pm or .cgi) Paste your script code into the input box and save it.
3. Upload your scripts to your Angelfire cgi-bin using a standalone FTP client.
Step 5: Use your scripts on your Angelfire pages
The pages on which you use your scripts must live on the Angelfire servers. Those pages don't need to be in your cgi-bin, but they do need to be in your user directory.
Angelfire does not provide troubleshooting answers or technical support for your CGI scripts. However, there are a number of valuable website resources available for programming assistance.