Setting Up a Sign-up Server

An Internet Sign-up Server (ISS) is a Hypertext Transfer Protocol (HTTP) server that automates the task of adding new customers to an Internet service providerÆs (ISP) customer database. The ISS collects information from each new customer, adds the information to the ISPÆs customer database, and then passes a configuration packet back to the customerÆs desktop computer. The configuration packet contains information that is used to configure the customerÆs Internet browser for subsequent connection to the ISPÆs services.

This document provides information that an experienced Internet server administrator can use to implement an ISS. It assumes that you are already familiar with HTTP, Hypertext Markup Language (HTML), and Common Gateway Interface (CGI) processing. If you are not familiar with these components, click HTTP and CGI to access information about official HTTP specifications and Common Gateway Interface (CGI) specifications.

The ISS adds a new customer to the ISPÆs database in three steps:

  1. Establishes an HTTP connection with a customerÆs desktop computer.
  2. Collects sign-up information from the customer.
  3. Handles the customerÆs acceptance or refusal of the ISPÆs services.

Establishing a Connection with a CustomerÆs Computer

A potential customer opens a sign-up program that starts Internet Explorer, dials the ISS, and posts an initial CGI request. The ISS:

HTTP is a session-less protocol; however, the ISS operates in a session-oriented mode, using the session handle to identify all transactions associated with the sign-up process for a particular customer. For example, the session handle could be an automatically generated sequence number, assigned to this transaction by your database system.

Preparing the Server

If you are using Microsoft Internet Information Server 3.0 (IIS), carry out the steps below to copy all files in this ISS Server folder to the InetSrv folder on the IIS system. If you are not using IIS, see Understanding the Server Folder Components for details about where to place the components.

Step 1: Installing the server

  1. Install Microsoft Windows NT 4.0 and include the TCP/IP and Microsoft Internet Information Server 3.0 options. For additional information on installing Windows NT 4.0, see the Windows NT Server Resource Kit.
  2. Install Remote Access Service (RAS). You can use Dynamic Host Configuration Protocol (DHCP) to assign IP addresses automatically or set up a range of static IP addresses. You must enable user accounts for dial-up and setup RAS to receive calls.
  3. When installing RAS, you must enable user accounts for dial-up and to receive calls.
  4. If you used the default setup for IIS, use the following command line to copy the files and directories for your custom browser to the following sub-folders located in the Inetpub directory:

    To the WWWRoot sub-directory: xcopy:\server\eng\isp_file\server\wwwroot /s/e

    If you are using the sample sign-up server without modifying signup.exe, you must use the default directory structure for IIS. If you have a different directory structure, you will see the following CGI error after you submit the final request to create the .ins file in the insfiles directory in WWWRoot:

    "The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:"

    The error occurs because the CGI application source code has hard coded directory paths and if the code is not modified, then it requires the default directory structure for IIS.

    To the Scripts sub-directory: xcopy:\server\eng\isp_file\server\scripts /s/e

Note: If you drag and drop files from the CD-ROM to the directories referenced above, make sure no files are hidden. To show hidden files, on the View menu, click Options, and then click Show All Files. All files must be moved for the script to work properly.

To modify options

  1. If the guest account is used for dial-up access, then it must be enabled and have the same password as the one specified in the .ins file. It is easiest to not specify any password.
  2. Change the properties of the Scripts directory to allow read and execute.
  3. If there is no type of name resolution available when users dial up, then they must use the IP address to access the IIS Server.
  4. Use the following URL to access the beginning Web page:
    HTTP://server name/scripts/template/home.htm

To create a guest account

  1. Start the User Manager utility and use it to set the default Guest account password to None (that is, no password).
  2. Start the Remote Access Administrator utility.
  3. On the Users menu, click Permissions, and then enable the Guest account for dial-in permission.

To modify the acc2.ins file

The following entries are generally required for all users, and must be added manually to the .ins file. Be sure to review these entries carefully, because no error checking is provided.

Note: There can be cases where these entries will vary by user, typically when different users are serviced by different networks.

Section Entry Comment
[Entry] Entry_Name May vary for private label customization
[Server] All entries  
[TCP/IP] All entries  
[Custom] All entries Not required
[Custom_File] All entries Not required
[Scripting] All entries Not required
[Script_File] All entries Not required

The following entries are user-specific, and must be added to the .ins file (except for the Internet Mail and News entries, which are necessary only if Internet Mail and News features are provided by the service). The mechanism for placing these entries dynamically in the file varies based on the services available on your server. Usually, user input is required at sign-up. Most servers support some macro mechanism associated with CGI that makes the process easy.

Section Entry Comment
[Phone] All entries  
[User] All entries  
[Internet_Mail] Email_Name  
.  Email_Address  
.  POP_Logon_Name  
.  POP_Logon_Password  
[Internet_News] NNTP_Logon_Name  
.  NNTP_Logon_Password  

