Logo Your Web Hosting Solution
Line
SSI Tutorial
Introduction
Using Variables
Including Files
Execute Scripts
Validate SSI
Tutorials Index
Home Page
SSI Tutorial - Environment Variables

Variables can be used to display information about people viewing a web page, the page itself and more.

To view a full list of available environment variables, add the below lines to a web page, upload it to your hosting account and view it in your web browser.

<PRE>
<!--#printenv -->
</PRE>

1. The Web Page

With SSI, environment variables can be used to show some information about the web page being shown.

<!--#echo var="DOCUMENT_NAME" -->
<!--#echo var="LAST_MODIFIED" -->

The first line simply shows the filename of the web page. The second shows when it was last modified.

Example:

    Filename : ssi_variables.html
    Modified : Tuesday, 14-Apr-2015 12:47:45 CDT
2. Current Time And Date

You can use SSI to include the current time and date in web pages. Both local server time or GMT can be used.

<!--#echo var="DATE_LOCAL" -->
<!--#echo var="DATE_GMT" -->

Example:

    Server Time : Saturday, 20-Apr-2024 08:29:27 CDT
    GMT Time : Saturday, 20-Apr-2024 13:29:27 GMT
3. The Visitor

SSI can be used to display the IP address of a person viewing your web pages.

<!--#echo var="REMOTE_ADDR" -->

Remote host information can be shown (if available).

<!--#echo var="REMOTE_HOST" -->

You can even display the browser version of the visitor.

<!--#echo var="HTTP_USER_AGENT" -->

Example:

    Your IP address is : 18.225.117.183
    Your remote hostname is : (none)
    Your browser : Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
These are quick and easy SSI examples, many other variables can be used with Server Side Includes.

Top Of Page 
Line
Copyright© 1996 - 2024 Clockwatchers, Inc.