Index Previous: SHIPPING Next: TRACKING AND BACKEND ORDER ENTRY

# USER DATABASE

MiniVend has a user database function which allows customers to save any pertinent values from their session. It also allows the setting of database or file access control lists for use in controlling access to pages and databases on a user-by-user basis.

The database field names in the user database correspond with the form variable names in the user session. If you have a column named `address`, then when the user logs in the contents of that field will be placed in the form variable `address`, and will then be availabe for display with `[value address]`. Similarly, the database value is available with `[data table=userdb column=address key=username]`.

The ASCII file for the database will not reflect changes unless you export the file with `[tag export userdb][/tag]`. It is not advisable to edit the ASCII file, as it will overwrite the real data that is in the DBM table; user logins and changes would be lost. (This would not happen with SQL, but editing the ASCII file would have no effect.) You should probably set the NoImport configuration directive accordingly.

This section describes the user database in MiniVend 3.12. Prior to 3.12, the user database was a demonstration add-on module with a global subroutine interface. Some of the concepts were the same; the module interface is much the same; and page code based on the previous version should work if the `userdb.cfg` file is still there.

The field names to be used are not set in concrete; they may be changed with options, and fields may be added or subtracted at any time. Most users will choose to keep the default demo fields for simplicity sake, as they cover most common needs. As distributed in the demo, the fields are:

        code
        accounts
        acl
        address
        address_book
        b_address
        b_city
        b_country
        b_name
        b_nickname
        b_phone
        b_state
        b_zip
        carts
        city
        country
        db_acl
        email
        email_copy
        fax
        fax_order
        file_acl
        mv_credit_card_exp_month
        mv_credit_card_exp_year
        mv_credit_card_info
        mv_credit_card_type
        mv_shipmode
        name
        order_numbers
        p_nickname
        password
        phone_day
        phone_night
        preferences
        s_nickname
        state
        time
        zip

A few of those fields are special in naming, though all can be changed via an option. A couple of the fields are reserved for Minivend's use.

IMPORTANT NOTE: If you are not running with PGP or other encryption for your credit card numbers, which should NEVER be done anyway, then it is important that you remove the mv_credit_card_info field from the database.

The special database fields are:

        accounts         Storage for billing accounts book
        address_book     Storage for shipping address book
        b_nickname       Nickname of current billing account
        carts            Storage for shopping carts
        p_nickname       Nickname for current preferences
        preferences      Storage for preferences
        s_nickname       Nickname for current shipping address
        db_acl           Storage for database access control lists
        file_acl         Storage for file access control lists
        acl              Storage for simple integrated access control

If not defined, the corresponding capability is not available.

NOTE: The fields `accounts`, `address_book`, `carts`, and `preferences` should be defined as a BLOB type if you are using SQL. This is also suggested for the acl fields if those lists could be large.

Reserved fields include:

        code        The username (key for the database)
        password    Password storage
        time        Last time of login

- The [userdb ...] tag
- Setting defaults with the UserDB directive
- User Database functions
- Address Book
- Accounts Book
- Preferences
- Carts
- Controlling page access with UserDB

Index Previous: SHIPPING Next: TRACKING AND BACKEND ORDER ENTRY