OVERVIEW OF MINIVEND

The following sections briefly describe how MiniVend works.

How MiniVend Manages Sessions

Normally, each request for a World Wide Web page which comes in to a server stands on its own. While the server will probably know which machine a request comes from, it may not know if the next request comes from the same browser or even from the same user on that machine.

MiniVend keeps track of who is ordering what by including in the URL a session id: a random string which is different for each customer browsing the catalog.

So that the session id can be included in URL's within catalog pages, every page in the catalog is served up by MiniVend running as a cgi-bin program. Here is an example of such a URL:

http://bill.iac.net/cgi-bin/vlink/shirts?WehUkATn;;1

An explanation of each part:

bill.iac.net
Internet address of server

cgi-bin
Informs server that the requested page will be generated by a program.

vlink
Name of the program to run

shirts
Page of the catalog to display

WehUkATn;;1
The session id

Catalog pages are written in regular HTML with extensions to.support catalog ordering. Pages are delivered through the following steps:

1. The HTTPD server receives a request for a catalog page. 2a. The server runs svend as a cgi-bin program. svend is a small C program which is setuid to the account which owns the catalog files. svend executes the MiniVend Perl script minivend.pl. -- OR -- 2b. The server is already running as a daemon, and runs vlink instead of svend. The vlink program communicates with the MiniVend program via a UNIX-domain socket. THIS IS MUCH FASTER. 3. MiniVend reads the HTML source page from the catalog pages directory, and interprets the catalog ordering extensions in the file. If the page doesn't exist, and corresponds to a part number in the database, it is built "on the fly" using the template page flypage.html. 4. The page, which is now entirely in regular HTML, is delivered to the HTTPD server, which returns it to the browser.

Once the customer has finished, the completed order is emailed to the vendor.

SETTING UP YOUR CATALOG

MiniVend uses its own tags to implement catalog functions -- they are similar to normal HTML, but are in [square brackets]. They will usually be referred to in the following text as elements. The next section describes how to set up the pages and the configuration directives to make your own catalog. The demo catalog is a good starting point -- in particular we suggest you pay attention to the order and search pages.

products.asc

Each product you are selling should be given a product code: a short code that identifies the product on the ordering page and in the catalog. You can use any combination of letters, digits, dashes, periods, pound signs, or underscores for the product code. The products.asc file is a ASCII tab-delimited list of all the product codes, along with an arbitrary number of fields which must contain at least the fields 'description' and 'price'. Any additional information you want in the catalog can be placed in any arbitrary field.

The product code must be the first field in the line.

Here is an example of a products file:

code description price image SH543 Men's fine cotton shirt 14.95 shirts.jpg PA776 Elegant pants 29.00 pants.gif

IMPORTANT NOTE: The items must be separated by a single tab character. The items are lined up for your reading convenience.

This version of MiniVend implements the database in either GDBM, DB_File, or in-memory format. If you use DBM, large catalogs can be used without using too much memory; or slowing down performance in static mode. The DBM files are built automatically at MiniVend startup from the products file -- if it has not changed they are not built. If the only DBM type on your system is NDBM, an in-memory product database will be used. Catalogs of more than, say, 5,000 items will use large amounts of memory.

IMPORTANT NOTE: The field names must be on the first line of the products.asc file. These field names must match exactly the field names of the [in_field] tags in your catalog pages, or the MiniVend server will stop with an error.

When the products.asc file changes after import or edit, the DBM database is re-built upon the next server start.

Catalog Pages

Pages in the catalog are written in regular HTML with extensions to support catalog ordering. To distinguish them from regular HTML, these extended elements use square brackets instead of angular brackets.

The first page displayed in the catalog, if no argument is supplied to the vlink or svend cgi-bin program, is "catalog.html". This page will contain links to other catalog pages with the [page] element. Individual products can be ordered by the [order<item-code>] element, which brings up the order page "order.html". The order page contains input boxes for the customer to type in their name and address. Once the order has been sent the "confirmation.html" page is displayed.

If you use the the vendpage manpage utility, you will be able to write the pages in normal HTML, then convert them en masse to the Vend format. MiniVend tags (the ones in square brackets) can be passed in as HTML comments -- see the vendpage manpage for details.

You will normally not want to include regular hypertext links to pages outside of the catalog. Such links will not include the session id, which means that if the customer follows an external link back to the catalog the list of products ordered so far will have been lost.

