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

RP (WB_Command) - Read DB permissions

Description
This command is used for reading access permissions on database (WB_BaseName) table (WB_RcdSet) for specified user (WB_DBUser) or group (WB_DBGroup) in workgroup file (WB_System). The result can be displayed using $WBAdmin[] tag.

read more 

Q (WB_ Command ) - Query

Description
This command is used when you need to access the database recordset for reading the records. When executed, it opens the recordset (variables WB_BaseName and WB_RcdSet must be defined when you use this command), processes all WhizBase tags and functions that exist in the page, repeating the detail section as many times as there is records in the page (this is defined by the value of the WB_MaxRec variable). When it builds the recordset, this command will use WB_Query variable together with WBF_recordsetfieldname form fields to generate SQL WHERE clause. To learn more about variables used for generating recordset, please read the "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 very possible that you have forgot to set WB_Command to Q and that your WBSP page executes RENDER command.

read more

P (WB_Command) - Personalized email

Description
This command is used for sending WBSP page to email recipient(s) using SMTP mail server defined in variable WB_MailServer. The report template will be processed and the (same) result will be sent to all recipients defined in WB_CC and WB_BCC variables together with attachments defined in WB_Attach variable (if it exists). If WBSP defines recordset (using WB_BaseName, WB_RcdSet and WB_Query) it will be opened same as with Query command, and all database related functions will be processed too.

read more

Path rules

WBSP engine has it's own path rules:
  • All relative paths are relative to the location of the current WBSP file.
  • Root dir is represented by slash (/) character and it represents document root (wwwroot) directory of current virtual host, and not root directory of current disk.
  • In order to access files on same disk but located above the document root directory as well as to access files located on other disks or computers, developer must use absolute paths.
    To enable usage of absolute paths, AbsolutePath variable must be set to true in server configuration section for current virtual host in wbsp.ssc file. If this variable is not set to true, an error will be generated when WBSP receives a reference to an absolute path.
Path rules apply to all WhizBase variables, sections and functions that use external files. Here are some examples:
 
[Include]
/shopping.inc
../dbsettings/admin.inc
[FormFields]
wb_basename=\\DatabaseSrv\user23\access\shopping.mdb
wb_logFile=c:\logs\user23\wbsp.log


$wbinc[/globaltop.htm]

Your registration code is:

$wbrun[c:\scripts\user23\registration.js |JavaScript|MkRegCode($wbv{CopyID})]

$wbinc[shoppingfooter.htm]
Lines shown in red color contain file names with absolute path.

read mroe

OCT ($WBFN)

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

Arguments
decnumber - any integer in range 0 to 2147483647.

Returns
A string representing the octal value of the number passed as an argument.
Example



Octal value of letter A is $wbfn[OCT(65)]!

Result
Octal value of letter A is 101! 
 

Monday, October 25, 2010

Navigation tags

Navigation tags are WBSP placeholders for various parts of a report navigation block (links used to navigate through report pages).
$WBNAVIGATOR
$WBPAGENUMS
$WBPREVPAGE
$WBNEXTPAGE
$WBFIRSTPAGE
$WBLASTPAGE

read more

Format string definitions (Named Formats)

Format Name Description
General Number Display number with no thousand separator.
Currency Display number with thousand separator, if appropriate; display two digits to the right of the decimal separator. Output is based on system locale settings.
Fixed Display at least one digit to the left and two digits to the right of the decimal separator.
Standard Display number with thousand separator, at least one digit to the left and two digits to the right of the decimal separator.
Percent Display number multiplied by 100 with a percent sign (%) appended to the right; always display two digits to the right of the decimal separator.
Scientific Use standard scientific notation.
Yes/No Display No if number is 0; otherwise, display Yes.
True/False Display False if number is 0; otherwise, display True.
On/Off Display Off if number is 0; otherwise, display On.
General Date Display a date and/or time. For real numbers, display a date and time, for example, 4/3/93 05:34 PM. If there is no fractional part, display only a date, for example, 4/3/93. If there is no integer part, display time only, for example, 05:34 PM. Date display is determined by your system settings.
Long Date Display a date according to your system's long date format.
Medium Date Display a date using the medium date format appropriate for the language version of the host application.
Short Date Display a date using your system's short date format.
Long Time Display a time using your system's long time format; includes hours, minutes, seconds.
Medium Time Display time in 12-hour format using hours and minutes and the AM/PM designator.
Short Time Display a time using the 24-hour format, for example, 17:45.

