System Variables#
System variables are automatically initialized when a Miva Script program begins execution. There are two types of system variables:
- Dynamic system variables: values are set each time they are used in an expression.
- Static system variables: values are set when the script begins execution. With the exception of
recno
, all other system variables are static. All HTTP environment variables are converted to static system variables.
Time Variables#
Time variables are not zero-padded; for example, if the time is 12:04, dyn_tm_min
returns 4
, not 04
. Use the padl()
function to perform padding, as needed.
All time-related variables (except for dyn_time_remaining
and globaltimeout
) have both static and dynamic versions: the dynamic variables start with the dyn_
prefix.
Dynamic | Static | Return value |
---|---|---|
dyn_time_t |
time_t |
Number of seconds since 1 Jan. 1970 (numeric) |
dyn_tm_hour |
tm_hour |
Hour in current day (numeric) |
dyn_tm_isdst |
tm_isdst |
Has the value true (1) if daylight time is in effect in this time zone (boolean) |
dyn_tm_mday |
tm_mday |
Day of the month (numeric) |
dyn_tm_min |
tm_min |
Minutes in current hour (numeric) |
dyn_stm_mon |
stm_mon |
Month of the year (string) |
dyn_tm_mon |
tm_mon |
Month of the year (numeric) |
dyn_tm_sec |
tm_sec |
Seconds in current minute (numeric) |
dyn_tm_usec |
tm_usec |
The current microsecond, relative to dyn_tm_sec or tm_sec (on Windows, updated in 50 ms increments) |
dyn_stm_wday |
stm_wday |
Day of the week (string) |
dyn_tm_wday |
tm_wday |
Day of the week (numeric) |
dyn_tm_yday |
tm_yday |
Day in year (numeric) |
dyn_tm_year |
tm_year |
Year (numeric) |
dyn_stm_zone |
stm_zone |
The time zone (string) |
— | globaltimeout |
Maximum total number of seconds that this script can execute. |
dyn_time_remaining |
— | Number of seconds before the current script will time out. |
CGI, HTTP, and Other Variables#
All available CGI environment variables and HTTP headers are automatically converted into static Miva Script system variables upon start-up. The availability of these variables depends on your server software and browser. For more information on environment variables and HTTP headers, consult a CGI reference and/or your server documentation.
Accessibility Codes#
Miva Script uses accessibility codes to indicate how each system variable is provided:
Origin:
- S: generated by Miva Merchant VM or Mia
- E: inherited from environment
- H: inherited from HTTP header
Platform:
- C: accessible with CGI version of Miva Merchant VM
- N: accessible with NSAPI version of Miva Merchant VM
- P: accessible with Miva Merchant Mia
For example, E: C,N
means the variable is inherited from the environment and is accessible in both CGI and NSAPI versions. Miva Script also allows site administrators to define custom system variables—check with your server admin for any additions.
System Variable Reference#
Variable | Return Value | Accessibility |
---|---|---|
apitype |
Platform: 'CGI' , 'NSAPI' , or 'Mia' (Miva Merchant Mia) |
S: C,N,P |
argN |
Nth argument on the URL; arg1 is always the program file name, arg2 the first argument after the file name, etc. |
S: C,N,P |
auth_type |
Authentication method used by the server | E: C,N |
callerid |
32-char cookie ID unique to browser and URL (if enabled); lasts one year | S: C,N,P |
content_length |
Length of any attached (POST) information | E: C |
content_type |
Type of data for POST | E: C |
documenturl |
URL of the running Miva Script program (includes argument separator + for NSAPI/Mia or ? for CGI) |
S: C,N,P |
gateway_interface |
Version of CGI used | E: C |
globaltimeout |
Maximum total number of seconds that this script can execute | S: C,N,P |
http_accept |
Comma-separated list of MIME types the browser will accept | H: C,N,P |
http_accept_charset |
Character sets preferred by the browser | H: C,N,P |
http_accept_language |
ISO codes for languages preferred by the browser | H: C,N,P |
http_connection |
Keep-alive string to preserve TCP connection | H: C,N,P |
http_cookie |
Contents of all cookies set for the document | H: C,N,P |
http_host |
Remote host name (usually same as server_name ) |
H: C,N,P |
http_pragma |
Mode client is running under | H: C,P |
http_referer |
URL of the document that led to the current request | H: C,P |
http_user_agent |
Browser name, platform, version, and library | H: C,N,P |
mivaversion |
Version of the Miva Script language preprocessor | S: C,N,P |
miva_defaultlanguage |
Current default language setting | — |
miva_language |
Current language setting | — |
miva_sslavailable |
Whether OpenSSL is available for use by <MvCALL> |
S: C,N,P |
nargs |
Number of arguments on the URL, including the program file name | S: C,N,P |
path_info |
Extra path info in the URL (directory path after the CGI program name) | E: C,N |
path_translated |
path_info , translated to a physical path by prepending the server document directory |
E: C |
process_id |
Currently running process number | S: C,N,P |
query_string |
Information passed after a URL ? via GET |
E: C |
remote_addr |
IP address of remote host | E: C,N,P |
remote_host |
Domain name of the remote host | E: C,N,P |
remote_ident |
Remote user name (RFC 931 identification) | E: C |
remote_user |
Authenticated user name (if supported) | E: C,N |
request_method |
GET , POST , or HEAD |
E: C,N,P |
request_uri |
Full URI path to the requested resource | E: C,N,P |
script_name |
Virtual path to CGI script (not mapped locally) | E: C |
server_hostname |
Name of the server | E: C,N |
server_name |
Same as server_hostname |
E: C,N,P |
server_port |
Port under which server is running | E: C,P |
server_port_secure |
Whether the port is secure (boolean) | E: C |
server_protocol |
Name and revision of protocol used | E: C,N,P |
server_software |
HTTP server and version number that processed the request | E: C,P |
server_url |
server_hostname in URL format |
E: C,N |
server_version |
Version of the server | E: C,N |
user_agent |
Same as http_user_agent |
H: N |