Inline images, on the other hand, are served in the normal fashion. You should include a regular<IMG SRC="URL"> element, where the URL refers to a graphic image.

The following elements can be used in catalog pages:

[page pg]
Insert a hyperlink to the specified catalog page pg. For example, [page shirts] will expand into . The catalog page displayed will come from "shirts.html" in the pages directory.

[pagetarget pg frame]
Same as the page element above, except it specifies an output frame to target if frames are turned on. The name is case-sensitive, and if it doesn't exist a new window will be popped up. This is the same as the [page ...] tag if frames are not activated. For example, [pagetarget shirts main] will expand into a link like<a href="http://bill.iac.net/cgi-bin/vlink/shirts?WehUkATn;;1" TARGET="main">. The catalog page displayed will come from "shirts.html" in the pages directory, and be output to the 'main' frame. Careful, frame names are case-sensitive.

Also allows specification of secure pages if the target ends with the string __secure (which will be stripped). If so specified, the page will be called with SecureURL instead of VendURL .

[areatarget pg frame]
Inserts a Vend URL in a format to provide a targeted reference for a client-side imagemap. You set up the<AREA> tag with:

<AREA COORDS="220,0,270,20" HREF="[areatarget page frame]">

If frames are enabled, this will expand to:

<AREA COORDS="220,0,270,20" HREF="http://bill.iac.net/vlink/page?ErTxVV8l;;38" TARGET="frame">

If frames are not enabled, this will expand to:

<AREA COORDS="220,0,270,20" HREF="http://bill.iac.net/vlink/page?ErTxVV8l;;38">

[area pg]
Like the areatarget element, except it will never yield a frame target.

[/page], [/pagetarget]
Expands into</a>. Used with the page or pagetarget elements, such as: [page shirts]Our shirt collection[/page] or [pagetarget pants main] Our pants collection[/pagetarget]. They are syntactically the same, so you can use either to terminate an anchor -- the two different ones are provided for consistency.

[frames_on]
Turns on the frames processing option, which is disabled by default. The proper way to use this is to put it ONLY in a page which is loaded by frame-based browsers, as part of the initial frame load. It is persistent for the entire session, or until counteracted with a [frames_off] tag.

[frames_off]
Turns off the frames processing option. This can be used to disable frames, perhaps as a clickable option for users. It is persistent for the entire session, or until counteracted with a [frames_on] tag.

[finish_order]
This element is used to give the customer, while browsing, a way to return to the order page after they have already ordered something. If they haven't ordered anything yet [finish_order] does not appear at all on the displayed page. If they have ordered an item, the element will expand into something like:

<a href="http://bill.iac.net/cgi-bin/vlink/finish;WehUkATn;;1"> Finish Incomplete Order</a>

[order code]
Expands into a hypertext link which will include the specified code in the list of products to order and display the order page. code should be a product code listed in the "products" database.

[/order]
Expands into</a>. Used with the order element, such as: Buy a [order TK112]Toaster[/order] today.

[price code]
Expands into the price of the product identified by code as found in the products database.

[description code]
Expands into the description of code as found in the products database.

[field name code]
Expands into the value of the field name for the product identified by code as found in the products database. IMPORTANT: If the field name is not a field in the database, the MiniVend server will stop with an error.

[body n]
Selects from the predefined color schemes and/or backgrounds, and just becomes a<BODY> tag if none are defined. See Controlling Page Appearance .

[buttonbar n]
Selects from the predefined buttonbars, and is stripped if it doesn't exist. See Controlling Page Appearance .

[random]
Selects from the predefined random messages, and is stripped if none exist. See Controlling Page Appearance .

.

On-the-fly Catalog Pages

If an item is displayed on the search list (or order list) and there is a link to a special page keyed on the item, MiniVend will attempt to build the page "on the fly". It will look for the special page flypage.html , which is used as a template for building the page. If [item_field fieldname] , [item_price] , (etc.) elements are used on the page, quite complex and information-packed pages can be built. The [if_field fieldname] HTML [/if] pair can be used to only insert HTML if there is a non-blank value in a particular field.

The Order Page

The following elements are used on the order page:

[value field]
Expands into the current value of the customer input field named by field. See the section on input fields for more information.

[nitems]
Expands into the total number of items ordered so far.

