setcookie

Cookies are a great way to remember visitors, and to store variables from page to page.
[setcookie name=cookieName&value=cookieValue&expires=expireDate&path=/&domain=yourdomain.com]
Using [setcookie] tag in a template causes the remote browser to create or replace a cookie of that name in its local list of cookies. Use [getcookie] or [listcookies] later to retrieve that value from the remote browser.

Parameters

ParameterDescription
nameThe name of the cookie
valueThe value to be saved in the cookie
expiresThe expiry date in the format: Wednesday, 09-Nov-2022 23:12:40 GMT
pathThe default value for path, '/', will allow any template on the website to access the cookie. You can confine a cookie to a specific directory. For instance, if you specify a path value of '/admin/', then only templates within the '/admin' directory can access the cookie.
domainThe domain must be the domain from which the cookie is being set, otherwise the browser will not provide the cookie information. Setting the domain parameter limits which domain may access the cookie. If you specify 'www.yourdomain.com', then only templates within that domain can access the cookie. Specifying just 'yourdomain.com' for the domain, will allow templates from 'www.yourdomain.com', 'secure.yourdomain.com', or 'whatever.yourdomain.com' to access the cookie.

New [setcookie] parameters (from WebDNA 8.5)

ParameterDescription
HttpOnly(optional) HttpOnly should be T, just like Secure. It adds "httponly" to the cookie, and treats everything else as a F.
MaxAgeMaxAge sets the time in seconds for when a cookie will be deleted ie MaxAge=30 will expire the cookie in 30 seconds. MaxAge is set in the cookie as "max-age"
RAWRAW lets you add anything you want to the cookie. You can use it conjunction with the other parameters or in place of them. You must still specify a name and value. Separate multiple raw parameters with a semi-colon and a space.
Example secure cookie code:
[setcookie name=cookieName&value=cookieValue&HttpOnly=T&RAW=domain=example.com; secure]
or
[setcookie name=cookieName&value=cookieValue&RAW=domain=example.com; secure; HttpOnly]