In CGI mode, the list of files and directories that can appear in the index is
obtained from an index database file which is generated by the
"mkhtmidb" utility. The index database file, "index.db", must be
located in the current working directory or one of its parents (up to 4 levels down).
The actual list of links that appear in the generated index is determined by the CGI parameters
which define the matching criteria.
The index generated by the "mkhtmidx" utility is sent to stdout
instead of being written to the file "index.htm", and contains the appropriate
content-type header line.
To use CGI mode, you must first copy "mkhtmidx.exe" to the appropriate CGI bin directory used by your web server. Then you must place a configuration file named "mkhtmcgi.ini" in the CGI bin directory. The mkhtmidx utility checks for the existance of the "mkhtmcgi.ini" file whenever it runs, and enables CGI mode if it finds the file in the same directory as "mkhtmidx.exe".
The "mkhtmcgi.ini" file should contain the CGI Mode Options, and any other options necessary to set the CGI configuration.
config |
Configuration name (see CGI Configuration File below) |
|---|---|
query |
Query search expression |
type |
Type of links. The value can be either a (all, default), d (directories only), or f (files only) |
id |
Cache identifier. This string (up to 31 characters) is required to enable the search results cache. |
first |
Offset from the first match to use as the first element in the index (default = 0 = first match) |
count |
Number of links (maximum) to include on each page of the index (default = unlimited) |
The CGI configuration file may contain multiple sections, each with a unique title enclosed in square brackets, as shown in the following example:
indexDB=index.db
startDir=C:\pictures
startURL=/pictures
workingDir=C:\pictures\Search
backLink=/pictures/Search/index.htm
index=formatted
slides=window
links=standard
configFile=makeindx.bat
embed=avi
embed=mov
embed=mpg
embed=mpeg
embed=rm
reservedFile=bigthumb.jpg
[list]
format=list
thumbnails=no
[thumb1]
format=compact
[thumb0]
layout=thumbnail
[bigthumb1]
thumbFile=bigthumb.jpg
format=<CENTER><?A>${thumb attrib="BORDER=0"}</A><BR>{{<B>${title}</B>}<?BR>
{<SMALL>[${info}]</SMALL>}}<BR> </CENTER>
columns=4
body=BGCOLOR=WHITE
indexDB=btindex.db
[bigthumb0]
workingDir=C:\pictures\cgi-bin
layout=thumbnail
format=<?A>${thumb attrib="BORDER=0"}</A>
thumbFile=bigthumb.jpg
columns=4
body=BGCOLOR=WHITE
indexDB=btindex.db
Each section begins with a line that contains a title in square brackets, and ends with the title of the next section (or the end of the file). There may be an unnamed section at the beginning (with no section title) which contains options that are common to all sections.
When the configuration file is read, any unnamed section at the beginning is read first. Then a named section is read based on the title specified in the "config" parameter of the CGI request. If no "config" parameter is specified or if a section with the specified name does not exist, a named section will not be read. Named sections may contain options that override options in the unnamed section at the beginning.
The cache will be used if all of the following conditions are met:
document.form.id.value = (new Date()).getTime();This code should be executed when the form is submitted. It uses the current time to supply a different "id" each time the form is submitted.
To stop it, press Ctrl/C or Ctrl/Break in the MS-DOS Prompt window.
This web server has the minimum functionality required to use mkhtmidx in CGI mode. It does not implement most of the features of a standard web server. For a complete description of this server, type "cgiserver /?" at the command line.
Warning: This web server allows access to any file on the drive that it is run from. It also allows any program to be executed on that drive. Because of that security risk, it is recommended that the /L option be used unless remote client access is explicitly desired. The /L option restricts access to the local computer only, and does not allow remote clients to access files via the web server. If you want to access files from remote clients, it is recommended that you used a different web server such as Apache.