[subtotal]
Expands into the subtotal cost, exclusive of sales tax, of all the items ordered so far.

[salestax]
Expands into the sales tax on the subtotal of all the items ordered so far. If there is no key field to derive the proper percentage, such as state or zip code, it is left at zero. See Sales Tax for more information.

[total_cost]
Expands into the total cost of all the items ordered so far, including sales tax (if any).

Within the order page, the [item_list] element shows a list of all the.items ordered by the customer so far. It works by repeating the source between [item_list] and [/item_list] once for each item ordered. Between the item_list markers the following elements will return information for the current item:

[item_code]
Evaluates to the product code for the current item.

[item_description]
Evaluates to the product description (from the products file) for the current item.

[item_increment]
Evaluates to the number of the item in the match list. Used for numbering search matches or order items in the list.

[item_field fieldname]
Evaluates to the field name fieldname in the database, for the current item.

[if_field fieldname]
If the database field fieldname is non-blank, the following text up to the [/if] tag is substituted. This can be used to substitute IMG or other tags only if the corresponding source item is present.

[/if]
Terminates an [if_field fieldname] element.

[item_quantity]
Evaluates to the quantity ordered for the current item.

[item_price]
Evaluates to the price (from the products file) of the current item.

[quantity_name]
Evaluates to the name to give an input box in which the customer can enter the quantity to order.

.

The Search Engine

MiniVend implements a search engine which will search the product database for items based on customer input. It uses the (example) nf_sel.html, nf_search.html, fr_comb.html, and search.html files in the pages directory, and has some of its own special tags and variables.

Two types of searching are available. The default is a text-based search of the products.asc file. An optional Glimpse search is enabled by placing the command specification for Glimpse in the directive Glimpse .

To use the Glimpse search, you must build the Glimpse index based on files in your ProductDir . If you installed MiniVend in the default /usr/local/lib/minivend, the command line to build the index would be:

glimpseindex -b -H /usr/local/lib/minivend/products products.asc

You could easily structure files such that they returned matches only for certain words or fields. One method that works well for large products.asc files is to split the products.asc file into small index files (in the example, 100 lines) with the split(1) UNIX command, then index it with glimpse:

split -100 products.asc index.asc. glimpseindex -H /usr/local/lib/minivend/products index.asc.*

This will dramatically increase search speeds for large catalogs, at least if the search term is relatively unique. If it is common string, you will be better off to use the text-based search.

If the Glimpse executable is not found at MiniVend startup, the Glimpse search will be disabled and the regular text-based search used instead.

[search_list]
Starts the representation of a search list. MiniVend tags can be embedded in the search list, yielding a table or formatted list of items with part number, description, price, and hyperlinks to order or go to its catalog page.

In particular, all of the item tags described under order page are active. The most useful one might be [item_link], which if properly used, can allow the user to search the catalog for an item, then click a link to go to detailed catalog page for the item. See the sample search.html page for an example.

[/search_list]
Ends the search list.

[more_list]
Starts the section of the search page which only is output if there are more matches than specified in mv_matchlimit . If there are less matches than the number in mv_matchlimit, all text/html between the [more_list] and [/more_list] elements is stripped.

Use in conjunction with the [more] element to place pointers to additional pages of matches.

[/more_list]
Companion to [more_list].

[more]
Inserts a series of hyperlinks that will call up the next matches in a series. They look like this:

Next 1 2 3 4 5 6 Previous

The current page will not be a hyperlink. Every time the new link is pressed, the list is re-built to correspond to the current page. If there is no Next or Previous page, that link will not be shown.

See the fr_resul.html or search.html files for examples. Make sure you insert this item between a [more_list] and [/more_list] element pair.

[item_link code]
Expands into a hyperlink which will jump the user to a page under the ItemLinkDir (default is the pages directory), with anchor text as set in ItemLinkValue (default is "More Details"). If the page is not present, then flypage.html will be used to build a page from the entry in the database. If that doesn't work (perhaps due to a missing flypage.html) then the error page notfound.html will be displayed. Only active in the search list.

[process_search]
Calls the search with the proper URL, including MiniVend session tags. Used as the ACTION value for the search form.

The sample nf_srch.html, nf_sel.html and fr_comb.html pages show example.search forms. You can modify them to present the search in any way you like -- just be careful to use the proper variable names for passing to MiniVend. It is also necessary that you copy the hidden variables as-is -- they are required to interpret the request as a search. The special form variables are:

