Automatic Session Tracking

The Basic Web Utility 1.1 automatically manages session information using a single HTTP cookie called $sesid. The format of the session information is defined by creating a global string (STBL) named $sestpl that contains the string template definition for the session. This string must be defined before the application CALLs utcgi.wbb and triggers the internal session management.

x$=stbl(“$sestpl”,”name:c(30*),custid:c(10*),items[100]:c(20*)”)

call “utcgi.wbb”,env$,cgi$,errmsg$

In the above example, the session tracks name, custid, and items array fields. Any input from a form or URL that appears in cgi$ is automatically updated in the session values.

To retreive the session record, do one of the following:

dim session$:stbl(“$sestpl”)

session$=stbl(“$sesrec”)

or

call “utses.wbb”,0,session$,errmsg$

Use the utses.wbb program to store any manipulated session data as follows:

session.custid$=”1234”

call “utses.wbb”,1,session$,errmsg$

Session expiration and deletion is handled automatically based on a 24 hour session lifespan; however, this can be controled with the global string $sesage, which stores a numeric value of hours. This does two things:

A session can be manually deleted from the server using the utses.wbb program:

call “utses.wbb”,2,””,errmsg$

For session tracking to work, the user account CGI tasks run under must have write rights to the "utses.dat" file. In addition, if the file is not present the first time session tracking is used, the Basic Web Utility creates the file in the Basic Web Utility directory, and, therefore, must have permission to create the file.

 
Return to first page