Monday, November 1, 2010

Server configuration variables

The purpose of server side configuration is to provide more control of the hosted sites to the server owner. All these variables are used to increase security of the server, by limiting developers access rights to certain server data (environmental variables, paths above virtual hosts wwwroot directory, writing files during run-time), or by limiting the ability to use some WBSP functionalities (scripting host, file upload, full definition of ADO connection string, limiting number of instances of the WBSP engine that can be used simultaneously by single virtual host or even disabling WBSP on certain virtual hosts) or by strictly defining the rules by which WBSP can be used in CGI mode.
Server-side configuration variables :
AbsolutePath
DefaultDocument
MaxInstances
RegCode
Upload

read more

Server configuration section

This section contains specific server side configuration for all aliases of a single virtual host defined in Servers section. It has to be created for every virtual host that needs separate configuration different from default settings. Here's an example:
[wbsp.com]
DisableWB=F
AbsolutePath=On
Upload=On
FileCommands=On
Execute=JavaScript,VBScript,JScript
HiddenEnvVars=PATH,COMP*,System*
TimeOutSec=20
DefaultDocument=index.wbsp
ADOConnectionString=T
ActivateCGIByExt=wbsp
CGISecurityString=LhBv3KP
MaxInstances=0
HideDocuments=sr,aut,inc,ic,mdb
ScriptTimeOutSec=60

[dsd.ba]
DisableWB=F
AbsolutePath=Off
Upload=On
FileCommands=Off
Execute=VBScript
HiddenEnvVars=PATH,COMP*,System*,Win*
TimeOutSec=10
DefaultDocument=default.wbsp
ADOConnectionString=F
ActivateCGIByExt=wbsp
CGISecurityString=LhBv3KP
MaxInstances=10
 

SF (WB_Command) - Send file

Description
This command is used for sending unchanged file defined in variable WB_TempName to client. The file will not be processed or changed in any way, regardless of its content or type.

read more

Subsection [MsgAndLbl]

This subsection contains the variables that define labels and style for navigation links (for previous, next, first and last page) and messages (empty recordset and deleted records). They can contain any valid HTML code including WhizBase report tags and functions both in input and output syntax.
It can also contain variables for formatting navigation links WB_Style.
These are variables that can be stored in this subsection (in alphabetic order):
WBM_NoMatch
Here is the example of MsgAndLbl section (marked blue):




Titles

Year published Title ISBN
$wbf[Year published] $wbf[title] $wbf[ISBN]

$wbnavigator


To test this example, create images rightarrow.gif, leftarrow.gif, first.gif and last.gif and place them in directory images located in same directory with this wbsp file. Also create images of the digits 0 to 9 (name them 0.gif, 1.gif, 2.gif, ..., 9.gif) and place them in directory digits located in same directory with this wbsp file.

read more

Section [UserData]

This section contains a list of custom, user-defined variables that can be used in WBSP files, in form:
UserVariable=AnyValue
These variables can be read using functions $WBRV and $WBRRV.
The user-defined variables in UserData section can contain WhizBase tags and functions, same as any WBSP system variable (variables starting with WB_).
Here is an example of UserData section in default.inc file in virtual hosts document root:
[UserData]
AdminEmail=admin@somemailserver.com
MyMailServer=mail.somemailserver.com
Later these variables can be accessed from your WBSP files like this:
[FormFields]
wb_mailserver=$wbrv{MyMailServer}
wb_bcc=$wbrv{AdminEmail}
Or like this:


some html code ...

Please send your comments/questions to
$wbrv[AdminEmail]

Thank you!
 

Subsection [Upload]

This subsection contains variables needed to control file upload using WBSP page. Using these variables, the developer can control where uploaded files will be saved, what is maximum size of a single file, what file types can not be uploaded, weather existing file will be overwritten or not, where to store log data and what prefix to add to URL of uploaded file. The variables that can be stored in this subsection are  (in alphabetic order):
WB_UploadLog
Here's an example of upload subsection (marked with blue):
[FormFields]
WB_BaseName=biblioA.mdb
WB_AllowMultipart=T
WB_Command=A
WB_UID=ISBN
WB_Redirect=titlesQ.wbsp
WB_RcdSet=Titles
[Upload]
WB_Disallow=![jpg,gif]
WB_UploadDir=images/
WB_Overwrite=T
WB_MaxFSize=24576
WB_UploadLog=upload.log
To learn more about uploading files using WBSP read the "Uploading files using WBSP" page.

read more

Section [Referrer Check]

Section Referrer Check defines what commands will require validation of referring page and what domains will be accepted as valid referrers.
It has a variable Referrer that contains a comma-separated list of servers (domains) that  will be accepted by WBSP engine as valid hosts for referring pages.
If this variable does not exist (or it is empty) then WBSP engine will not try to validate referrer. If you want to allow referring page to be located only on same server as WBSP file set this variable to $self$.
The main change from previous versions is that this section is part of the WBSP file while in previous versions it was part of WhizBase.ssc server-side configuration file.
Here is an example of Referrer check section:

[Referrer Check]
Referrer=whizbase.com,wbsp.com
 

Subsection [Include]