mv_searchspec
The actual search string that is typed in by the customer. It is a text (INPUT TYPE=TEXT) field, or can be put in a select (drop-down) list to enable category searches.

mv_matchlimit
The page size for matches that are returned. If more matches than mv_matchlimit are found, the search paging mechanism will be employed if the proper [more_list] is present. Can be implemented as a scrolling list (INPUT TYPE=SELECT) or radiobox (INPUT TYPE=RADIO) field.

mv_orsearch
If this item is set to yes, the search will return items matching any of the words in searchspec. The default is no.

mv_case
If this item is set to yes, the search will return items without regard to upper or lower case. This is the default -- set to yes if case should be matched. Implement with a checkbox (INPUT TYPE=CHECKBOX) field.

mv_exact
If set to yes, matches only on whole words, not substrings. Ignored unless using Glimpse.

mv_searchtype
If set to glimpse, selects the Glimpse search (if Glimpse is defined). If set to text, selects the text-based search. Defaults to text if Glimpse is not defined, to Glimpse if it is. This can allow use of both search types if that is desirable -- for instance, searching for very common strings is better done by the text-based search. An example might be searching for categories of items instead of individual items.

mv_spelling_errors
The number of spelling errors that will be tolerated. Ignored unless using Glimpse. If you have a large catalog, you might wish to limit this to two.

mv_doit
This must be set to 'search' to make this a search page.

The sample search page also has a link to a help file (pages/help.html).which has rudimentary end-user help for the search engine.

Customer Input Fields

On the orders page, order.html, you will have a number of input fields allowing customer to enter information such as their name and address. You can add more fields simply by putting more input elements on the order.html page, and the information will automatically be included in the order report. Input elements should be written in this way:

<input type="text" name="town" value="[value town]" size=30>

Choose a name for this input field such as "email" for an email address. Set the name attribute to the name you have chosen.

The value attribute specifies the default value to give the field when the page is displayed. Because the customer may enter information on the order page, return to browsing, and come back to the order page, you want the default value to be what was entered the first time. This is done with the [value] element, which returns the last value of an input field. Thus,

value="[value name]"

will evaluate to the name entered on the previous order screen, such as:

value="Jane Smith"

which will be displayed by the browser.

The size attributes specifies how many characters wide the input field should be on the browser. You do not need to set this to fit the longest possible value since the browser will scroll the field, but you should set it large enough to be comfortable for the customer.

Special Fields

MiniVend treats some fields specially, to enable more control over your forms and user presentation.

These special fields all begin with mv_, and include:

*credit_card* Discussed in order security mv_background Explained in Controlling Page Appearance mv_bgcolor Explained in Controlling Page Appearance mv_case Explained in Search Engine mv_customcolors Explained in Controlling Page Appearance mv_doit Common to all forms, sets default action mv_linkcolor Explained in Controlling Page Appearance mv_matchlimit Explained in Search Engine mv_nextpage Sets next page user will go to after submission mv_orsearch Explained in Search Engine mv_perl Explained in Search Engine mv_resetcolors Explained in Controlling Page Appearance mv_searchspec Explained in Search Engine mv_searchtype Explained in Search Engine mv_spelling_errors Explained in Search Engine mv_textcolor Explained in Controlling Page Appearance mv_todo Common to all forms, sets form action mv_todo.map Contains form imagemap mv_todo.x Set by form imagemap mv_todo.y Set by form imagemap mv_vlinkcolor Explained in Controlling Page Appearance

Order Report File

The order report file, "report", defines the layout of the order report which gets mailed on the completion of the order. For example,

Order Date: $date Name: $name Email address: $email Shipping address: $addr Town, State, Zip: $town, $state $zip Country: $country

Any input field from the order page can be included using the dollar sign notation.

To prevent a value from being included in the order report, just add it to the ReportIgnore configuration directive.

MiniVend defines some values for use in the search form -- they begin with 'mv_' and are automatically ignored.

Sales Tax

MiniVend allows calculation of sales tax on a straight percentage basis. To enable this feature, the directive SalesTax is initialized with the name of a field (or fields) on the order form. Commonly, this is zipcode and/or state:

SalesTax zip,state

