setcookie
setcookie
COOKIE
,
VALUE
,
EXPIRES
,
OPTIONS

The setcookie statement set the value of a cookie to send back to the client..

Parameters

This statement has four parameters:

cookie – Name of cookie value. Must be only ASCII letters and numbers (no spaces, no punctuation, no Unicode values).

value – data value of cookie (numeric or date values will be converted to text.

expires – cookie expiration time. If not specified, the cookie will expire when the user quits the browser. If all numeric digits (or a number) it expires after specified number of seconds. You may also add a suffix: seconds, minutes, hours, days, weeks, months, years.

options – additional cookie options (see http://www.ietf.org/rfc/rfc2965.txt page 4)

Description

This statement may be used in web procedure code to return a cookie value to the broswer. The browser will send this value back to the server each time it makes a request.

    setcookie "SalesTax","8.25"
    setcookie "TableFontPref","Verdana"
    setcookie "MyAreaCode","858"

Later, another web procedure can read these values using the getcookie( function.

    let areaCode = getcookie("MyAreaCode")

Note: Cookie names are not case sensitive, so MyAreaCode, MYAREACODE and myareacode all refer to the same value.

### Cookie Expiration Date

Cookies don’t last forever. In fact, if you don’t specify an expiration date for a cookie then it will disappear when the user closes the browser window. If you want to keep a cookie around for a while set an expiration date for it, like this:

    setcookie "SalesTax","8.25","12 hours"
    setcookie "TableFontPref","Verdana","12 weeks"
    setcookie "MyAreaCode","858","12 years"

The cookie expiration time can be speified in seconds, minutes, days, weeks, months or years.

### Cookie Options

This optional parameter allows you to add more options to the cookie. The best source of information we’ve found for additional cookie options is at http://www.ietf.org/rfc/rfc2965.txt, however, please note that the Panorama Server uses the original cookie format, not version 2 (it appears that the version of Apache shipped with MacOS does not support version 2 cookies). In general you probably don’t need to worry about these extra options.

See Also

- cgitest -- tests a CGI procedure.
- closeserverfile -- closes the current database (used on the server).
- getcookie( -- returns the value of a cookie submitted to the server.
- getcookielist( -- returns a list of cookies submitted to the server.
- info("httprequestinprogress") -- returns true if this code is running on Panorama X Server, and the server is responding to a web client request.
- info("webclientsessioninprogress") -- returns true if this code is running on Panorama X Server, and the server is responding to a web client request.
- openserverfile -- opens a database (used on the server).
- serverrunning( -- returns true if this code is running on a Panorama server, or false if it is running in single user mode or on a client.
- serverstatus( -- returns a dictionary describing the current status of Panorama X Server.
- URL Tool Menu (Web Debugging) -- tool with popup menu to assist with debugging web procedures.
- urlfilename( -- extracts the filename from a complete url.
- urlpath( -- extracts the path from a URL.
- Web Cookies -- web cookies.
- Web Error Pages -- customizing the server response when an error occurs.
- webformitemvalue( -- gets the value of a POST web form item (used when processing a web query with Panorama Server).
- webhomesubfolder( -- returns the folder ID of a subfolder of the web server's home folder.
- webimagedisplay( -- used within an Image Display Object to specify both a web image (used when the form is displayed in a web browser from Panorama Server) and a local image file (used when the form is displayed within Panorama).
- webserverinfo( -- retrieves additional information about the web server and the current browser request.
- webshare -- perform record locking operations from a web publishing procedure.
- webtagortext( -- prepares text for display in a web page.
- webtext( -- converts a number or regular text into text encoded for display in a web browser.

History

Version | Status | Notes
10.2 | Updated | Carried over from Panorama 6.