Please do not try to deploy ASForm without first having carefully read and understood the documentation! ASForm is a highly configurable application, and to blindly push ahead without knowing what you are doing is sure to be a frustrating experience.
At this point, you should have read the description of ASForm's features and should have a pretty good idea of how you want ASForm to behave. If you have done so, you should find the configuration of ASForm to be pretty straightforward. There are quite a number of configuration parameters, but they're all simple to understand and configure -- most of them are optional.
Configuration files are just plain text, with the rule being that a "newline" (the Enter key on your keyboard) terminates the definition of the configuration parameter. If your text editor likes to add newlines for you, you'll have to either disable that behavior or work around it when creating a configuration file. Embedded comments are allowed -- everything on a line after a # is taken to be a comment, except when it's used in the URL of sucess: and indicates a document anchor. Empty lines are ignored.
When an email address is used in a configuration file, it must be formatted properly, as user@yourISP.com "email alias" with the email alias always being optional. For example, my address might be cgistuff@artsackett.com "Art Sackett's CGI Stuff".
If you are inexperienced in setting up CGI applications, you may want to read through the artsackett.com grey paper http://www.artsackett.com/grey_papers/cgi/broken_install.html for some hints, tips, and what to do if and when things go wrong.
ASform will not run at all without some required parameters defined. two of these are in the perl script itself, the others are in the configuration file(s).
#!/usr/bin/perl
with the shebang (#!) in place in the first two character positions of the very first line.
(If you don't know what the path to the perl interpreter is, and you aren't sure how to find out, please read through the artsackett.com grey paper mentioned above.)
If you are okay with the default configuration file being in the same directory as asform.cgi and named asformcfg.cfg you do not need to change this. The line that you define this parameter on is line 61, and looks like this:
$config_file = 'asformcfg.cfg';
It's easy enough to spot, and is in a section that is commented as being USER CONFIGURATION.
After uploading ASForm to your server, make sure that it is NOT writable by the server. If it is, it will know and it will absolutely refuse to do anything but bark an error at whoever tries to use it. Even in debug mode, all it will do is bark an error and refuse to complete the debug run.
There's nothing saying that you have to use the provided example configuration file as a template -- but it might be easier unless and until you've made several of them.
If you wish to write files for every form submission, there are two types of files available to you: mailfile and datafile, and you may have one of each specified. A mailfile is nothing more than a file to which all form submission reports are appended -- it can grow quite large very quickly if your form is heavily used, so you should keep an eye on it and empty it from time to time. A datafile is meant to be used in conjunction with some other software that knows how to deal with comma-separated (or "delimited") flat-file database tables. In a datafile, embedded commas within the data are escaped with "backslashes", HTTP environment variables that are captured are appended to the end of the record, and it's all followed by the time string indicating the time at which the form was processed. To add a mailfile or datafile to your recipients:
mailfile: path/filename
datafile: path/filename
The specified file does not have to exist, but it must be a file that ASForm can create. If it exists, it must be writable by ASForm. If one of these files is specified but does not exist, it will be created when it is needed, or when ASForm is run in debug mode.
Special note for datafiles: If you wish to use ASForm in this manner, you should also include every field your form can send in the sort order -- or your database table will very likely become worthless to you very soon.
None of the rest of the configuration variables are absolutely essential, but a couple of them are very important to know about. Whether or not you use them is your choice. The very important ones are listed first.
The referrers filter compares the value of the HTTP environment variable HTTP_REFERER to the filtering rules you provide to determine whether or not to continue processing. If the value of HTTP_REFERER does not match against your filter, the transaction is aborted and the user is presented with an explanatory HTML document. Whether to pass or reject those clients that do not set this variable is determined by the value of the configuration variable pass no-referers. With the referrers filter, you can determine which hosts and which directories within each host are acceptable to you.
The referrers filters are applied in sequence, from the first one in the configuration file to the last. Filters can be grouped on one line, or spread across several lines, or a combination of the two styles.
Global settings:
Narrowing the filter:
Running ASForm in debug mode will show you how your filters will be applied, so if you're not sure that you got it right, try running debug. Just don't forget to switch it back off as soon as you're done.
An example:
Assuming ASForm is installed on www.yourisp.com:
referers filter: +host(floogle)
referers filter: ~jdoe/forms, ~jdoe/misc
With the first line, we change the host name to floogle, so it's now floogle.yourisp.com. Because we never mention www, any value of HTTP_REFERER from www.yourisp.com is rejected, even if it's http://www.yourisp.com/~jdoe/index.html.
On the second line, we narrow the filter to two directories, and two directories only. If you're operating from a user account at an ISP, you probably want to go at least as far as that portion of the URL that indicates your own account. In this case, any value of HTTP_REFERER that begins with http://floogle.yourisp.com/~jdoe/forms or http://floogle.yourisp.com/~jdoe/misc will pass, and all others will be rejected.
Important note: The protocol portion of the URL must be one of http://, https://, or ftp://. ASForm isn't intended to be used with any other protocol.
VERY Important note: If you are working with a secure server (https protocol), you must use the POST request method from your form(s). ASForm won't let you do anything so foolish as a GET in HTTPS.
For the curious: Yes, I use two different spellings of "referrer". In the HTTP environment variable, it is misspelled as referer, and this is how ASForm uses it, just for the sake of remaining true to convention. In these documents, I use the proper spelling to refer to the concept, and the conventional one to refer to the implementation.
Note: Don't try to use Server Side Includes in your error head and error foot documents. They wouldn't work anyway, and just to be safe, ASForm strips out anything that might be an SSI directive before serving up the document.
Field names are case sensitive -- if you get complaints that no one can submit your form, check this while running debug.
NOTE: If your form contains any fields whose names begin with email or hide_email, they will automagically become required, and will be checked for proper formation before the form can be submitted.
NOTE: Moving an environment variable such as REMOTE_ADDR into the sort order makes it a part of all data dumps, so if echo is set to on, the Autoresponder will include that environment variable in the echo. There is a workaround for this described elsewhere in the section on creating HTML forms for ASForm.
Very Important Note: If you're using a datafile, you should include all of the data that your forms might send in your sort order. If you don't, your tables will almost certainly get trashed by random data ordering.
| Index [online] |
Introduction/ Features |
Configuration | Installation |
| Customizing Error Messages |
Writing Message Templates |
Writing Forms for Use With ASForm |
Running ASForm Debug |
© 1999 - Art Sackett