This being done, MiniVend assumes the presence of a file salestax.asc, which contains a database with the percentages. Each line of salestax.asc should be a code (again, usually a five-digit zip or a two letter state) followed by a tab, then a percentage. Example:

default 0 45056 .0525 61821 .0725 61801 .075 IL .0625 OH .0525 WA .08

Based on the user's entry of information in the order form, MiniVend will look up (for our example SalesTax directive) first the zip, then the state, and apply the percentage to the SUBTOTAL of the order (not including shipping). It will add the percentage, then make that available with the [salestax] tag for display on the order form. If no match is found, the entry 'default' is applied -- that is normally 0, but can be anything.

If business is being done on a national basis, it is now common to have to collect sales tax for multiple states. If you are doing so, it is possible to subscribe to a service which issues regular updates of the sales tax percentages -- usually by quarterly or monthly subscription. Such a database can easily be converted to MiniVend format.

Custom Shipping

MiniVend allows custom shipping charges to be added to an order based on the value of an entry in the database. Currently only quantity is supported by the supplied database, though if a database with shipping weight is available, that is supported as well (weight must be a field in the products.asc file). To enable custom shipping, enter the field that will be calculated in the CustomShipping directive:

CustomShipping quantity

The shipping cost database is a tab-separated ASCII file with six fields -- code, text description, criteria (quantity or weight, for example), minimum number, maximum number, and cost. None of the fields are case-sensitive.

code The unique identifier for that shipping method description Text to describe the method criteria Whether it is for weight, quantity, country, or whatever minimum The low bound of quantity/weight this entry applies to maximum The high bound of quantity/weight this entry applies to cost The total cost (or multiplier, if begins with 'x')

The cost is calcluated like this:

1. The base code is selected. If there is more than one entry per code, numbers are appended. 2. The criterion field is found -- if it is quantity, then it is in the quantity field of each item on the order form 3. The quantity is determined, and if the quantity falls with in the minimum and maximum, the cost is then applied. 4. If the cost is fixed, it is simply added. If the cost field begins with an 'x', the cost is multiplied by the quantity. 5. If no match is found, the 'default' entry is used.

An example would be this (the columns are lined up for your reading convenience, the actual entries should have ONE tab between fields!):

default Slow Boat quantity 1 99999999 3.00 upsg1 UPS Ground quantity 1 5 7.00 upsg2 UPS Ground quantity 6 10 10.00 upsg3 UPS Ground quantity 11 99999999 x .95 upsb1 UPS Blue quantity 1 5 12.00 upsb2 UPS Blue quantity 6 10 17.00 upsb3 UPS Blue quantity 11 99999999 x 1.60 upsr1 UPS Red quantity 1 5 17.00 upsr2 UPS Red quantity 6 10 22.00 upsr3 UPS Red quantity 11 99999999 x 2.10

If the user selected UPS Blue (code UPSB), and the quantity on the order was 3, the cost of 12.00 from upsb1 would be applied. If the quantity were 7, the next entry from upsb2 would be selected, for a cost of 17.00. If the quantity were 15, upsb3 would be selected, and the quantity of 15 multiplied by 1.60, for a total cost of 24.00.

If a default shipping mode other than 'default' is desired, enter it into the DefaultShipping directive:

DefaultShipping UPSG

This will make the<INPUT TYPE=RADIO NAME=mv_shipmode VALUE=upsg> entry on the order form checked by default when the user starts the order process.

Tracking and Backend Order Entry

MiniVend has a tracking option, enabled with the configuration directive Tracking . Entered orders and page popularity are tracked. The tracking database is also used to hold encrypted data such as credit card numbers, expiration dates, and the encrypted MiniVend password.

The Tracking directive must be a non-blank value to enable tracking. In addition, if the tracking database is not yet initialized, the Tracking directive is used to initialize the first order number to be placed in the tracking database. After that initialization, the value of the next order number is kept in the database (under the key mv_next_order) and incremented when an order is placed. The incrementation is alpha-numeric, so it is important to have leading zeros in any string value -- i.e., an initial value of Order00009 will be incremented to Order00010, while an initial value of Order9 will be incremented to Ordes0. Also, any non-alphanumeric characters will be stripped -- Order_00000 becomes Order00000.

