Why? InterNetworking
Public CGI Programs

Thank you for choosing Why? InterNetworking to supply your Web/FTP hosting needs. All web accounts may make use of the programs in the public CGI-Bin directory (http://www.dirtside.com/cgi-bin/, which resides in /httpd/cgi-bin on the server.) In this document, we'll describe the available and supported CGI programs in that directory.

Contents

  1. CGI Program basics
  2. The Simple CGI programs
  3. CGI program debugging tools
  4. The Imagemap program (processes a buttonclick on a graphic with many buttons)
  5. The Mailform program (mails form results to you)

1. CGI program basics

A CGI program is a computer program which resides on the web server, and creates its output "on the fly" when the web server is accessed. Why? InterNetworking has several CGI programs which we make available to our web customers.

Methods

When a CGI program is accessed, the web browser uses one of two "methods" too access the server, called "POST" and "GET". Which method you should use depends on what you're doing with the CGI program.

GET: The GET method is prefered when you're accessing the CGI program via a link in your html document rather than via an html form. The input to a GET method program appears in the URL, following the "?".

POST: The POST method is prefered when you're accessing the CGI program from an html form. The input to a POST method program does not appear in the URL box on your web browser.


2. The Simple CGI programs

* Date:

Date is a CGI program which returns the date and time according to the web server.

Method: GET
Example: <A HREF="http://www.dirtside.com/cgi-bin/date">Check today's date.</A>

* Finger:

Finger is a CGI gateway to the Unix "finger" protocol. Finger sometimes allows you to look up information about particular users.

Method: GET
Example: <A HREF="http://www.dirtside.com/cgi-bin/finger?herrin@minoc.dirtside.com">Check to see if the Webmaster is around.</A>

* Nph-NsLookup:

Nslookup displays DNS information. If you'd like to know more about an Internet host name, try this.

Method: GET
Example: <A HREF="http://www.dirtside.com/cgi-bin/nph-nslookup?dirtside.com">Look up Why? InterNetworking's domain.</A>

* Uptime:

Uptime displays statistics about how long the server has been running, and what the current server load is.

Method: GET
Example: <A HREF="http://www.dirtside.com/cgi-bin/uptime">Check the server load.</A>

* WhoIs:

Whois is a CGI program which allows you to query the Internic's database in order to find out if a domain name is available, and who owns it.

Method: GET
Example: <A HREF="http://www.dirtside.com/cgi-bin/whois?dirtside.com">Check to see if dirtside.com is available.</A>


3. How to Debug your CGI programs

500 Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster@dirtside.com and inform them of the time the error occurred , and anything you might have done that may have caused the error.
Error: HTTPd: malformed header from script something.cgi

If you see this error when you try to use your CGI program, then something is wrong. What's wrong with it? Well, the message above is less than helpful in determining why the program failed.

To determine why your CGI program is failing to work, you should run it in debugging mode. To do so, add "/cgi-bin/debug" to the front of your CGI program's URL. This will cause the results to be displayed to you as plain text instead of HTML, and it will display any errors that the program reports.

So, for example, if you're calling a CGI program from an HTML form where the FORM tag looks like this:

<FORM METHOD= "POST" ACTION= "http://www.dirtside.com/cgi-bin/mailform" >

Then adjust the URL so that it looks like this:

<FORM METHOD= "POST" ACTION= "http://www.dirtside.com/cgi-bin/debug/cgi-bin/mailform" >

Other useful tools: /cgi-bin/test-cgi tells you what variables have been set for a GET method CGI program, and /cgi-bin/post-query tells you what variables have been submitted to a POST method CGI program.


4. The Imagemap program

Discussion of imagemaps is beyond the scope of this document. To learn more about how to use imagemaps, check the Yahoo index. /cgi-bin/imagemap is maintained for compatibility with documents from other web servers. Whenever possible, please reference your .map files directly rather than using the imagemap program.


4. The MailForm program

The mailform program allows you to send yourself E-Mail containing the responses from an HTML form. This can be used for such things as a comments form, or an application or order form.

To use the form, simply create a form with variable names which you've made up, use the method "POST", and set the action URL to http://www.dirtside.com/cgi-bin/mailform. In addition to the variables you want returned to you, your form must contain three others:

bouncto: The bounceto variable contains the full URL of the web page that should be displayed once the response from the form has been mailed to you.

mailto: The email variable contains the name part of your Why? InterNetworking email address. So, if your E-Mail address is someuser@dirtside.com, this variable should contains "someuser".

printem: The printem variable contains a comma seperated list of names of the variables whose contents you'd like to receive in the email message. So, if you want the contents of the "name" and "creditcard" variables, printem would contain, "name,creditcard".

email (optional): The email variable contains the full email address from whom the mail should appear to come. If not given, the mail will appear to come from httpd@dirtside.com.

Example:

<FORM METHOD= "POST" ACTION= "http://www.dirtside.com/cgi-bin/mailform" >

Your Name: <INPUT TYPE="text" NAME="name" SIZE=40><BR>
Credit Card Number: <INPUT TYPE="text" NAME="card" SIZE=40><BR>
<INPUT TYPE="hidden" NAME="mailto" VALUE="johndoe">
<INPUT TYPE="hidden" NAME="bounceto" VALUE="http://www.dirtside.com/~johndoe/">
<INPUT TYPE="hidden" NAME="printem" VALUE="name,card">
<INPUT TYPE="SUBMIT" VALUE="Send It">
</FORM>


[Go Back][Rates][Why?][EFF]