SSI:The Echo Directive
As the name implies this directive is used to echo information - i.e. output it to the HTML document being sent back to the viewer. The general format for this directive is <!--#echo var="value" -->. When the value being echoed is a date-time string, its format is determined by the <!--#config timefmt="value" --> that immediately precedes it. On Apache servers the following values can be used
| Value | Meaning | Output |
|---|---|---|
| CONTENT_LENGTH | Size of input from client | (none) bytes. |
| CONTENT_TYPE | MIME content type | (none) |
| DATE_GMT | Current GMT, formatted using #config | 08:01:23 AM |
| DATE_LOCAL | Current local date/time, formatted using #config | 04:01:23 AM |
| DOCUMENT_NAME | Name of current document | secho.shtml |
| DOCUMENT_URL | Name & location of current document | /en/ssi/secho.shtml |
| LAST_MODIFIED | When was the current document modified? | 02:22:38 AM |
| HTTP_COOKIE | Document Cookie, if any | (none) |
| HTTP_REFERER | Where did the viewer come from? | (none) |
| HTTP_USER_AGENT | Browser Name etc. | CCBot/1.0 (+http://www.commoncrawl.org/bot.html) |
| QUERY_STRING | Raw query sent from browser | |
| QUERY_STRING_UNESCAPED | Unescaped query sent from browser | (none) |
| REMOTE_ADDR | The viewer's IP address | 38.107.191.80 |
| REMOTE_HOST | Host name of remote client | (none) |
| REQUEST_METHOD | GET or POST? | GET |
| SCRIPT_NAME | Name of current script | /en/ssi/secho.shtml |
| SERVER_NAME | Host name. e.g. explainth.at | www.explainth.at |
| SERVER_PORT | Typically, Port 80 | 80 |
| SERVER_PROTOCOL | Typically, HTTP/1.1 | HTTP/1.1 |
| SERVER_SOFTWARE | e.g. Apache Webserver | Apache/2.2.13 (CentOS) |
Web browsers go to great lengths to protect the security and privacy of the viewer. Consequently, there is no pure client-side JavaScript method for establishing the viewer's IP address. This limitation can be easily overcome by placing the following code in your HTML file.
<script type="text/javascript">
var uip='<!--#echo var = "REMOTE_ADDR" -->';
</script>