Installation Guide

Remember if you will by this script we will install it for you for FREE!

ZIP File Content
  • formprocessorpro.pl - script itself.
  • formprocessorpro.log - log file.
  • example.html - an example HTML form that would use the templates given below.
  • email.txt - an example email template to be sent to you.
  • email_autorespond.txt - an example of an automatic courtesy reply, sent to the person using the form.
  • error.html - an example of an error template that would be outputted to the browser should something go wrong.
  • output.html - an example success template that would be outputted to the browser if everything went right.
  • logfile.txt - an example of a log file template.
  • ReadMe Directory - All information about script. (about, features, installation, registration, etc.)
Configure the Script:
 
  • $base_path - Sets the base path of your templates. The files specified in the HTML and log templates will be appended to this to make the real file name.
  • $mail_cmd - Sets the command to send mail on your system. The mailer must be able to accept the message headers and body via STDIN. E.g.
    $mail_cmd = '/usr/sbin/sendmail -t'; - default
  • $mailserver - Sets the SMTP server address.
    $mailserver = 'your.smtp.server';
    $mailserver = 'localhost'; - default (In most cases this will work. Emails will be sent through localhost SMTP server)
    NOTE: If you want to use SendMail then you need to use $mail_cmd variable and comment or delete $mailserver variable. If you want to use SMTP server then you need to use $mailserver variable and comment or delete $mail_cmd variable.
  • @Referers - Sets the list of Valid Referers- i.e. those sites & pages you want to be able to use the script. All others will be denied access. You can be very specific so only one page has access, or general so a whole site can use it. To allow any site at all to use the form, comment out this value entirely.
  • $content_type - Sets the MIME type you want sent to the browser. Unless you have good reason not to, use $content_type = "Content-Type: text/html\n\n";
Configure the Templates:
 
  • Template file names are arbitrary. Try to use names you will remember, e.g. "email.txt", "error.txt".
  • Wherever you want the user to supply data, use a word inside square brackets, e.g. [yourname], [age].
  • You can have underscores in variables, as long as there is a switch in front of it.
  • You can specify one or more switches on the start of the variables, e.g. [re_email_address], [d_age].
    Switches allowed:

    • r - this values is 'required'- it must be filled in.
    • e - this value must look like a valid email address.
    • d - this value may only contain digits (0-9).
    • w - this value may only contain "word" characters (A-Za-z0-9).
    • s - this values leading and trailing white space will be removed.
  • The field names in the HTML must match exactly with those in the templates. I.E. same switches etc.
  • For the email templates, make sure the To: and From: line will have a valid email address in it (by using the e switch). If you let the user put in any old information into the To: line, your email program will create an error.
  • Make sure for email templates there is a blank line between the headers and the content.
  • Logging templates must have the filename to write to as the first line. Everything after the first line will be appended (tacked onto the bottom of) the file specified.
  • Fields in the templates such at [%HTTP_REFERER], [%REMOTE_HOST] will be substituted with their counterpart environment values. The must begin with a %. You cannot require an environment setting- if it is not set it will be left blank.
  • In error templates, the error title is specified as [%OUT_TITLE], and the error message is specified by [%OUT_MSG].
  • To do arithmetic, place the calculation in brackets like [< ... >]. Variables will be filled out before being calculated. Examples:
    • [< [d_age] / 2 >] - will be given the value of the value of [d_age] divided by 2.
    • [< ([item1] + [item2] + [item3]) * [tax] >] - will add up the items and multiply them by the tax rate.
  • Remember to save the templates and the script in ASCII or Plain Text mode.
Configure the HTML
 
  • All the operations that you want to occur on this iteration are given in hidden form values. I.e. <input type="hidden" name="_send_email" value="email.txt">.
  • Operations are done in the order specified in the HTML. For this reason, it is recommended that you specify the browser output last.
  • Operations are denoted with a leading underscore. They are:
    • _send_email - this sends email using the template in this tag's value.
    • _out_file - this logs to a file using the template given in the value.
    • _browser_out - this displays the value's template in the browser.
    • _redirect - this redirects the browser to the URL given here.
    • _error_path - if an error occurs, this template is displayed by the browser.
    • _error_url - if an error occurs, the browser is redirected to this URL.
  • You can have more than one _send_email or _out_file, if you want more than one email sent or file appended to. In this case, you must specify a unique number or letter after each one- i.e. _send_email_1, _send_email_2, out_file_a, _out_file_b, _out_file_c. It really doesn't matter what you put after them, just as long as each operation is unique.
  • Make sure the name of each field corresponds exactly to what you want it to replace in the templates.
Upload
 
  • Upload the script, the template(s) (the script must be in an executable directory e.g. /cgi-bin, the templates can go anywhere the script can reach them, the HTML goes where your HTML normally goes). Remember to upload in ASCII mode!
  • Change attributes of .pl files to executable (chmod 755)
  • Change attributes of log file to 'read/write' (chmod 666)
  • Enjoy! :-) or... if you will have any problems contact us.