Previous Next Up FAQ Table of Contents

5.7 Member Database Support

Note: This feature is available only with VolanoChatPro.

The database support allows you to integrate the information in an existing or new member database with one or more VolanoChatPro servers in the following ways:

The database need not reside on the same machine as the VolanoChatPro server. It can provide a central directory for several VolanoChatPro servers, as shown in the figure below.

Centralized member database

Figure 1: Centralized member database.

Database scripts

Locations

You provide the information from your database to the VolanoChat server through three simple CGI scripts. The scripts are invoked by a Uniform Resource Locator (URL) you define to the VolanoChatPro server. The scripts can be implemented in any language and architecture supported by your Web server and your database. You can even write the scripts in Java as a Java servlet and add them to VolanoChat's built-in servlet runner. The three scripts, and the names of the properties that define their locations, are:

member.access
to obtain member access based on a member name and password,
member.name
to check whether a name is already taken by a member, and
member.document
to display a member's profile Web page.

Both member.access and member.name are VolanoChat server properties (defined in conf/properties.txt), while member.document is a VolanoChat applet property (defined in webapps/ROOT/vcclient/english.txt and others).

Responses

The member.version server property value determines the format of the access and name script responses. If the version property is set to 2.1, the CGI script returns up to three lines of text in a format shown below. Any other value (including no value) indicates the scripts return the older version 2.0 XML format, described in earlier versions of this documentation.

Note: Each line returned by the script must end with a newline character ("\n"), including the last line.

Any new scripts you write and deploy should use the newer version 2.1 format:

member.version=2.1

Samples

The following sample CGI scripts are available for your modification.

Note: These samples may help give you a start in writing your own membership scripts, but they are not part of the VolanoChatPro product and are provided without support.
phpmember.zip
a Zip file containing sample scripts written in PHP and using the built-in functions for accessing a MySQL relational database.

General notes

Make sure to set the content type of the server script responses to plain text by adding the following header to your member.access and member.name script responses:

Content-type: text/plain

Don't forget to end each line returned by the access and name scripts with a newline character ("\n"), including the last line. Note that it is the responsibility of the member access, name, and document scripts to decide whether things such as upper and lower case of member names is important.

Member access

The member access script is invoked when members enter their name and password into the member interface of the VolanoChat or WebVolanoChat applet. It is invoked as a normal HTTP GET request, and its response determines whether the VolanoChatPro server grants access to the member.

The access script is defined by the URL you specify with the member.access server property. The VolanoChatPro server substitutes the variables in the URL with the member name and password given by the visitor to the applet. For example, you might define a script with a format as follows:

member.access=http://www.volano.com/member/access?name={0}&password={1}

The VolanoChatPro server fills in this URL template as follows:

When the member.version property is set equal to 2.1, the member access script returns from zero to three lines of text of the form:

true|false|error
Profile text or error message.
true|false

The first line returns true if the name and password are correct, false if the name and password are not correct, and error if an error occurred accessing the database. The second line returns the member's profile string or an optional error message. The third line returns true if the member has a Web page for access through the member.document script or false if no link should be displayed for a member Web page.

If no content is returned in the response, the default response is assumed to be the single line:

false

If the member name and password are valid and the member has a Web page, the access script returns a result of true, the optional member profile string, and true for the Web page link. For example:

true
This is the member's profile.
true

If the member name is not found or the password is not valid, the access script returns a result of false. For example:

false

If an error occurs processing the request, the access script returns a result of error along with an optional descriptive error message. For example:

error
Unable to connect to database.

Member name

The member name script is invoked each time someone enters a chat room. It is invoked as a normal HTTP GET request, and its response determines whether the visitor may enter the chat room with the chosen name. This script implements name reservation for your members.

The access script is defined by the URL you specify with the member.name server property. The VolanoChatPro server substitutes the variable in the URL with the nickname given by the visitor to the applet. For example, you might define a script with a format as follows:

member.name=http://www.volano.com/member/name?name={0}

The VolanoChatPro server fills in this URL template as follows:

When the member.version property is set equal to 2.1, the member name script returns from zero to two lines of text of the form:

true|false|error
Optional error message.

If the nickname is taken by a member, the name script returns a result of true. For example:

true

If the nickname is not taken by a member, the name script returns a result of false. For example:

false

If an error occurs processing the request, the name script returns a result of error along with an optional descriptive error message. For example:

error
Unable to connect to database.

Member document

The member document script is invoked when a visitor clicks the member profile link, which may be prefixed to each member's profile in the chat rooms. It is invoked as a normal HTTP GET request and returns the Web page associated with the member.

The document script is defined by the URL you specify with the member.document applet property. The applet substitutes the variables in the URL with the member name and the nickname of the person requesting the page, if available. For example, you might define a script with a format as follows:

member.document=http://www.volano.com/member/document?for=%0&by=%1

Note that the server-side member.access and member.name properties use the Java version 1.1 notation of {n} for substitution variables, while this client-side member.document applet property uses the Java version 1.0.2 notation of %n for the variable.

The VolanoChat applets fill in this URL template as follows:

The requestor's nickname is available if the requestor is a member, or if the requestor is not a member but is clicking the link from within a chat room. The nickname is unavailable if the requestor is not a member and is clicking the link from the main VolanoChat window outside any chat room. Members will always have their name filled in the %1 variable, whether they've entered a room or not.


Previous Next Up FAQ XHTML 1.0 Table of Contents

2014-07-11 — An updated version of the VOLANO chat server that supports the latest Java 8 Plug-in is now available. More…

The VOLANO® chat software for the Java™ platform lets you build on-line communities and add real-time social networking to your Web site. More…

John Neffenger <john@status6.com>
More…

A PROJECT OF STATUS:6®