For Windows 3.1, all Internet Mail and News entries must be set or none of the settings will be used.

If users are assigned to different servers, the following entries need to be changed to replace the information entered into the wizard.

Section Entry Comment
[Internet_Mail] POP_Server  
.  SMTP_Server  
.  Domain  
[Internet_News] NNTP_Server  

Collecting Customer Information

Collecting sign-up information from the customer involves creating a sequence of HTML pages and uploading them, on demand, from the ISS to the HTTP client. The sequence of pages walks the user through the sign-up process, much like a wizard in a Windows-based program. Although the content and format of the pages are entirely up to you, each page typically includes:

  • A form for the customer to fill out.
  • Navigation buttons that enables the customer advance to the next page in the sequence or go back to the previous page.
  • A button that enables the customer cancel the sign-up session.
The last page contains an additional button that enables the user to submit the completed sign-up application to the ISS.

To create customer sign-up pages

  1. Using Notepad or Frontpage, open home.htm located in the reskit\isp\server\scripts\templates folder to see a sample sign-up page.
  2. On the View menu, click Source.
  3. Edit the information as needed.
  4. On the File menu, click Save. The file must be saved in the same directory in which it was originally located.

    Note: In addition to providing a link to your sign-up server information, you will need to provide a link that enables users who already have Internet accounts to access your custom browser.

Using HTML Forms and CGI Processing

Creating a wizard-like interface in HTML pages requires that you use HTML forms and CGI processing. Each form gathers information from the user and uses the GET method to pass the information to the CGI processor whenever the user clicks a navigation button. Typically, each HTML page includes a form that contains the following controls:

  • A set of input text controls for collecting customer information.
  • Next and Back navigation buttons (input submit controls).
  • A hidden input control for each navigation button. The hidden controls specify the names of the next and previous HTML pages in the sequence.
  • A hidden input control that contains the session handle.
Data from a form is posted to the CGI processor whenever the user clicks one of the formÆs navigation buttons, and the CGI processor accumulates the data in its own database. You have the option of validating the data and posting an edit page to the HTTP client if the data is not acceptable. You also have the option of storing the data in your own database as the CGI processor receives the data, or waiting until the entire sign-up session is completed.

After recording the data, the CGI processor determines which button control initiated the posting and uses that information to construct the next HTML page to upload to the customerÆs desktop computer. The CGI processor dynamically constructs the next page from an HTML template that contains variable tokens. When the processor parses a variable token such as a $SessionHandle token, it replaces the token in the HTML stream with the appropriate variable value. Finally, the processor writes the dynamically created HTML file to the HTTP client by means of the standard output stream.

Using dynamic HTML provides the ability to pre-load the form controls with data. This enables the customer to navigate backward and forward through the HTML pages to review or edit previously entered data.

Session Handle

The CGI processor uses a unique session handle to identify all transactions belonging to a particular sign-up session. The processor embeds the session handle as a hidden control in the HTML forms that it uploads to the HTTP client. The client returns the handle with each form that it posts back to the CGI processor.

Idle Timeout

Because HTTP is a session-less protocol, the only way the ISS can determine if a sign-up session has been abandoned is by means of an external watchdog process. When the sign-up session is initiated, the ISS creates a time stamp and registers it in the sign-up database. The watchdog process scans the database periodically and determines if a session has exceeded the nominal time allocated for signing up. If so, the watchdog process assumes that the session has timed out and aborts this sign-up transaction.

Sample Form

Click smplform.txt to see a sample form for collecting a customerÆs name and address.

Concluding the Sign-up Session

The customer sign-up session is concluded when the customer either accepts or declines the sign-up agreement by clicking the appropriate button control on the final ISS HTML page.

If the customer accepts the sign-up agreement, the ISS builds an Internet sign-up (.ins) file that contains information about the customer and the ISP, and redirects the HTTP client to this .ins file. A Multipurpose Internet Mail Extensions (MIME) type of "application/Internet-sign-up" has been created for this file. This MIME type is associated with the configuration program on the HTTP client. When it receives data from the .ins file, the HTTP client sends the data stream to the configuration program, which continues with the sign-up procedure. This is the official handoff of responsibility from the ISS back to the HTTP client.

If the customer declines or quits the sign-up agreement, the ISS redirects the HTTP client to an "Abort" .ins file that contains only a "Status=Abort" key. As in the acceptance sequence, this is the end of the ISSÆs responsibility.

In both of these conclusions, the ISP database must be informed of the result of the final decision. While processing the final CGI request, during which time the Accept or Cancel .ins file is created, you should perform any required database processing needed for handling the conclusion of the sign-up transaction. In the sample sign-up CGI code, for example, the transaction state is set to either "Accepted" or "Canceled." This is the strategic section of code that is provided in this kit; you must adapt this code to your specific database environment.