read more

MU (WB_Command) - Multi update

Description
This command is used for updating the multiple records with same field value(s). Unlike Update command that requires arrays of WBF_ fields with equal number of members (e.g. if you update 1 field for 4 records you MUST send four sets of WBF_field1 (WB_UID member) and WBF_fied2 form fields), multi update command accept an array of WBF_field ONLY for fields defined in WB_UID. Upon receiving the WB_UID members as an array of WBF_field it will create the recordset and modify the content of all selected records with SAME value(s).
e.g.
Original table values
ID (WB_UID field) Title Show
1 McGraw-Hill's Encyclopedia of Networking & Telecommunications True
2 Microsoft SMS Installer True
3 Windows 2000 Iis 5.0 : A Beginner's Guide True
4 Windows Nt Security Handbook True
  Table values after Update command (wbf_id=1&wbf_Show=False&wbf_id=2&wbf_Show=True&wbf_id=3&wbf_Show=False&wbf_id=4&wbf_Show=True)

ID (WB_UID field) Title Show
1 McGraw-Hill's Encyclopedia of Networking & Telecommunications False
2 Microsoft SMS Installer True
3 Windows 2000 Iis 5.0 : A Beginner's Guide False
4 Windows Nt Security Handbook True
  Table values after Multi update command (wbf_Show=False&wbf_id=1&wbf_id=2&wbf_id=3&wbf_id=4)

ID (WB_UID field) Title Show
1 McGraw-Hill's Encyclopedia of Networking & Telecommunications False
2 Microsoft SMS Installer False
3 Windows 2000 Iis 5.0 : A Beginner's Guide False
4 Windows Nt Security Handbook False

 read more

MONTH ($WBFN)

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

Arguments
MONTH function does not have any arguments.

Returns
A whole number between 1 and 12, inclusive, representing the month of the year for current server date.

read more

MaxInstances

MaxInstances=number

This variable defines the maximum number of concurrent instances of the engine for the specific virtual server. If this number is exceeded the error will be generated. The default value is 0 (unlimited number of instances).

read more

L (WB_Command) - Mail to list of recipients

Description
This command is used for sending WBSP page to email recipient(s) using SMTP mail server defined in variable WB_MailServer. Depending on variable used for defining email address the report template will be processed differently.
If email address is defined in WB_BCCField report template will be processed once and the (same) result will be sent to all recipients. The email addresses will be set as BCC so no recipient will see the email addresses of other recipients. The mail server will be contacted once and a single mail with many BCC addresses will be sent. Please note that some mail servers limit the maximum number of recipients for a single mail.
If email address is defined in WB_ToField report template will be processed as many times as there is records in recordset (once per record) and the result will be sent to single recipient every time, which means that mail server will be contacted once for every recipient.
If there are any attachments defined in WB_Attach or WB_AttachField variables, they will also be sent.
The defined recordset (using WB_BaseName, WB_RcdSet and WB_Query) will be opened same as with Query command, and all database related functions will be processed too.

read more

MAIL

These variables are used to configure mail related settings for use with WB_Command values L and T.
WB_CC

read more

Logging

These variables are used for enabling and formatting logging.
WB_Debug

read more

LCS ($WBFN)

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

Arguments
anystring - any string value.

Returns
The string passed as an argument converted to lowercase characters.
Example



Lowercase of Hello World is $wbfn[LCS(Hello World)]!

Result
Lowercase of Hello World is hello world! 
 

Introduction

