Formproc Control File Commands

#

append

dump

echo

execute

mail

label

require

set errordoc

set errordoc

verify

writefile

# Command

Description: Comemnt command. Any line that begins with a '#' is ignored.

Syntax: # anything

Example:

# This line is a comment

Append Command

Description: appends text to an existing file. Used for creating guest book databases.

Syntax: append filename   text-to-append

The text to append may contain spaces. Any @ commands in the text to be processed will be processed.

Examples:

Append guestbook.log @field(name)@tab()@field(email)@tab()@Builtin(datetime)

or

Append guestbook.log @expandfile(entrytemplate.txt)

 

Note: File must be writable by cgi programs. With our current configuration, this means the file must be writable by a process running as user nobody, group nobody. Filenames starting with a leading '/' are relative to the document root for the web site containing the formproc control file. Filenames that do not start with a leading slash, are interperted relative to the directory containing the formproc control file. "Special" prefixes, such as /cgi-bin ~username, or /shared, are not preoperly handled.

 

Dump Command

Description: debugging command to find out available environment or field variables.

Syntax: Dump what
Where what is 'env' or 'fields'. The former will dump all available Unix environment variables, and the later will dump all available fields.

Examples:

echo Content-type: text/plain\n\n
dump env
dump fields

Echo Command

Description: sends output from form submission. Used to build web result from submission. Any @ commands in the text will be processed.

Syntax: echo text

Example:

echo Content-type: text/html\n\n

echo @expandFile(confirming.html)

Note: make sure to send required headers.

Execute Command

Description: executes an arbitrary Unix command.

Syntax: execute command<cmd line> input<input text>

@ commands in cmd line and input text are expanded.

Example:

execute command"/usr/local/bin/sendfax -f hostmaster@@totalweb.com -n -d 532-5790 >/dev/null" input"@expandFile(confirming.ps)"

Note: always use @makesafe around user-provided arguments

Mail Command

Description: Sends e-mail

Syntax: mail from <from-address> to <to-address> content <mail-content>

@ commands in from-address, to-address and mail-content are processed.

Examples:

mail from "hostmaster@@mefco.com" to "@makesafe(@field(salesmanemail))" content<@expandFile(confirming.mail)>
mail from "@makesafe(@field(salesmanemail))" to "hostmaster@@mefco.com" content<@expandFile(hostmaster.mail)>

The 'envelope' address of the mail will be set to the from-address. Any error messages generated by the mail (such as destination mail box doesn't exist) should get returned back to the from-address.

The from address may be omitted, in which case the envelope from address will be the userid of the web server (in our case "nobody@asimov.mefco.com"). Any errors (such as user doesn't exist, or destination mailbox full) will be sent to the envelope's from address. Many mailers (including ours) will refuse mail if the envelope address is invalid.

Good manners requires that the content of the e-mail message contain both a To: and a From: header. It's nice if the included To: and From: headers match the specified To and From addresses. Our mailer may add an "apparantly-to" header if no To header is present.

Note: always use @makesafe around user-provided e-mail addresses

Label Command

Syntax: label field fieldname

require Command

Description: checks to make sure a field was filled in by the user.

Syntax: require fieldname

Example

label email Your E-Mail Address
require email

set errordoc Command

Description: Sets the template file containing the error document. If an error document is set, it is used instead of the ugly built-in error document. Upon encountering an error, the field "FORMPROCERRMSG" is set to the correct error message, and then the error doc is executed. You can set the error doc as often as you like in the .fp file, The .fp file is executed sequently, and at any time, only the most recently set errordoc will be used.

Syntax: set errordoc filename

Example

set errordoc errordoc.html

set field Command

Description: Sets the a field as if it had been set in the form. If the field is already defined, the value is replaced with this new value. The intent is to be able to set fields which can be used in templates.

Syntax: set field fieldname value

Example

set field myerrormsg You must

verify Command

Description: makes sure that if the specified field was entered, it looks like a calid e-mail address.

Syntax: verify fieldname

Example:

label email Your E-Mail Address
verify email

Note: If you want to make sure that a field is filled in, and it looks like an e-mail address, you must specify both verify and require.

WriteFile Command

Description: replaces an existing file. Used for admin modules.

Syntax: WriteFile filename   text-to-append

The text to append may contain spaces. Any @ commands in the text to be processed will be processed.

Examples:

WriteFile specials.html @expandfile(specials-template.html)

 

Note: File must be writable by cgi programs. With our current configuration, this means the file must be writable by a process running as user nobody, group nobody. Filenames starting with a leading '/' are relative to the document root for the web site containing the formproc control file. Filenames that do not start with a leading slash, are interperted relative to the directory containing the formproc control file. "Special" prefixes, such as /cgi-bin ~username, or /shared, are not preoperly handled.