CGI Environment Variables
- Variable: Output for your session on this system
- A brief description of the variable.
- The authentication method used to validate a user.
- The length of the data (in byes or the number of characters) passed to the CGI program through standard input.
- The MIME type of the query data, such as "text/html".
- Current date and time in the local time zone.
- Current date and time in GMT.
- The current file.
- The directory from which Web documents are served.
- Virtual path to the file.
- The revision of the Common Gateway Interface that the server uses.
- A list of the MIME types that the client can accept.
- The email address of the user making the request. Most browsers do not support this variable.
- The URL of the document that the client points to before accessing the CGI program.
- The browser the client is using to issue the request.
- Last modification date and time for current file.
- Extra path information passed to a CGI program.
- The translated version of the path given by the variable PATH_INFO.
- The query information passed to the program. It is appended to the URL with a "?".
- Undecoded query string with all shell metacharacters escaped with "\".
- The method with which the information request was issued.
- The remote IP address of the user making the reqest.
- The remote hostname of the user making the request.
- The user making the request. This variable will only be set if NCSA IdentityCheck flag is enabled, and the
client machine supports the RFC 931 identification scheme (identd).
- The authenticated name of the user.
- The virtual path (e.g., /cgi-bin/program.pl) of the script being executed.
- The server's hostname or IP address.
- The port number of the host on which the server is running.
- The name and revision of the information protocol the request came in with.
- The name and version of the server software that is answering the client request.
Suppose we want to attempt to print out the email address of the current user. The code would look something like:
Your email address is <!--#echo var="REMOTE_IDENT"-->@<!--#echo var="REMOTE_HOST"-->.
That line will print out:
Your email address is @.
Most of the information in this table came from CGI Programming on the World Wide Web by Shishir Gundavaram.