Miva Merchant: E-commerce Solutions to Grow Online
spacer gif

11. Using Cookies


Each time a cookie-enabled browser accesses a Miva Script document, Miva Script creates a 32-character cookie, with the name htscallerid, that is unique to that browser and URL. The cookie lasts for one year after being set. Cookies can be turned off in the Miva Merchant Empresa configuration file; contact your server administrator. The content of the cookie are available in the callerid system variable.

If you want to create your own cookies, you can use the <META> tag (Miva Script does not let you modify the HTTP headers sent with your document). For example:

<META HTTP-EQUIV="Set-Cookie"
CONTENT="id=MyCo; expires=Thu, 26 Nov 1998 16:00:00 GMT;
domain=.sq.com path=/; secure">

The HTTP-EQUIV attribute must have the value Set-Cookie, to indicate that the <META> is simulating the Set-Cookie HTTP header. CONTENT specifies the content of the cookie. This can have five parts, separated by semi-colons (;).

A name/value pair (id=MyCo in this example) is mandatory. The name and value are arbitrary strings, but cannot contain a comma, semi-colon, or space.

You can optionally specify an expiry date. The date can be in one of these forms, of which the first is preferred:

You can optionally specify to which domain the cookie can be sent, and to which URLs (paths) within that domain.

You can optionally specify that a secure protocol be used to send the cookie.

All of the cookies for this document are available in the http_cookie system variable.