This subsection contains a list of files (respecting the WBSP path rules) that WBSP engine will check for input variables if they are not found in original WBSP file. Include files are processed backwards – from end to top of the list. WBSP will stop searching as soon as it finds first occurrence of the variable it search for.
Include files will be processed only if WBSP engine does not find the variable in WBSP file, but before WBSP engine tries to read variable from HTML form input fields. WBSP engine will read include files backwards (starting from the last file in the include section).

Here is an example of Include section (marked blue):




Titles


Year published Title ISBN
$wbf[Year published] $wbf[title] $wbf[ISBN]


$wbnavigator




And include file db.inc looks like this:
[FormFields]
WB_Basename=biblio.mdb

Special case are include files named default.inc.

read more

Subsection [FormFields]

This subsection contains the variables that are essential for processing WBSP file. Here you put information about the database, recordset, template, error template, log file, redirection, etc.
These are the variables that can be stored in FormFields subsection (in alphabetic order):

WB_DBReadDes WB_Debug
WB_FileName
WB_Null
WB_Usr
WB_WholeWord

Here's an example of FormFields section (marked blue):
[FormFields]
WB_basename=biblio.mdb
wb_rcdset=publishers
WB_Command=Q
wb_showlogo=F
wb_order=name




Publishers



$wbf[Name]

$wbsr[titles.sr]


Section [ErrorMessages]

This section contains a list of custom error messages in form:
ErrorNumber=ErrorMessage
ErrorNumber is standard number reported by WBSP engine. It can be either WhizBase error number or Jet  or any other error number. It is not recommended to put any Whizbase tags, functions, etc. in the  ErrorMessage, because it can produce unwanted results. If you need to place such content in  ErrorMessage, it is strongly recommended to test all possible situations before publishing the page to the real world. The exception to this is a reserved word $WBERRRED: followed by the URL of the web content where the WBSP engine will redirect visitor in the case of a specific error occurrence. This will work only if error occurs before WBSP sends HTTP header (e.g. if error  occurs before WBSP starts report rendering).
This is useful for translating the error messages from English or for using IMG HTML tag to display an image instead of error message, or to use block to process certain errors.

Here is an example of ErrorMessages section:
[ErrorMessages]
5034=
3030=
429=
5040=$WBERRRED:/requiredMissing.wbsp
 

Thursday, October 28, 2010

WBSP Server Side Configuration (wbsp.ssc)

WBSP server side configuration file is text file located in the same directory with engine file wbsp.exe. Both these files should not be accessible using HTTP protocol (they should be located above wwwroot directory of the web server or, if WSBP is used as CGI, in a directory without read access). 
WBSP.SSC file has three main sections and a separate configuration section for every virtual host on the server:

SECONDS ($WBFN)

Availability
SECONDS is available for use with all WBSP commands.
Syntax
$WBFN{SECONDS}
$WBFN[SECONDS]

Arguments
SECONDS function does not have any arguments.

Returns
A single-precision number representing the number of seconds elapsed since midnight (server time).

read more

ScriptTimeOutSec

ScriptTimeOutSec=seconds

This variable contains the default value for WB_TimeOut variable for specific virtual host. Default value is 30.

read more

RND ($WBFN)

Availability
RND is available for use with all WBSP commands.
Syntax
$WBFN{RND(decnumber)}
$WBFN[RND(decnumber)]

Arguments
decnumber - any integer in range 1 to 2147483647.

Returns
The randomly generated number in range from 1 to the number passed as an argument.
Example



Random number:$wbfn[RND(1000)]!

Result
Random number:351! 
 

Request related functions

$WBV
$WBVA
$WBVC
$WBVR
$WBVS
$WBVSC

read more 

Tuesday, October 26, 2010

Report tags

Report tags are WBSP placeholders that do not have any arguments, and therefore their syntax does not necessarily include neither square brackets nor braces. However, if for any reason you need to pass them as arguments to any WBSP function you have to add empty square brackets [] or braces {} at the end.
$WBFILEREPORT
$WBTIMER
Database related tags
$WBRECORDBREAK
Error message tags
$WBERRMAIL
Navigation tags
$WBLASTPAGE

read more

R (WB_Command) - Render

Description
This is a default command (e.g. WBSP page with no configuration section or with no WB_Command value will execute RENDER command). When executed, it processes all WhizBase tags and functions that exist in the page. If database related variables are defined, this command will open the recordset, but it will display only first record of the recordset.
Important: If your WBSP page displays only one record, and you are positive that there is more records in recordset, and that you have placed and properly, then it is very possible that you have forgot to set WB_Command properly (to Q, P or L) and that your WBSP page executes RENDER command.

read more

Registration section

The registration section always contains a single value of registration key for entire server (server license - ServerKey variable). If valid server registration key exists, virtual hosts do not need their own registration keys.
[Registration]
ServerKey=SXHZSNKIKDIJSHIJKL
 

RegCode

RegCode=Registration Key

This variable contains the registration code used in combination with Developer variable. If valid combination of these two variables exists, virtual hosts do not need their own registration keys.

read more

Recordset

WhizBase uses following SQL model for opening the recordset:
SELECT WB_DBFlds FROM WB_RcdSet WHERE (WB_Query and textfield1 like "WB_AndOr textfield2 like "wbf_textfield2" WB_AndOr numfiled1=wbf_numfiled1 ...) GROUP BY WB_Group HAVING WB_Having ORDER BY WB_order;

read more