WBSP, (WhizBase Server Pages) is a general-purpose scripting tool (hypertext preprocessor) for Web development and can be embedded into HTML, XHTML, XML, RTF, ASCII, JavaScript, VBScript and any other text based file format.
Its syntax is different from any programming language  like C, Java, Perl, VB, and also form other hypertext preprocessors like PHP or ASP. It is easy to learn, and has very short learning curve before one can produce useful results.
It was developed by Faik and Tarik Djikic, owners of the web and software development company, Djikic Ltd., and since 1998 has been used for building few hundreds sites including eye catching web presentations, web applications, real-time monitoring systems, etc. Our main goal is to allow web developers to write dynamically generated web pages quickly and easily with no limits in terms of contents, database formats, graphic layout design, embedded technologies, etc.

read more

Friday, October 22, 2010

INT ($WBFN)

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

Arguments
decnumber - any decimal number.

Returns
The integer portion of the number passed as an argument.
Example



Integer part of timer is $wbfn[INT($wbtimer[])]!

Result
Integer part of timer is 53021! 
 

Installing WBSP on Windows with Apache

This section contains notes and hints specific to Apache Web Server. To download Apache Web Server installation package please visit http://httpd.apache.org/download.cgi.
To set up WBSP to work with Apache on Windows you need to stop the Apache server, and edit your srm.conf or httpd.conf to configure Apache to work with WBSP.
Although there can be a few variations of configuring WBSP under Apache, these are simple enough to be used by the newcomer. Please consult the Apache Docs for further  configuration directives.
To install WBSP insert these lines to your conf file (assuming that you have installed WBSP in c:\wbsp\):

    AllowOverride all
    Options None
    Order allow,deny
    Allow from all

ScriptAlias /wbsp/ "c:/wbsp/"
AddType application/x-httpd-wbsp .wbsp
Action application/x-httpd-wbsp "/wbsp/wbsp.exe"
You must repeat from last two lines for each extension you want associated with WBSP scripts. (.wbsp,.sr,.aut,.ic and .inc are recommended.)
Please note that we have done our best to disable calling WBSP directly:
http://servername/wbsp/wbsp.exe?.....
so please do not change the .exe extension on wbsp.exe file.
As a further precaution, we recommend you change the "/wbsp/" ScriptAlias to something more random, to prevent any attempts to call your binary (like the Code Red scripts) for returning a response other than 404.
Remember when you have finished to restart the server, for example,
NET STOP APACHEfollowed by
NET START APACHE

read more 

Installing WBSP on Windows with Xitami

