
Server Self-Test & Demonstration
CGI Usage
15-September-97
An important part of runing a Web server is getting
information from users and manipulating via the Common
Gateway Interface (CGI). WebSite Pro's CGI features
let you use external programs to process HTML forms,
generate documents, and do other processing in response
to a request from the browser.
Using CGI Programs:
Sample Order-Entry Application (VB5 Runtime Required)
This example uses Windows CGI and a form to provide an
order-entry service.
The external forms-processing program pizza32.exe
is a Visual Basic 5.0 (32-bit) application, compiled into an executable.
The same program generates the form as well as processing
its results. Note that the form has the current time on it.
NOTE: This example is an excellent reference
implementation for forms applications. If you are interested in
developing forms-based applications, please take the time to read the
VB code in pizza32.bas
.
Forms must be processed by a server-side program. One of the difficulties
encountered in developing programs for forms is decoding the form
data. The browser sends this data in a special form
called URL-encoded. If you use the
Windows CGI interface,
the server will decode all forms data for you. Furthermore, the
Visual Basic template application contains a module that handles reading
the decoded form information into VB globals, then calls your module
to do the actual processing. This approach is a major time (and frustration)
saver and is a feature available only on WebSite
servers.
Sample search form
Here is a simple form that uses a VB CGI program.
Fill in the field and select an option, then click the Search button.
The demo back end simply reports
what would ordinarily be submitted to the database search engine.
The Search On field supports multiple selections (may not be supported
by your browser). Try it and see
how the server handles decoding it.
Database Integration with VB5 and Access
95
This sample requires the Microsoft DAO 3.5 Object
Library (dao350.dll) which is included with Visual Basic
Professional 5.0 and various other data access
applications.
This sample shows many useful techniques
for using VB5 with Access (and any ODBC) databases. We suggest you
read through the Introduction, which has links
to browser-visible VB source code and Access design screens, as
well as a live sample you can play with. If the live sample runs, then
your VB and Access installations are OK.
Study this thoroughly if you plan to use VB and Access for
database work. The sample is covered in detail in Chapter 7
of
Creating Dynamic Content.
Server-Push Animation (NT ONLY)
Try it now (NT only; server-push capable
browsers required)
WebSite Pro's
Standard CGI interface
supports a special non-spooled mode
for doing live animations, also known as server-push.
This page shows a demonstration.
. Most versions of Netscape do handle this.)
Note: Windows 95's TCP package cannot pass sockets to children;
therefore, server-push does not work on Windows 95.
Form-Based File Uploading
Try it now (upload-capable browser required)
WebSite Pro supports the new RFC-1867 form-based file uploading and
multipart/form-data formats. Windows CGI decodes this new form data
for you transparently. The uploader CGI program is one of
the samples included with WebSite Pro. As shipped, files are uploaded into
a directory with an access-controlled URL mapped to it. The upload area
should never be accessible to anyone with a browser.
WARNING: BE CERTAIN TO READ AND UNDERSTAND THE CAUTIONS IN THE
UPLOADER.BAS MODULE BEFORE MODIFYING THE UPLOADER OR CHANGING THE
ACCESS CONTROL ON THE /UPLOADS/ URL.
You've now successfully completed the server self-test!
If you got this far without problems, you've done a thorough
checkout of your server's setup. Congratulations.
website-support@ora.com