Perl Fishers
Or how to set up a simple CGI script and form to get your members' information sent direct to your inbox. A tutorial for fanlisting owners.


Introduction

Before you can add a member to your fanlisting, you need certain information from him or her. The TFL.org rules specify that you must have the member's name and country. Most fanlisting owners also require an email address and sometimes other pieces of information. The usual way of gathering this information is to put a form on your website, which the member then fills in and submits to you by clicking a button. There are several different ways of having that information sent to your inbox. This tutorial takes you step-by-step through one very simple method, using a freeware Perl CGI (Common Gateway Interface) script that is quick and easy to install.


Step 1 Gather information.

Once you can answer the following questions, you're ready to get set up. If you need to, you can have a look in your host's FAQ or help section, or contact your host and ask.


Step 2 Download the script and configure it.

  1. Download the script from Matt's Script Archive. Save it to a folder on your hard drive.
  2. Unzip the files.
  3. Open formmail.pl in a plain text editor, such as Notepad or Textpad.
  4. Search for the referers variable. Change the values it contains to match your site's domain name (with and without the 'www.' part) and IP address. For example, if your website's domain name is www.yourdomain.com and your domain's IP address is 123.123.12.3, then this line should read:
    @referers = ('yourdomain.com','www.yourdomain.com','123.123.12.3');
  5. Make sure the path to Sendmail is correct for your host.
  6. The same goes for the path to Perl.
  7. Upload your configured copy of formmail.pl to your cgi-bin folder. Be sure to upload it in ASCII mode.


Step 3 Set your script's permissions.

To work, the script must have the following permissions set.

The manual value of the correct permissions is 755.

How you set the file permissions varies from host to host.

With some hosts, you can set the correct file permissions by logging into your file manager or control panel, clicking on the file and then clicking "Set File Permissions."

Otherwise, you can usually set the script's permission in your FTP software. In CuteFTP, for example, select the file by clicking on it once on the remote system side, right-click on the file to bring up the option menu, and select "CHMOD." (Or click "FTP" and then "CHMOD.") This should bring up a "Change File Attributes" or similar dialogue box, where you can make the changes.


Step 4 Create a New Member page.

You can use any design you like for your New Member page.

I have included basic html below for you to use if you wish. Copy and paste it into Notepad or another plain text editor. Save it with any filename you like (examples: newmember.html, join.html, form.html) and as file type Text.

It is very important to remember to edit the following sections.

Upload the New Member page to your server.


Step 6 Create a Thank You page.

You can have any kind of Thank You page you like. Just make sure that it is uploaded to the url you've specified in the redirect part of your New Member page html.

I have included basic html below for you to use if you wish. Copy and paste it into Notepad or another plain text editor. Save it as thankyou.html and as file type Text.

Upload the Thank You page to your server.


Step 7 Testing.

Once you've configured your script, uploaded it to your cgi-bin folder, set your script's permissions, and uploaded your New Member and Thank You pages, go to the New Member page and test the form.

Fill in the form's fields and click the submit button. Then go to your email inbox and see if the form results are emailed to you. Depending on your mail program and your connection speed, this may or may not happen instantly.


Step 8 Troubleshooting.

Problem: The New Member form doesn't work at all.

Possible solutions:

Problem: The New Member form seems to work, and I'm taken to the Thank You page, but I don't receive an email with the form's contents.

Possible solution:

Problem: I've checked the path to Sendmail and the script's permissions, and still the New Member form doesn't work.

Possible solution:

Problem: The New Member form is working fine, but I'm concerned about spam.

Solution:

Problem: I don't want to have so many questions on my New Member page.

Solution:

Problem: The questions on the sample New Member page irk me. I'd rather write my own.

Solution:

Problem: I have got the form working. Now I'd like to have a form for when a member updates his or her information.

Solution:

Problem: I have a problem with the form that's not covered here.

Possible solution:


Questions? Comments? Suggestions? Email me.


yadda | home | contact