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 #config08:01:23 AM
DATE_LOCAL Current local date/time, formatted using #config04:01:23 AM
DOCUMENT_NAME Name of current documentsecho.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_COOKIEDocument Cookie, if any(none)
HTTP_REFERER Where did the viewer come from?(none)
HTTP_USER_AGENTBrowser Name etc.CCBot/1.0 (+http://www.commoncrawl.org/bot.html)
QUERY_STRINGRaw query sent from browser
QUERY_STRING_UNESCAPEDUnescaped query sent from browser(none)
REMOTE_ADDR The viewer's IP address38.107.191.80
REMOTE_HOSTHost name of remote client(none)
REQUEST_METHOD GET or POST?GET
SCRIPT_NAMEName of current script/en/ssi/secho.shtml
SERVER_NAME Host name. e.g. explainth.atwww.explainth.at
SERVER_PORT Typically, Port 8080
SERVER_PROTOCOL Typically, HTTP/1.1HTTP/1.1
SERVER_SOFTWARE e.g. Apache WebserverApache/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>
Jump To...

Colophon