The tracking is done by entering information in the DBM database tracking in the product directory ( ProductDir ). Orders are tracked under two keys, the actual key (started by the Tracking Directive) and a key that prepends the string "Backend" to the actual key. The entry in the actual key is a facsimile of the emailed order report -- the Backend key is the values selected in the BackendOrder directive, combined with the actual ordered item codes and quantities, separated by NUL characters (ASCII code 0).

To illustrate, take a MiniVend system that has tracking enabled with these two configuration directives in the minivend.cfg file:

Tracking Order00001 BackendOrder name,address,city,state,zip,account,mv_shipmode

When the user places an order for quantity 2 of item number P-133, the tracking database will have two keys/values added:

Key Value ---------------- ---------------------------- Order00001 (The order report, filled in -- see "Order Report File") BackendOrder00001 Joe J. User<NUL>123 Any St.<NUL>MainStreet<NUL>OH<NUL> 12345<NUL>Acct#123<NUL>P-133<NUL>2

If the customer left a credit card number with the SSL account information form (see Order Security ), the credit card number and its associated expiration date will be placed in two additional fields:

Key Value ---------------- ---------------------------- CcOrder00001 (encrypted data) ExpOrder00001 (encrypted data)

The scheme allows a history of orders to be kept (the Order00001 key) and a list of unentered orders (the BackendOrder00001 key, along with the CcOrder00001 and ExpOrder00001 keys). An external program can read the tracking database and submit the orders to an order-entry system, removing (or undefining) the BackendOrder, CcOrder, and ExpOrder keys when finished. An rudimentary example script which displays the tracking database is supplied as 'trackrpt' in the bin/ directory. This script could be easily modified to actually perform batch order entry.

Page popularity is simply tracked by storing a count of accesses, with the page name as the key. No additional information is stored. It is designed to give the catalog designer an idea of which features, pages, and menus are popular, and which are rarely used. Since individual page accesses are tracked, it might also give marketing or sales an idea of problems with product perception -- if an item were frequently looked at, but rarely bought, it might be appropriate to re-write the catalog page.

Order Security

MiniVend has several features that enable secure ordering via SSL (Secure Sockets Layer). Despite their mystique, SSL servers are actually quite easy to operate. The difference between the standard HTTP server and the SSL HTTPS server, from the standpoint of the user, is only in the encryption and the specification of the URL -- https: is used for the URL protocol specification instead of the usual http: designation.

IMPORTANT NOTE: MiniVend attempts to perform operations securely, but no guarantees or warrantees of any kind are made! Since MiniVend comes with Perl source, it is possible to modify the program to create bad security problems. One way to minimize this possibility is to record digital signatures, using MD5 or PGP, of minivend.pl, minivend.cfg, and all modules included in minivend.pl (standard ones are Vend/Server.pm, Vend/Imagemap.pm, Vend/Http.pm, Vend/lock.pm, and possibly Des). Check them on a regular basis to ensure they have not been changed.

MiniVend uses the SecureURL directive to set the base URL for secure transactions, and the VendURL directive for normal non-secure transactions. Secure URLs can be enabled for forms through the [process_target action secure] element, pages through the [pagetarget page frame__secure] element, and access to the secure account information form is available through the [secure_order] element.

MiniVend incorporates additional security for credit card numbers. Any field on the order form which has credit_card in its name will not be written to disk unless it is encrypted. Either an external encryption program, such as crypt(1) or des(1), can be used, or for internal encryption, the Perl Des module can be used. The Des module can be defined at program configuration time, or can be inserted in the minivend.pl configuration section as the line:

use Des;

The Des module is available at the same sites as Perl Version 5 . It also requires a functional libdes library, which will be harder to obtain.

To accept credit_card fields, you need to define several things in minivend.cfg (or with MAT). First, the directive CreditCards needs to be set to yes. Also, Tracking needs to be enabled, to provide a place to store the credit card numbers as well as a place to store your access password. EncryptProgram also needs to be defined with at least some value. If using the internal Des support, the entries should look something like:

CreditCards Yes Tracking Order00001 EncryptProgram internal

If you wish to use an external encryption program, recognize that this is not nearly as secure as using the internal Des option, for the design of most encryption programs prevents secure transmission of the password. The password has to be sent on the command line, and though MiniVend tries to hide it, not all operating systems will prevent access to the password through the ps(1) command. If you decide this is acceptable, here is an example EncryptProgram definition that will work for many des(1) implementations:

