CUSTOMIZE: Client Customization for OS/2 Web Servers

This document describes CUSTOMIZE: a client customization facility for OS/2 web servers.
To use CUSTOMIZE, your server must:
  • understand CGI-BIN scripts, and
  • understand the #EXEC server side include; that is, be compliant with NCSA-style server side includes
  • Summarizing the contents of this document:

    Note that CUSTOMIZE is adapted from an addon created for the SRE-http web server. Since the SRE-http version uses direct calls, it is often substantially faster then this, the CGI-BIN compliant, version.

    Synopsis

    Client customization: granting clients the ability to effect the look and feel of your site.

    Whether it's picking the background and icon set, or choosing the types of stories your want to see on a web-newsletter, it's nice to be able to customize the appearance of a set of web pages. If you have an OS/2 based web server you can use the CUSTOMIZE package to implement client customization in a straightforward fashion; one based on cookies and client specific server side includes.

    Cookies, which have been around since at least Netscape 1.3 (but, unfortunately, were never supported by Web Explorer) are special pieces of information that a server tells a browser to send the next time(s) the client visits. By judicious use of cookies, CUSTOMIZE can efficiently match an incoming request to previously chosen preferences.

    Client specific server side includes are, like other server side includes, real time modifications of an HTML document; with the additional feature of reflecting the preferences of the requesting client. Since server side includes can include file replacements and in-line executables, the range of modifications is quite large, and can be achieved with minimal effort.

    Briefly stated, CUSTOMIZE's strategy is:

    1. Create a set of data that contains a client's preferences (this set will be associated with a cookie).
    2. Tell the client's browser to send the appropriate cookie on future requests (perhaps only for a few selected pages on the site)
    3. When such a request occurs, complete with appropriate cookie, match the cookie to the associated set of data, and use this data to modify client specific server side includes contained in the requested document.

    Given that your OS/2 web server...

    then the following four step process will implement this strategy:
    1. Run the configurator: Using the CUSTOMIZE configurator, initialize the default values for a set of client-selectable options, with defaults for those with cookie-deprived browsers (and you can define many different sets for your different needs).
    2. Create a preference selection FORM: Create an HTML FORM to allow your clients to select their preferences -- this form will invoke the MKCUSTCG.CMD cgi-bin script.
    3. Create documents that incorporate client preferences: Using CUSTCGI in server side includes, create documents that incorporate these client preferences.
    4. Tell your public: link 'em to the preference selection FORM.
    5. sit back and watch....

    Installation notes

    Installation of CUSTOMIZE is described in it's READ.ME. Most of the work is done by CUSTOMIZE's installation program (INSTALL.CMD).

    Of particular importance is the initialization of several parameters; including:

    INSTALL will ask & set these paramters. However, if you should need to change them, just edit the MKSUSTCG.CMD and CUSTCGI.CMD files (they should be in the CGI-BIN directory). They are near the top of each file, and are clearly marked. Note that you'll need to change their values in both files.

    Depending on your web server, you might also have use special extensions for HTML documents that contain server side includes (i.e.; .SHTML instead of .HTML). If so, you'll need to change references (in this document) from CUST_CGJ.HTM to CUST_CGJ.whatever (i.e.; CUST_CGJ.SHT).


    Sample of a client customization FORM

    This demonstrates how one can set up a FORM that enables clients to specify customization options. Feel free to adapt this code for your own use!
    Note: this sample assumes you've created a SAMPLE directory under your USERINFO_DIR directory:
    The cookies created by this sample will remain valied for 24 hours, and only apply to requests to the /CUSTOM directory.

    Client customization: select your preferences!

    Welcome to our site's customizer -- you can specify several options that will effect the look and feel of our pages!

    Or would you like to see your current (perhaps default) preferences?

    Optional:Enter a username:, and a password:
    Choose your background color:
    • Light Red
    • Light Green
    • "Light Blue
    • No Background Color

    Greet you by your IP name?        ||        Display the time, or display the URL?

    How to display introduction?

    Enter your own introductory message:

    After you "save your choices", you'll be redirected to a document that is built using these selections
    .


    The CUSTCGI SSI

    CUSTCGI is a script that is meant to be invoked via an #EXEC server side include. In a sense, the CUSTCGI is a "cookie-aware, client specific string replacement".

    CUSTCGI is typically invoked with a server side include (SSI) keyphrase of the form:

                  <!-- #exec cmd="Custcgi?setname.varname" -- >
    for example:
                  <!-- #exec cmd="Custcgi?personal.car" -- >
    
    where setname.varname identifies the client specific variable (i.e.; PERSONAL.CAR) to look for. This client specific variable should contain a string (perhaps a string that contains one of the other SSIs), which will then be inserted into the document.

    The following contains a detailed descripiton of how CUSTCGI finds the value of client specific variables. Beginners looking for a simple example of how CUSTCGI is used should first examine the source code for CUST_CGJ.HTM.

    1. CUSTCGI will parse out setname and varname. In the above example, setname=PERSONAL and varname=CAR.
      If setname is not specified (i.e.; a <!-- #exec cmd="custcgi?varname" --> keyphrase is used) then it is assumed that setname=DEFAULT.
    2. CUSTCGI will look for a cookie with a name of setname. In the above example, CUSTCGI will look for a cookie named PERSONAL.
    3. This cookie, if it exists, should contain a client identifier. For example, if a PERSONAL=JOEFILE1 cookie exists, then the idenfitier equals JOEFILE1.
      If this cookie does not exist, then identifier is set equal to DEFAULT
    4. A ".CC" data file, containing client specific information, is then loaded. The name of this file is constructed using the USERINFO_DIR parameter that you must set in the CUSTCGI.CMD and MKCUSTCG.CMD source code.
      For example:
    5. If USERINFO_DIR=D:\GOSERVE\USERINFO, and
    6. SETNAME=PERSONAL, and
    7. a PERSONAL=JOEFILE1 cookie exist.
    8. Then D:\GOSERVE\USERINFO\PERSONAL\JOEFILE1.CC will be loaded.
    9. However, if there is no PERSONAL cookie, or
    10. D:\GOSERVE\USERINFO\PERSONAL\JOEFILE1.CC does not exist
    11. then D:\GOSERVE\USERINFO\PERSONAL\DEFAULT.CC will be loaded.
    12. Furthermore, if setname was not specified, then
    13. then D:\GOSERVE\USERINFO\DEFAULT.CC will be loaded.
    14. Note that a .CC extension is always assumed.
    15. If one of the files derived in step 4 can be found, CUSTCGI will extract the varname variable from this .CC data file. If no file can be found, an error comment is returned.
    16. The CUSTCGI "keyphrase" is replaced by this value. For example, if D:\GOSERVE\USERINFO\PERSONAL\JOEFILE1.CC contains a:
            CAR=<B>Honda Accord</B>
      varname entry, then Honda Accord will be inserted into the document.


    The MKCUSTCG CGI-BIN script

    As discussed above, CUSTCGI requires special .CC data files. The easiest method of creating such files is through the MKCUSTCG CGI-BIN script. Typically, MKCUSTCG will be invoked by a "tell us your preferences" HTML document filled out by interested clients (such as the above sample). On occasion, as when setting up DEFAULTS, you (the webmaster) will need to invoke MKCUSTCG, often by calling the configurator.

    MKCUSTCG recognizes nine parameters:

    1. SETNAME (required)
    2. IDENTIFIER optional, usually not used)
    3. PASSWORD (optional)
    4. NODELETE (optional)
    5. VAR.varname (required)
    6. RESPONSE (recommended)
    7. EXPIRE (recommended)
    8. PATH (optional)
    9. INIT Superusers only

    Summarizing MKCUSTCG options