Understanding the Server Folder Components

This section describes the components distributed in the Server folder of the ISS kit. If you are not running Microsoft IIS, or would prefer a different folder structure, review the following notes.

Enabling the DHCP Server

The client is configured for DHCP. You must configure the ISS to provide a DHCP IP address to the client when the client connects to the server. Because the sign-up process is relatively short, the expiration time for the IP address lease can be small, possibly only a few minutes. Because the sign-up processing is intended to be used over a point-to-point dial-up connection, the IP addresses allocated for the DHCP server need not be formally assigned IP addresses. It is your responsibility to determine whether the DHCP IP addresses will be truly valid Internet addresses or arbitrary addresses.

Adding the .ins File MIME Type

For the client to process the .ins file automatically, you must register a MIME type for the .ins file with the ISS. This MIME type has been designated "application/x-Internet-signup." When the client requests an .ins file, the ISS responds with this MIME type, which starts the associated installation application on the client side.

Microsoft IIS-Specific Configuration Notes

This version of the sample ISS was tested on IIS. The following topics discuss installation notes specific to the IIS, as of this version.

Adding the .ins file MIME Type

You must manually edit MIME types in the registry. To add the .ins file MIME type, use Regedt32.exe to add the following information: Under this key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\InetInfo\Parameters\MimeMap Add this value: application/x-internet-signup,ins,,5:REG_SZ: This value does not have a string associated with it. For more details about setting MIME types, you can also refer to the IIS Help documentation.

Note: To cause these registry settings to take effect, it is necessary to shut down all IIS services after adding the new MIME type. It is not sufficient to simply stop and restart the Web publishing service. (In practice, the FTP and Gopher services are not likely to be running in the ISS configuration.)

The Sign-up CGI Source Code

The CGI source code is written in standard C and uses a simple Windows initialization-format file for its database. You should immediately modify two sections of the source file:

  • The data keyword table
  • The database interface functions
These sections are identified as the "ISP Customization Section" in the source code comments.
Data Keyword Table

The elements in the data keyword table are used in two ways:

  • To retrieve data entered by the sign-up CGI request. Each input control in the sign-up form is associated with a unique data name that must have a corresponding entry in the data keyword table. When the CGI request transmits the values for the inputs for each form, the CGI processor uses the data keyword table to look up and store each data value in the database as it is identified.
  • To locate and replace data tokens in the HTML templates for transmission back to the HTTP client. This retains the previously entered data when you are navigating from form to form. As a template is prepared for transmission back to the HTTP client, it is scanned for tokens that correspond to any entry in the data keyword table. When a match is found, the current value for that data item is retrieved from the database and substituted in the HTML.
Database Interface Functions

There are two groups of database interface functions:

  • Transaction management functions consist of transaction start (BeginTransaction), transaction end (AcceptTransaction), and transaction abort (CancelTransaction).

    The transaction start function creates a unique session handle that identifies a given sign-up client throughout the remainder of the sign-up process. As mentioned earlier, this session handle may be a simple sequence number (as demonstrated in the example CGI code) or a transaction identifier generated by your database system. The specific value of the session handle is not important, as long as it is unique and you can use it to track the sign-up transaction.

    You use the transaction end function to handle your own database transaction conclusion processing. In the example CGI code, a state flag is set to indicate that the transaction was accepted.
    The transaction abort function serves the same purpose as the transaction end function, with you taking the appropriate action to handle the sign-up cancellation.

  • Database I/O functions╛for the example, CGI code╛are simple read (DBRead) and write (DBWrite) functions. The read function returns a value for a requested data item. The write function stores the value for a given data item.

Data Validation

In addition to the previous CGI code modifications, you may want to validate data for each CGI posting, or wait until the conclusion of the transaction to validate the data entered by the sign-up client. The example CGI code demonstrates the method for validating each CGI posting. If data validation fails in the FormtoDB function, the current HTML template is regenerated and sent back to the HTTP client again. You may want to modify this function (ProcessCurrent) to include an advisory message indicating the data validation error.

Building the CGI Processing Code

The example sign-up CGI processing code was compiled by using Microsoft Visual C++╥ version 4.1. A project file, Signup.mdb, is included with this kit for rebuilding the CGI processing executable file as needed. Because the database was implemented using the Windows initialization file functions, the source code includes the Windows.h file. Other areas of source code might need to be modified slightly if your HTTP server is not running on a Microsoft Windows platform. However, for the most part, the sample code is quite portable.

Security and Session Handles

The example sign-up CGI processing code was compiled with simple sequentially generated session handles. In any public implementation, these session handles must be generated using a random handle generator. The use of random handles eliminates the possibility of a user guessing the handle of another user (which is very easy with sequential handles).