EncryptProgram /usr/bin/des -e -k %p < %f

The %p parameter indicates the location where the password will be placed in the command line, and %f is the placeholder for the input file name. Consult your des(1) manual page for details on how the command line should be constructed.

If your encryption program allows the password to be placed on the first line of the text to be encrypted, omit the %p specification. MiniVend will send the password, followed by a newline, before sending the text to be encrypted. This is much more secure than a command line password, but your encryption program may not allow this mode of operation.

If the CreditCards , EncryptProgram and Tracking directives are defined at program startup, MiniVend will prompt for a password before starting the server. This password is checked against a password previously stored in the tracking database (if it exists), otherwise MiniVend prompts for a second entry to verify a new password, which is then stored in the tracking database. Three tries can be made before MiniVend gives up.

If encryption is not enabled, MiniVend will silently overwrite any fields in the order form(s) with X characters. This prevents non-authorized startups from saving any sensitive information to disk.

Using Frames

MiniVend fully supports frames, the proposed extension to HTML 3.0. (Currently only Netscape 2.0 and above browsers support frames.) Frames significantly enhance the electronic catalog experience, since the user can maintain a context -- with a search frame, a product details frame, a table-of-contents frame, etc. The demo included with MiniVend is based on frames, though if you access it with a non-frame browser it will operate perfectly well.