This section contains notes and hints specific to Xitami - powerful multiplatform Open Source web server. To download Xitami installation package please visit http://www.xitami.com/download.htm.
  • Make sure the webserver is running, and point your browser to xitamis admin console (usually http://127.0.0.1/admin), and click on Configuration.
  • Navigate to the Filters, and put the extension which wbsp should parse (i.e. .wbsp) into the field File extensions (.xxx).
  • In Filter command or script put the path and name of your wbsp executable i.e. c:\wbsp\wbsp.exe (assuming that you have installed WBSP in c:\wbsp\).
  • Press the 'Save' icon.
  • Repeat last three steps for each extension you want associated with WBSP scripts (.wbsp,.sr,.aut,.ic and .inc are recommended).
To add WBSP filter manually please follow these steps:
  • In directory where Xitami is installed create file defaults.cfg
  • Add following lines to the file:
    [Server]
    priority=1

    [Server]
    Default3=default.wbsp
    [Filter]
    #assuming that WBSP.exe is located in c:\wbsp\
    .wbsp=c:\WBSP\wbsp.exe
    .sr=c:\WBSP\wbsp.exe
    .aut=c:\WBSP\wbsp.exe
    .ic=c:\WBSP\wbsp.exe
    .inc=c:\WBSP\wbsp.exe
  • Restart the server
read more

Installing WBSP on Windows with OmniHTTPd Server

This section contains notes and hints specific to OmniHTTPd 2.0b1 and up for Windows.
  • Install OmniHTTPd server.
  • Right click on the blue OmniHTTPd icon in the system tray and select 'Properties'
  • Click on 'Web Server Global Settings'
  • On the 'External' tab, enter:
    virtual = .wbsp | actual = c:\wbsp\wbsp.exe (assuming that you have installed WBSP in c:\wbsp\)
    and use the Add button.
  • On the Mime tab , enter:
    virtual = wwwserver/stdcgi | actual = .wbsp
    and use the Add button.
  • Click 'OK'
Repeat steps 4,5 and 6 for each extension you want to associate with WBSP (.wbsp,.sr,.aut,.ic and .inc are recommended).

read more

Installing WBSP on Windows with Netscape servers.

To Install WBSP:
  • Make a file association from the command line (type the 2 following lines, assuming that you have installed WBSP in c:\wbsp\)
    assoc .wbsp=WBScript
    ftype WBScript=c:\wbsp\wbsp.exe %1 %*
  • In the Netscape Enterprise Administration Server create a dummy shellcgi directory and remove it just after (this step creates 5 important lines in obj.conf and allow the web server to handle shellcgi scripts)
  • In the Netscape Enterprise Administration Server create a new mime type  (Category:type,Content-Type:magnus-internal/shellcgi,File Suffix:wbsp)
Do it for each web server instance you want WBSP to run

read more

Wednesday, October 20, 2010

Installing WBSP on Windows with Abyss Web Server

This section contains notes and hints specific to Abyss Web Server. To download Abyss Web Server installation package please visit http://www.aprelium.com/abyssws/download.php.
  • Open Abyss Web Server's console
  • In the Hosts table, press Configure in the row corresponding to the host to which you want to add WBSP support
  • Click Scripting Parameters icon
  • Check Enable Scripts Execution
  • In the Interpreters table click Add button
  • and set the parameters as shown bellow
  • In the Interpreter field, press Browse..., go to the directory where you have installed WBSP, locate wbsp.exe, and click on it
    (in the example above we assume that you have installed WBSP in c:\wbsp\)
  • Set Type to Standard
  • Check Use the associated extensions to automatically update the Script Paths
  • Press Add in the Associated Extensions table
  • Enter wbsp in the Extension field and press OK
  • Press OK
  • Press OK in the Scripting Parameters dialog
  • Click Index Files icon
  • Press Add in the Index Files table
  • Enter default.wbsp in the File Name field and press OK
  • Click OK
  • Press Restart to restart the server.
read more

Installation

This install guide will help you manually install and configure WBSP on your Windows 9x/Me/NT/2000/XP/2003 web servers.
This guide provides manual installation support for:
Internet Information Server 4,5,6
OmniHTTPd 2.0b1 and up
Netscape Servers
Abyss Web Server
WhizBase 5 can be used either as a scripting engine or as a CGI program.
Before applying the server specific instructions, WhizBase files should be installed using the executable installer.

read more

INI file functions

INI files are simple text files, usually associated with Microsoft Windows. The filename extension usually used in Microsoft Windows is ".INI", but in WBSP, files using the INI file format can use any extension, such as ".CFG", ".conf", or ".TXT".

The INI file structure is very simple. It contains parameters grouped in sections and every parameter has a name and a value, delimited by an equals sign (=). The sections are defined in a line by itself, in square brackets ([ and ]). All parameters below the section definition are members of that section.

[Section]
parameter = value
WhizBase uses two functions for reading INI files:
$WBGV
$WBGS


read more

Configuration file format

Configuration file uses the same format as configuration section of WBSP files. WhizBase uses following model for modifying values stored in configuration files.
[WB_Section]
WB_KeyName=WB_KeyValue

HTUSER ($WBFN)

Availability
HTUSER is available for use with all WBSP commands when authentication is used.
Syntax
$WBFN{HTUSER}
$WBFN[HTUSER]

ArgumentsHTUSER function does not have any arguments.
 
Returns
User name used for authentication (WB_HTUsr).

read more

Tuesday, October 19, 2010

HTTP

These variables are used to modify the default content of a HTTP header sent to the client. They can be very powerful tools in building complex web solutions.
WB_HTTPHeader
WB_AddCookie
WB_ContentType
WB_Redirect

read more

HTPASS ($WBFN)

Availability
HTPASS is available for use with all WBSP commands when authentication is used.
Syntax
$WBFN{HTPASS}
$WBFN[HTPASS]

ArgumentsHTPASS function does not have any arguments.
 
Returns
Password used for authentication (WB_HTPass).

read more

HTAccess File

HTAccess file is ordinary ASCII text file that contains WhizBase variables WB_Realm, WB_LoginPage and username/password pairs, organized by following structure:
[Authentication]
WB_AuthType=type (valid settings B-Basic, C-Cookie)
WB_LoginFile=filename (ignored if WB_AuthType=B)
WB_Realm=Realm

[AuthUsers]
username=password
username1=password1
...
usernameN=passwordN

For security reasons we strongly recommend to use wbsp extension for HTAccess file and to add WB_Command=R and in it.
e.g.
[FormFields]
WB_Command=R
[Authentication]
WB_HTAccess=C
WB_LoginFile=/login.htm
[AuthUsers]
username=password
username1=password1


You can not read content of this file!

You can also use aut extension and set the server to handle  files with that extension by WBSP and do not change HiddeDocuments SSC variable, or you can place HTAccess file above wwwroot directory and use absolute path. For this you have to change AbsolutePath SSC variable.

read more

How to...

This section contains step-by-step instructions on how to complete basic tasks using WhizBase.
Displaying records from database table
Uploading files

read more

HiddenEnvVars

HiddenEnvVars=envlist

This variable contains the comma-separated list of environment variables that will be hidden, i.e. author will not be able to use $wbe function with those variables. Default value is *, what means that all environment variables will be hidden. However, some of the environment variables are very important for developing advanced WBSP-powered sites, so it is good idea to hide only those environment variables that can be abused (e.g. PATH, COMP*, SYSTEM*, etc.)

Tuesday, October 5, 2010

HiddeDocuments

HiddeDocuments=extlist

This variable contains the comma-separated list of file extensions that will be hidden, i.e. if you configure server to handle files with those extensions by WBSP, WBSP will return HTTP error 404 (file not found). Default value is sr,aut,ic,inc, what means that include files (both inc and ic), subreports and authorization files will be hidden, as long as your server is configured to handle them with WBSP.exe same as files with wbsp extension.



read more

HEX ($WBFN)

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

Arguments
decnumber - any integer in range 0 to 2147483647.

Returns
A string representing the hexadecimal value of the number passed as an argument.
Example



Hexadecimal value of letter A is $wbfn[HEX(65)]!

Result
Hexadecimal value of letter A is 41! 
 

Header and Footer sections

Header and footer are subsections of detail section. When used they must be placed on the very beginning (header) and very end (footer) of the detail section. This means that nothing (HTML code, RTF tags, plain text, etc.) can not be placed between and and/or between and . This is an example of correctly placed header and footer (marked blue):





$wbsetv[countbooks|0]


This is the list of titles for year $wbf[year published]


$wbf[title] - $wbf[isbn]

$wbsetv[countbooks|$wbcalc[$wbgetv[countbooks]+1]]



Total books in $wbf[year published]:
$wbgetv[countbooks]



$wbsetv[countbooks|0]



Header and Footer sections will be processed and sent to the client before and after Detail section whenever any of referent fields change it's value (to learn more about referent fields please read the explanation for input variable WB_ChangeHFOn). Header and Footer sections will also be shown at the beginning of the Detail section for first record and at the end of the Detail section for last record on the report.

read more

Getting started

Although WBSP on your server can be configured to process files with any extension, to make usage of this tutorial easier we will assume that .wbsp extension is used.
For development purposes you will probably install WBSP locally, and this manual has installation instructions for many existing web servers including some very good freeware. If you have any problems with installing WBSP, please do not hesitate to contact us .

read more

Functions

Functions are WBSP placeholders with one or more arguments, separated with vertical line ( | ), and enclosed in square brackets or braces depending on WhizBase page section in which they are located and processing phase in which they should be processed. Based on this, functions use report syntax ($wbfnname[arg]) and input syntax ($wbfnname{arg}). To learn more about differences between these two syntax models, please read the next topic - Difference between report and input functions. All functions that have more than one argument (separated with |) can be written in multi-line form. However, none of the arguments can be broken in separate lines, unless it is also WhizBase function.
This is a list of WhizBase functions in alphabetical order:

$WBFormat $WBFU
$WBRF

read more