Previous: Templates| Zot-Dispatch 2.0| Next: ZD-Owner

Zot-Dispatch: CGI Environment Variables


Most servers, will provide to a CGI program various information that might be useful to include in the response of a form. This information is placed into environment variables accessible by CGI programs. An example of what type of information can be gained through the environment variables includes what browser the user is currently using (HTTP_USER_AGENT), what document referred them to the document they are requesting (HTTP_REFERER), and what host the user is requesting from (REMOTE_HOST). While there is no one single list that contains all of the environment variables that are set, a somewhat complete list exists in the CGI documentation at NCSA.

This CGI will show you what environment variables are set when you access our server.


If you would like to have some of the environment variables included with your response when using Zot-Dispatch you need only do one thing. For each environment variable you would like returned, include a hidden input element named ZD-Environment whose value is the name of the environment variable you would like returned.

For Example,

  <INPUT TYPE=hidden NAME=ZD-Environment VALUE="REMOTE_HOST">
will notify Zot-Dispatch to get the value of the REMOTE_HOST environment variable. Pressing the See Evironment Variable button below will submit the following form which returns the value of the REMOTE_HOST environment variable that is set when Zot-Dispatch is run. Use the "back" command to return to this document if your client has one.
    <FORM METHOD=POST ACTION="http://www.oac.uci.edu/cgi-bin/zd-2.0.cgi">
        <INPUT TYPE=hidden NAME=ZD-Method VALUE="ZD-Reflect;;">
        <INPUT TYPE=hidden NAME=ZD-Environment VALUE="REMOTE_HOST">
        <INPUT TYPE=submit VALUE="See Environment Variable">
    </FORM>

Including Environment Variable within Templates
If you would like the value of an environment variable that you've specified via a ZD-Environment input element to be included in a template, rather than place $ZD-Environment# within your template, use $Environment-Variable-Name# where Environment-Variable-Name is the name of an environment variable that has been specified within a ZD-Environment input element.

Example:
Let's say you want to reflect to the user, a document which tells them which host they are accessing from. The form below shows an example of how you could do such a thing.

    <FORM METHOD=POST ACTION="http://www.oac.uci.edu/cgi-bin/zd-2.0.cgi">
        <INPUT TYPE=hidden NAME=ZD-Environment VALUE="REMOTE_HOST">
        <INPUT TYPE=hidden NAME=ZD-Method VALUE="ZD-Reflect;;body:&lt;HTML&gt;
&lt;HEAD&gt;
&lt;TITLE&gt;Zot-Dispatch: Environment Variable Example&lt;/TITLE&gt;
&lt;/HEAD&gt;

&lt;BODY&gt;
&lt;H1&gt;REMOTE_HOST Example&lt;/H1&gt;

You have connected from the host $REMOTE_HOST#.

&lt;HR&gt;

&lt;A HREF=&quot;http://www.oac.uci.edu/X/W6/zd/2.0/ZD-2.0-Environment.html#REMOTE&quot;&gt;
Return to the Environment Variable Document&lt;/A&gt;
&lt;/BODY&gt;
&lt;/HTML&gt;
">
        <INPUT TYPE=submit VALUE="See Your Hostname">
        </FORM>
Notice that REMOTE_HOST is specified in a ZD-Environment input element and that it is substituted into the template using $REMOTE_HOST#. Go ahead and try it out.

Previous: Templates| Zot-Dispatch 2.0| Next: ZD-Owner
Zot-Dispatch 2.0
Written by Leonard Megliola III (lmegliol@uci.edu)
Last Revised 02 January 1996