| contents | queries | |
| configuration | templates | |
| expressions | sessions | |
| databases | data entry | |
| passwords | ||
| license | support |
baserunner configuration file
Application configuration file
Command line and form variables
Actions
Security
Cookies
Creating a baserunner application requires several elements: database(s), configuration files, and HTML templates. In constructing an application, baserunner places very little restriction on you pass information to baserunner. baserunner requires that specific variables be available to properly parse the templates processes and sends to the user. These variables are passed to baserunner through configuration files, through the command line, through HTML forms, or through cookies: baserunner is very flexible in terms of how the necessary variables are passed.
All variables passed to baserunner, unless they refer directly to a database field, are prefixed with an underscore "_".
The first call to baserunner will specify the name of the application configuration file through the _cfg variable. When baserunner processes a call that contains a _cfg variable, it starts a new user session.
All subsequent calls to baserunner must include the name of the user's session (generated by the first call the the program) through the _ses variable. The _ses variable always is given a value of {session}, which is replaced by baserunner with the unique name assigned to the current user's session..
Beyond those two rules, baserunner permits you a great deal of latitude in constructing calls to the program within your templates.
A baserunner application requires two configuration files. These files will contain many of the variables baserunner needs to run. Once baserunner is started, the variables from the configuration files are treated no differently than variables passed on the command line or through a form. The configuration files are standard ASCII text files. Each variable name must begin with an underscore ("_"), formatted _variable=value. Any configuration file variable not beginning with an underscore will be ignored. Text files are formatted differently under DOS and Unix; however, baserunner will handle DOS formatted configuration files under Linux.
Under Linux configuration files must end with a blank line.
Under Windows lines in a configuration file are limited to 254 characters.
Variables that may be included in the application configuration file may also be passed to baserunner via the command line or a form variable. Generally, variables that will not change while the application is running should be placed in the configuration file. Even if a variable is included in the application configuration file, it may be overridden by a variable of the same name passed from the command line or a form. Variables contained in the baserunner configuration file cannot be overridden.
baserunner sees treats all variables the same way, whether submitted through a form, sent on the command line or included in a configuration file. The priority baserunner gives to variables is:
- baserun.cfg.
- the command line (GET).
- form variables (POST).
- http cookie information.
- the application configuration file.
Variables with higher priority will override variables with lower priority: e.g. a _dbf variable passed on the command line will take precedence over a _dbf variable included in the application configuration file. There are several variable types:
| Value | Description |
|---|---|
| Path | Variables that take a path must include a trailing backslash, "\" or "/", depending on the file system. |
| File name | Variables that take file names as a value normally require only the name of the file (including the extension). If you do not use a path variable in the baserun.cfg file, you will need to include the entire path to the file in the value. You may also specify another variable name that contains the file name and, if necessary, the path to the file. |
| Text | Text variables require a text string as a value. Some variables that require a file name may also be set to text--for instance, if one of the _fail variables is set to a text string rather than a file name, if the action fails, the text will be sent to the user rather than the template. |
| Integer | Integer variables contain a number. |
| Expression | Expression variables contain a valid xBase expression. The type of expression depends on the particular variable. If expression values are passed on the command line (most often with a _fil variable), they should be URL encoded. This may be accomplished by enclosing the expression within the <%. . .%> delimiters, which instruct baserunner to URL encode the text they contain. |
| Field name | Field name variables take the name of a field in the current database as a value. |
| Logical | Logical variables may have any value, but they must contain a value--If they exist, they are true. Logical values cannot be overridden. |
The first configuration file is available to all baserunner applications; it is named baserun.cfg. (Note: The name of this file is actually the same as the name of the baserunner executable file. So, if you rename baserun.exe, say, database.exe, the name of this configuration file is database.cfg). This file must be located in the in the default directory for the executable, normally cgi-bin, but depending on the server configuration it could be the web root directory. Using this file is optional, but strongly recommended--see the note under Security, below. baserun.cfg may contain any variables that will be available to all your baserunner applications. Variables contained in this file cannot be overridden by variables sent through a form or on the command line.
| Variable | Value | Description |
|---|---|---|
| _expired | Text | The value associated with this variable is the string that baserunner will send to a user if his session has expired. If this variable is not set, the default message is "Session Expired." |
| _sessionpath | Path | The value of the _sessionpath variable is the path to the directory that will contain the session database. |
| _configpath | Path | The value of the _configpath variable is the path to the directory that will contain the application configuration files. |
| _datapath | Path | The value of the _datapath variable is the path to the directory that will contain the application's database file(s). |
| _templatepath | Path | The value of the _templatepath variable is the path to the directory that will contain the application's template files. You should always use a _templatepath variable, contained in the baserun.cfg file with baserunner. |
| _sessionpath=c:\inetpub\my
directory\sessions\ _configpath=c:\inetpub\my directory\configs\ _datapath=c:\inetpub\my directory\database\ _templatepath=c:\inetpub\my directory\html\ _expired=Your baserunner session has expired! |
_sessionpath=/home/mydir/www/cgi-bin/sessions/
_configpath=/home/mydir/www/cgi-bin/configs/
_datapath=/home/mydir/www/cgi-bin/database/
_templatepath=/home/mydir/www/cgi-bin/html/
_expired=Your baserunner session has expired!
Note: All the paths in baserun.cfg must end with a trailing "\" or "/" depending on the file system. These paths are the physical paths to the files, not the virtual paths you would use in a URL. Long directory names and file names are acceptable. If you do not include the path variables, You must specify the full path to the files in the application configuration file or from the command line. You may include other variables in baserun.cfg as well. Because of its having the highest priority, variables in baserun.cfg cannot be overridden. All baserunner applications should make use of the path variables in this configuration file.
Application configuration files determine most of the basic behavior of a baserunner application. Unlike baserun.cfg, you may give this file any name (and extension) you wish. There is no limit on the number of configurations you can use with baserunner. The format of the application configuration file is the same as that of baserun.cfg.
An application configuration file is required for each baserunner application. Any variable that you want your application to treat as a default should be placed in the application configuration file. Some variables are only passed to baserunner from a form or from the command line. The variables that are normally or always contained in the application configuration file are shown in the table below. Variable names in boldface may have any name (as long as it does not conflict with another variable name).
CFG = May be included in the application configuration
file.
CL=May be included on the command line or as a form variable.
| Variable | Value | Description | CFG | CL |
|---|---|---|---|---|
| _dbf | File name | In the application configuration file, this variable will set the default database that the application will use. The value assigned to this variable is the name of the database baserunner should use, if necessary, including the path. A _dbf variable is | X | X |
| _defhtml | File name Variable |
The variable specifies the first HTML template that baserunner opens and parses when the program is first invoked. The value of this variable may be a file name, including a path, if necessary, or it may refer to a target variable that points to a template file. | X | |
| _positionfail | File name Text Variable |
The value of this variable may either be a string or point to a template file (either a file name or a target variable). The sting or template will be sent to the user if baserunner is unable to position the record pointer to a valid record: most often the cause will be that no records are found in response to a user query. | X | X |
| _minutes | Integer | This value of this variable (an integer) sets the length of the users session. If this variable is not included, the default length of a user session is 10 minutes. | X | |
| _display | Integer | Used in the application configuration file, the value of this variable, an integer, specifies the default number of records to show when the <!--repeat--> directive is used. | X | X |
| _deffilter | Expression | A filter that will always be in effect for the database. This filter is in effect even if the user enters a new querythe default is appended to it. This can be used to hide certain records (e.g. deleted records, or records that do not have an "approved" flag set). The variable must be a standard xBase expression. The major disadvantage to using this variable is that the database is always filtered--rendering the block directives <!--filter--> and <!--nofilter--> useless. | X | |
| _defpassword | Text | A password that will override any user password contained in a database. See Password. | X | |
| _passfield | Field name | A field name that contains a user password. See Password. | X | |
| _dateformat | Text | The format the program should use to display dates. This variable contains the characters M for month, D for day, Y for year, and C for century along with any other character literals you choose, e.g. MM/DD/CCYY or DD.MM.CCYY. To assure that your database will handle dates after 2000, it is good practice to require the century in the year. | X | X |
| _entrypass _entryfail _editpass _editfail _passwordpass _passwordfail _deletepass _deletefail _mailpass _mailfail |
File name Text Variable |
These variable pairs should be included if any of the associated actions are used. Each of these actions may either succeed or fail. If the action succeeds, the template or string in the _*pass variable will be sent to the user; otherwise, the template or sting in the _*fail variable will be sent. Specifying a _tar variable in the command line or form will override these values and the template in _tar will always be sent. | X | X |
| _target_variable | Text | A named variable may be added to the cfg file and used in place of the target in the command line. This option is most useful if you need a long path name for your template files, e.g., _querytarget=c:\some\directory\q.htm. Using the baserun.cfg file makes target variables unnecessary in most cases. | X | |
| _menu_variable | Expression | A named variable may be added to the configuration file and used as the value of a menu item when using the _fil variable. This variable is useful when you don't wish to go through the trouble of URL encoding a value that includes "<" or ">" or if the expression that the item will use is long and you would prefer not to include it in the template. | X | |
| _list_name | Expression | This named variable has the same name as a list, prefixed with an underscore. The value, an expression, sets a sort order for the list. | X | X |
| _unique_list_name | Expression | This named variable has the same name as a unique list, prefixed with an underscore. The value, an expression, determines how each unique value is determined and sets the sort order for the list. This variable is required for each unique list. | X | X |
| _variable | Text Expression |
You may add any variable you wish. The name must begin with an underscore. Such variables are useful for passing information from one template to another (such as field values from another database) or for inserting recurring text into the template. A named variable can also be used to set the value a a conditional display directive. | X | X |
| _hidedeleted | Logical | If this variable is included in the configuration file, all records marked for deletion will be hidden. The value of this variable is irrelevant, so long as it has a value. Using this variable will not set the filtered flag within baserunner. | X | X |
| _memolength | Integer | This variable takes an integer as its value. The value determines the number of bytes of a memo field that will be displayed. The default value is 1024. Any memo field longer than _memolength will be truncated. When a memo field is queried, only the number of bytes specified in this variable will be searched for a match. | X | X |
| _showtime | Text | This variable takes a string as its value. If this variable exists, each page baserunner generates will show the elapsed time in seconds (format 0.000) that baserunner used to generate the page. The time will be appended to the string used as the value: e.g. if the value is Elapsed time:, the baserunner could output Elapsed time: 0.089 at the end of the page. | X | X |
| _translatehtml | Logical | If this variable exists, all output will be processed to replace any high-bit characters with their HTML equivalents. This should eliminate any problems using most non-English, European languages with baserunner. | X | |
| _stripreturns | Logical Text |
See Entry & editing | X | X |
| _striphtml | Logical | See Entry & editing | X | X |
| _modhtml | Logical | See Entry & editing | X | X |
| _nodelete | Logical | This variable, if included, will cause the delete action to always fail. | X | |
| _noedit | Logical | This variable, if included, will cause the edit action to always fail. | X | |
| _noentry | Logical | This variable, if included, will cause the entry action to always fail. | X | |
| _nodebug | Logical | This variable, if included, will prevent the debug action from sending its results to the user. | X | |
| _nocache | Logical | This variable, if included, will effectively turn off baserunner internal caching mechanism for lists, unique lists, and totals. | X | |
| _nodebug | Logical | This variable, if included, will prevent the debug action from sending its results to the user. | X | |
| _nopack | Logical | This variable, if included, will prevent the pack action from working. You should generally include this variable in all baserunner applications and allow packing only through an administrative application. | X | |
| _mailhost | Text | This variable sets the name of the SMTP mail host or the path to sendmail. See Mail configuration. | X | X |
| _mailto | Text | This variable sets the address(es) to which to send an e-mail message. See Mail configuration | X | X |
| _mailcc | Text | This variable sets the address(es) to which to send an e-mail message as carbon copies. See Mail configuration | X | X |
| _mailbcc | Text | This variable sets the address(es) to which to send an e-mail message as blind carbon copies. See Mail configuration | X | X |
| _mailfrom | Text | This variable sets the default return address for an e-mail message. See Mail configuration | X | X |
| _mailsubject | Text | This variable sets the subject line of an e-mail message. See Mail configuration | X | X |
| _mailtarget | File name | This variable take a template name as a value. This template is used to construct the message that will be sent when the mail action is used. See Mail configuration | X | X |
| _mailonentry | File name | This variable takes a template name as a value. If included, an email message will be sent each time a record is entered, using the template specified. See Mail configuration | X | X |
| _mailonedit | File name | This variable takes a template name as a value. If included, an email message will be sent each time a record is edited, using the template specified. See Mail configuration | X | X |
| _use_iis_sort | Logical | Under Windows NT with the Microsoft IIS server, baserunner uses different record positioning code when sorting is in effect, since the standard code used to set record positioning does not work. baserunner automatically determines whether IIS is the server. Other Windows servers work with the normal record position code. However, since there are many servers out there and baserunner has not tested all of them, you may need to use the IIS code for some other Windows servers. You can test this by setting a _sortorder variable on your database and attempting to use the "back" navigation action. If this action hangs the application, you need the IIS code. You may force baserunner to use the IIS code by setting the logical variable _use_iis_sort.When this variable is present, baserunner will default to the IIS code when navigating a sorted database. If you are running baserunner under IIS, using this variable may provide a slight performance benefit since it will bypass the code that checks the server software. | X |
baserunner can be called through a standard link that passes a command line to the program or through a form. The variables that are passed to baserunner tell it the name of the users session, the target template file to open, and the action the program should take before opening that template along with any other information you require. While CGI is a well established standard, the way different servers handle data sent from a user does vary. Some methods of calling baserunner may not always work on some server configurations. Generally, if you are getting unexpected results from one method of calling baserunner, try another--if, for instance, you have trouble sending variables through the command line, try rewriting the call as a small HTML form. Trial and error is the best way to find out what works. Most servers will handle any of the calling methods with no problem at all.
The first call to the program needs to pass the name of the configuration file. Normally that is the only parameter that is necessary. The program will open the default target, _defhtml, if no _tar variable is specified.
<a href="/cgi-bin/baserun.exe?_cfg=[configuration file]"></a>
or to start baserunner with a form:
<form action="/cgi-bin/baserun.exe" method="GET">
<input type="hidden" name="_cfg" value="[configuration file]">
<input type="submit" value="Start">
</form>
With the initial call that includes the application configuration file name, baserunner creates a session record for the user and assigns her a unique session name. The three variables that are used with most subsequent calls to baserunner are: _ses (session), _act (action), and _tar (target template).
On every call to baserunner after the first, the session name is passed using the session variable: _ses={session}. The _tar variable specifies the target template that baserunner should process. The _tar variable may be omitted if the current template will be used again. The _act variable is the action baserunner should take when parsing the target template (or reading the submitted form). If you simply wish to open another template without repositioning the record pointer, you may specify a _tar variable and omit the _act variable. _ses, _act, and _tar are the most common variables. Other variables may also be passed either on the command line or through a form. If a variable is sent from the command line or from a form, it will override a variable of the same name in the configuration file. Variable names in boldface take the name(s) of a field in the current database. These are the only variables that do not begin with an underscore.
CFG = May be included in the application configuration
file.
CL=May be included on the command line or as a form variable.
| Variable | Value | Description | CFG | CL |
|---|---|---|---|---|
| _cfg | File Name | The configuration variable specifies the configuration file baserunner should read. It is required when first calling baserunner. The value given for this variable is the name of the configuration file that the program should use. If you have not specified a _configpath variable in baserun.cfg and the configuration file is not contained in the directory from which baserunner is run, the value must include the full path to the file. | X | |
| _ses | {session} | The session variable is required for all calls to the program after the session is started. It passes the name of the user's session to baserunner. | X | |
| _tar | File Name | The target variable specifies the name of the template file the baserunner should parse in response to the command. If the target variable is omitted, the current template file is used. If you have not specified a _templatepath variable in baserun.cfg and the configuration file is not contained in the directory from which baserunner is run, the value must include the full path to the file. | X | |
| _act | Action | The action variable specifies what you want baserunner to do. No action is specified when first calling the program. See the table below for the possible actions. The _act variable may be omitted if you are simply opening another template with the current data. | X | |
| _fil | Expression | The filter variable specifies a filter (query) for the database. The
value should be an xBase expression. On the command line, the _fil variable sets a new
filter for the database. In a query form, there may be multiple _fil variables that will
all be processed when building a new query. In most cases, the value assigned to the _fil
variable should be URL encoded, e.g. _fil=<%expression%>. If _fil is passed with a value of 0 (zero), the current query will be cleared. |
X | |
| _tempfil | Expression | The temporary filter variable specifies a filter for the database. The value should be an xBase expression. The _tempfil variable is discarded after the call and the previous filter is restored. Also, the record pointer is not changed. | X | |
| _dbf | File name | This variable will set the default database that the application will use. The value assigned to this variable is, if necessary, the path, and name of the database to baserunner should use. Please see the discussion about using multiple databases in an application for more information about the _dbf variable. | X | X |
| _display | Integer | The value of this variable, an integer, specifies the number of records to show when the <!--repeat--> directive is used. | X | X |
| _password | Text | See Password. | X | |
| Field Name | Text | A field name variable is used with queries, data entry, and editing. | X | |
| Field List | Text | A Field list variable is used only with Query forms. The name is a list of field names delimited by spaces: field1 field2 field3. See Query |
X | |
| %Field Name | Expression | A field name prefixed with a percent sign "%," is used in data entry and editing forms to pass an expression that is used to determine the value assigned to the field. See entry and editing. | X | |
| _case | Logical | This variable causes a query to be case sensitive. See Query. | X | X |
| _matchall | Logical | This variable, used with a query, requires that all elements of a query are true rather than any elements of a query. See Query. | X | X |
| _sortorder | Expression | The expression for this variable sets the sort order for the data in a form using the
query or sort actions. It may also be included in the application configuration file to
set the sort order for the entire application. Sorting the database carries a significant
performance penalty. The expression used to sort the data may not return
a logical value. If _sortorder is passed with a value of 0 (zero), the current sort order will be cleared. |
X | X |
| _exact | Logical | This variable has the same effect as using both _matchall and _case in a query form. See Query. | X | X |
| _tagstart | Text | This variable sets the opening delimiter for baserunner tags. The default value is "{". | X | X |
| _tagend | Text | This variable sets the closing delimiter for baserunner tags. The default value is "}". | X | X |
| _uencodestart | Text | This variable sets the opening delimiter for text within a template that baserunner should URL encode. The default value is "<%". | X | X |
| _uencodeend | Text | This variable sets the closing delimiter for text within a template that baserunner should URL encode. The default value is "%>". | X | X |
You may include any additional variable you wish with a form or on the command line. You simply must give it a name that begins with an underscore, "_". These additional variables may be assigned any value, and those values may be retrieved by using the variable name as a tag.
When passing variables that take expressions (or other values that contain characters that might interfere with HTML) on the command line, you will need to URL encode that value. To accomplish this, you may use the tags <%. . .%> to specify the text that baserunner should URL encode. For instance, if you pass a _fil variable on the command line, you could instruct baserunner to encode the value: _fil=<%expression%>. Any value that contains characters that are not alphanumeric should be URL encoded when passed on the command line. If such values are passed through a form the browser will take care of the encoding. Values contained in a configuration file do not need to be encoded.
The actions that are recognized by baserunner are detailed below. On the command line (the information following the question mark, "?") the variables are separated by an ampersand "&". The command line may include URL encoded information
<a href="/cgi-bin/baserun.exe?_ses={session}&_act=[action]&_tar=[template]"></a>
When passed through a form, the variables should normally be included as hidden variables within the form. A form may use either GET or POST as its method. Generally for queries, entry, and editing, you should prefer POST; otherwise GET is appropriate:
<form action="/cgi-bin/baserun.exe" method="GET">
<input type="hidden" name="_ses" value="{session}">
<input type="hidden" name="_act" value="[action]">
<input type="hidden" name="_tar" value="[template]">
<input type="submit" value="Submit">
</form>
If you use post as the method, you also have the option of passing both form variables and a command line:
<form action="/cgi-bin/baserun.exe?_ses={session}&_act=[action]&_tar=[template]" method="POST">
<HTML Form Variables>
<input type="submit" value="Submit">
</form>
The _act variable may use any of the following values:
| top | This action repositions the record pointer to the first record of the database (or the first record in a query). |
| back | This action repositions the record pointer back one record, or if multiple records are displayed, back X records in the database or the query. X is the number of records specified in the _display variable. If this causes the record pointer to move beyond the first record, the pointer is set to the first record. |
| next | This action repositions the record pointer forward one record, or if multiple records are displayed, forward X records in the database or the query. If this causes the pointer to move beyond the end of the file, the pointer is positioned to the last record, or the last record X. |
| end | This action repositions the record pointer to the last record in the database or query. If multiple records are displayed, this action positions the record pointer to the last record X. |
| integer | Using an integer as an action, positions the record pointer to whatever record is specified by the number. |
| delete | The delete action is used both to delete and recall recordsthe action sets the deletion marker in the record to its opposite state (i.e. a deleted record will be recalled, and one that is not deleted, will be). This action works on the record currently selected. Records marked for deletion remain in the database. Actually removing the deleted records should be done off-line using your DBMS software, or with the pack action. |
| pack | The pack action physically removes records marked for deletion from the currently selected database. On large database, especially those containing memo fields this action can be time consuming and the database will be locked for its duration. If the _nopack variable is present, this action will have no effect. |
| See Mail configuration. | |
| debug | Using debug as the action causes baserunner to send all the current variables to the user. No template is processed when the debug action is used. |
| password | See Password. |
| display | The display action is used to reset the number of records displayed on a
page. This will override the _display variable in the configuration file. Using the
display action requires a form that includes a field named _display. The {setdisplay} tag
will put the current display value into the _display field. An invalid entry (i.e.
non-integer) causes the display value to default to 1. Example:
|
| sort | The sort action requires the _sortorder variable that returns a value of
a field name or an xBase expression that sets the order in which the records are
displayed. The _sortorder variable may also be used with a query action. Example (from the example application):
Sorting a database results in significantly slower performance. You should only sort small databases or small subsets of larger databases. See the description of the _use_iis_sort variable above. |
| query | See query. |
| refine | See query. |
| revert | See query. |
| edit | See entry and editing. |
| entry | See entry and editing. |
For an excellent discussion of the security issues raised by all CGI programs, please see this page at w3.org. Any use of CGI presents some risks. baserunner seeks to minimize these risks. Setting appropriate variables and using the tools your server provides will make baserunner more secure.
baserunner does require the ability to write files on the server. The only files baserunner creates are the session database and its associated memo file. baserunner also can write data to the application's database(s). baserunner cannot be used to write any other files to the server.
Permitting your users to enter HTML code into database fields should be closely monitored--particularly if your server permits SSI. You may set baserunner to strip HTML tags from user entry. baserunner does expect your application to be responsible for most form validation. With data entry forms, baserunner will ignore inappropriate user entries. baserunner uses dynamically sized storage for variables.
Under Linux, the internal calls to the sendmail program are generated with the -t option that helps eliminate malicious use of that feature.
When running baserunner under Linux, set directory and file permissions to the least necessary to run your application. Windows permissions are less sophisticated than those used by Linux so you don't have as much flexibility there.
Any database or configuration file that contains confidential information should be placed in a password protected directory. baserunner is just sitting there on the hard disk--it has no control over a user downloading a database or a configuration file from your server. A knowledgeable user will probably be able to determine where the various files are on your server, and, if they are in unprotected directories, will be able to get them without much difficulty. If you have questions about how to secure directories or files, consult your server administrator.
Using a "baserun.cfg" file to hold the paths to your application files is probably the single most important security measure you can take. Since the path included in the configuration file is used for opening all files, it eliminates the possibility of a user using baserunner to call a specific file from the command line (e.g. _tar=c:\autoexec.bat). On a well configured server, this is not a huge concern, but could potentially open up the system to attack. Running baserunner without a baserun.cfg file specifying paths to the directories containing your application files should be considered insecure.
Using cookies to supply some variables, particularly the session name, may provide some additional security because the application won't rely on variables or hidden variables that can be easily edited by the user before submission (or bookmarked). Cookies can also simplify calls to baserunner by supplying variables globally (much like the configuration files, except that these variables may be generated at runtime). The downside is that the user must have cookies enabled for any of this to work. Setting and managing cookies are best dealt with through JavaScript. A very simple script to add cookie variables would look something like this, although there are many options available:
| <script language="JavaScript"> <!-- function SetCookie(name, value) { document.cookie = name + "=" + escape(value); } SetCookie("_ses", [session]); SetCookie("_myvariable", "My value"); // --> </script> |
Obviously, to use this script, the _tagstart and _tagend variables are set to "[" and "]" respectively. This script would need to be included in the template contained in _defhtml (at least to make the _ses variable available to the rest to the application).
|