Adding CGI to Your Web Page
This CGI program makes it possible to create an xhtml or html form that will accept input from visitors and mail it to you at any address you wish. In order to add the Mail Form to your Web page, you must do the following:
- Create an xhtml or html file in your WEB directory that includes the form that requests the information you would like mailed to you. You should begin the form section of the file as follows, replacing the italic text:
<form action="/cgi-bin/mailto.pl" method="post"> <input type="hidden" name="recipient" value="email@example.com"> <input type="hidden" name="auth" value="authorization code"> <input type="hidden" name="subject" value="Your_subject"> <input type="hidden" name="confirm" value="/user/username/confirm.html">
Change the permissions on the file using !websecurity or your upload client.
- Log in to the WELL Utilities page, and select the Web Forms option. You need to generate the authorization code to replace the entire line shown in bold above.You must provide the same email address on this Web Form page as you have specified as the recipient in previous line of the form. You can use the same authorization code line for mail forms on different pages provided you use the same address as the recipient on those pages.This is a security measure needed to prevent abuse of the Mail Form CGI by spammers.
- Create a file called confirm.html for your users to land on after a message is submitted. Place this file into your WEB directory, and specify its location in the xhtml above. If you have not yet created a WEB directory please refer to the Web Publishing on The WELL page.
Here is an example of XHTML code that you may copy and use for a Mail Form. Insert your username and your authorization code in the appropriate places.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>send me mail!</title> </head> <body> <h1>Send me mail!</h1> <form action="/cgi-bin/mailto.pl" method="post"> <input type="hidden" name="recipient" value="firstname.lastname@example.org" /> <input type="hidden" name="auth" value="authorization code"> <input type="hidden" name="subject" value="Your_subject" /> <input type="hidden" name="confirm" value="/user/username/confirm.html" /> <p><b>Your name:</b> <input type="text" name="from" size="30" /></p> <p><b>Regarding:</b> <input type="text" name="subject" size="30" /></p> <p><b>Your email address:</b> <input type="text" name="email" size="30" /></p> <p><textarea name="body" cols="60" rows="12"> type your message here </textarea></p> <input type="submit" value="send mail" /> <input type="reset" value="clear form" /> </form> </body> </html>
Here is how the result appears in email to you when someone completes the form:
Date: Tue, 19 Apr 2005 21:22:08 -0800 From: Some Body <email@example.com> To: firstname.lastname@example.org Subject: my message email@example.com (Some Body) sent the following from http://www.well.com/user/username/mail.html : Sender Information ----------------------------------------------- REMOTE_HOST = blahblahblah.com REMOTE_ADDR = 18.104.22.1680 HTTP_USER_AGENT = Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.6) Gecko/20050317 Firefox/1.0.2 ) Form Information ----------------------------------------------- recipient = firstname.lastname@example.org subject = Some Thing confirm = http://www.well.com/user/username/confirm.html from = Some Body subject = my message email = email@example.com body = Wow! Really cool Form! Best wishes, No Body
Contact firstname.lastname@example.org if you have any questions or difficulties using Mail Form CGI.
It’s really quite easy to set up an access counter on your page. At this point, we request that users put up no more than one counter each. It’s best to put your counter up on your index page or most popular page, and leave it at that.
Here’s how to do it:
- Add the following line to your page, at the location you want the counter to appear. Substitute your u/s/userid for p/o/pope and name the counter file whatever you like (in this case it’s named .counter):
<img align=middle src="/cgi-bin/Count.cgi?ft=2|frgb=0;0;0|tr=0| trgb=0;0;0|wxh=15;20|md=6|dd=B|st=5|sh=1|df=p/o/pope/.counter">
This should be one loooong line, don’t let it break.
You can change the border thickness by changing ft=2 to some higher or lower number. (“ft” stands for “frame thickness.”)
You can set each color’s RGB values as well. frgb=0;128;128 will make that element a nice green color, for example.
- Now ssh into your account. Use the !makecounter command to create a .counter file in your WEB directory with the correct permissions. If you want your counter file to have a name other than .counter, specify that name when you run the command. For example: !makecounter .mycounter will create a .mycounter file.
Tip: you can pick from a variety of fonts, demonstrated at this page of sample counters. View the page’s source for examples.
For Further Information…
For information about The WELL or for WELL Customer Support, contact:
1195 Park Avenue, Suite 206
Emeryville, CA 94608
email: helpdesk at well dot com for more information about The WELL and WELL Customer Support.