Frames are accessed by adding a TARGET element to a HREF, naming the frame that the referenced URL should be placed in. MiniVend produces targets with the pagetarget and areatarget elements, which send target tags if frames are enabled (by a [frames_on] element. Any frame name can be used, including the special frames of _top, _blank, _parent, and _self.

As shown in the demo pages, the best way to accommodate both types of browsers is by having an index.html page that sets the beginning frame set. The<FRAMESET> and<FRAME> tags will be ignored by standard browsers, which will read the HTML between the<NOFRAMES> and</NOFRAMES> tags below.

The format of the first set of URLs passed to the frames is important - only ONE MiniVend link must be called. That sets the session ID for the user. If two URLs were called, MiniVend would assign two session IDs to the user, scrambling the context of their navigation. From this single access, all further references to MiniVend are made, though after the first access multiple frame targets can be referenced.

This first MiniVend page that is accessed (with a frame browser) should contain a [frames_on] element. It is the only page that need (or should) contain a [frames_on], which is persistent throughout the session. This page should never be seen by a non-frame browser.

Subsequent accesses to MiniVend URLs will now contain the proper session information, and as long as pagetarget or page elements are used to pass the URLs, context will be maintained.

The [pagetarget page frame] element is used to pass target tags in hyperlinks. The [areatarget page frame] element is used to pass target tags in imagemaps. The [frames_on] and [frames_off] elements enable and disable frame operation. The [framebase frame] element sets a base target for a page.

See the demo pages:

fr_greet.html Starting frame for frames-based browsers - has [frames_on] nf_greet.html Turns off frames -- has [frames_off] reframe.html Re-enables frames after they have been turned off

Controlling Page Appearance

MiniVend provides centralized page color and imagemap control through use of the [body n] and [buttonbar n] elements. It also can place a random message from a series of messages with the [random] element, and embed help messages with the [help item] element.

The [body n] element selects a color scheme -- numbered from 1 to 15 -- that is set by the Mv_Background, Mv_TextColor, Mv_BgColor, Mv_LinkColor, and Mv_VlinkColor directives. Each can contain up to 15 parameters, after an opening BEGIN. Here is an example:

Mv_Background BEGIN /images/blue_pap.gif Mv_BgColor BEGIN none steelblue white Mv_LinkColor BEGIN none white black Mv_TextColor BEGIN none ltgreen blue Mv_VlinkColor BEGIN none orange purple

The above sequence (set in the minivend.cfg file, or through MAT) defines three color schemes, accessed with [body 1], [body 2], and [body 3] elements in MiniVend pages. The first scheme uses the file /images/blue_pap.gif as the background pattern, and keeps the user's default colors for everything else. It is called by a [body 1] element, which when expanded becomes<BODY BACKGROUND="/images/blue_pap.gif>.

The second scheme defines no background pattern (there is only one file in the Mv_Background directive), but defines a background color of 'steelblue', with a text color of white, a link color of light green, and a visited link color of orange. It is accessed by the [body 2] element, which when expanded becomes<BODY BGCOLOR="steelblue" TEXT="white" LINK="ltgreen" VLINK="orange">.

The third color scheme is similar to the second, except defines white-black-blue-purple for the four colors. It is accessed with a [body 3] element.

If there is no defined scheme for a body element (as there wouldn't be if you put [body 4] in a page with the above schemes defined) MiniVend simply outputs a standard<BODY> tag.

The user can also define their own colors if the Mv_customcolors variable is set (upon a form submission). See the supplied control.html page for an example of how to set custom colors.

Image maps can be supplied and similarly controlled with the [buttonbar n] series of tags. They are defined with the ButtonBars directive (also set in minivend.cfg or with MAT), and take the form of a series of file names in MiniVend format -- i.e., relative to the PageDir and without a .html extension. To use the buttonbars, create a file with an IMG directive set with the USEMAP element and an associated client-side image map (defined with<MAP></MAP>. The [areatarget] or [area] tags are used to set the URLs. An example:

<IMG SRC="/sample/images/artbar0.gif" USEMAP="#ARTBAR0"> <MAP NAME=ARTBAR0> <AREA COORDS="198,0,278,20" HREF="[areatarget fr_sel search]"> <AREA COORDS="303,0,363,20" HREF="[areatarget fr_search search]"> <AREA COORDS="388,0,442,20" HREF="[areatarget fr_greet main]"> <AREA COORDS="473,0,537,20" HREF="[areatarget control main]"> <AREA COORDS="0,0,560,20" NOHREF> </MAP>

If the above were saved in the file PageDir/bars/artbar0.html (where PageDir is your MiniVend pages directory), you would be able to access this imagemap in your pages with a [buttonbar 0] tag, at least after MiniVend read this line in the configuration file:

ButtonBars bars/artbar0 bars/artbar1 bars/artbar2

The above entry allows you to define three imagemaps and access them in your pages simply as [buttonbar 0], [buttonbar 1], and [buttonbar 2]. The advantage of this scheme is central definition of a series of button bars with only a few tags -- if you change your page colors or mapping, you need only change one file and the change will roll over to all of your catalog pages. Since some installations can number in the thousands of catalog pages, using the pre-defined buttonbars can save a lot of editing. (Server-side includes cannot be used to achieve the same thing with MiniVend, since they wouldn't have the proper URLs.)

Imagemaps can also be defined on forms, with the special form variable mv_todo.map. A series of map actions can be defined -- the action specified in the default entry will be applied if none of the other coordinates match. The image is specified with a standard HTML 2.0 form field of type IMAGE. Here is an example:

<INPUT TYPE="HIDDEN" NAME="mv_todo.map" VALUE="rect submit 0,0 100,20"> <INPUT TYPE="HIDDEN" NAME="mv_todo.map" VALUE="rect cancel 290,2 342,18"> <INPUT TYPE="HIDDEN" NAME="mv_todo.map" VALUE="default refresh"> <INPUT TYPE="IMAGE" NAME="mv_todo" SRC="url_of_image">

All of the actions will be combined together into one image map with NCSA-style functionality -- see the NCSA imagemap documentation for details -- except that MiniVend form actions are defined instead of URLs. The standard actions are:

submit Submit order refresh Refresh order page (update quantities, etc.) cancel Cancel order and wipe credit card numbers return Go to previous page (or page defined in mv_nextpage variable) control Control help, colors, etc. search Search for an item in the catalog

The [random] element, in conjunction with the Random directive in the minivend.cfg file (or set with MAT), is similar to the buttonbar tag, except it displays random messages or images. It can be used to place a random tip, hint, ad, or message, and can be any legal HTML construct. It cannot contain MiniVend elements.

The [help tag] element, in conjunction with the Help directive in the minivend.cfg file (or, of course, set with MAT), is similar to the buttonbar tag, except it displays help messages or images, and is keyed by item name. The help can be contained in any of a series of files defined in the Help directive. It can contain most MiniVend elements. The user can turn off help through a form -- see the control.html file for an example.


AUTHORS

Original author of Vend is Andrew Wilcox, awilcox@world.std.com MiniVend is based on Vend 0.2, with portions from Vend 0.3, and is enhanced and modified extensively by Mike Heins, mikeh@iac.net



Chapter 7

Table ofContents