Art.Net Help Pages:Variable Substitutions...

The variable substitution program will process a standard html file, substituting certain keywords with special values, such as the time and date, a visitor count, a random number, or the contents of another file. Please do not abuse this program by using it on all your pages, as it uses more system resources than ordinary html files do.

To use these features, take a standard html file and insert any of the system variable names where you would like their values to appear. The variable names must be surrounded by curly braces like {this}, with no extra spaces inside. Then, just reference your html page as below, replacing account/filename with the name of your account and html file:

http://www.art.net/cgi-bin/var/account/filename

However, if you want to use the var program to display variables on your default home page, you will also need to use our redirect feature to cause the var program to be run on your home page.

If your html file using variables contains links to other files in your directory, they will need to be specified as absolute links instead of relative links. So if you normally have an HREF or IMG SRC link to "file.html" it will need to be changed to "http://www.art.net/account/file.html".

The variables that are available are listed below.
Here is an example using all the variables listed below (HTML code and the resulting output).

COUNT:filename

The COUNT variable is used to count visitors to a page. It must be followed by a colon and the name of a file to store the count in. When the COUNT variable is seen, the value currently in the file listed will be incremented, the value will be displayed, and the file will be updated. If the file doesn't exist it will be created automatically. The filename is relative to your top-level directory, so if you want the count file in a subdirectory it would be referenced like {COUNT:subdir/filename}.

FILESIZE@filename [:format]

The FILESIZE variable returns the size in bytes of the named file. The filename is relative to your top-level directory. The filename can optionally be followed by a colon and a single formatting option character, one of:

For example, if the file big.gif in your images directory was 1,234,567 bytes long, then {FILESIZE@images/big.gif:a} would display 1.23M.

HTTP_REFERER

This variable contains the URL that was used to link to the current page (if any). In most cases this will be one of your own pages that called the cgi-bin/var program, so it won't be very useful.

HTTP_USER_AGENT

This variable contains a description of the client system (browser) being used to access the web page. It may describe the kind of hardware and software a user is viewing your pages with.

INCLUDE:filename

INCLUDE will insert the contents of another file into your html file. The filename is specified relative to your main directory. So using {INCLUDE:subdir/filename} would insert the file filename from a subdirectory named subdir. One thing INCLUDE can be used for is to display your visitor counter without incrementing it, by using the same filename specified in a {COUNT:filename} variable as described elsewhere on this page.

RANDOM:min-max

The RANDOM variable returns a random number between the min and max specified. For example, using {RANDOM:10-99} would return a random number between 10 and 99. This variable could be used in a IMG SRC or HREF statement to pick a random file or gif to display. An html page might have a line like: <IMG SRC="pix{RANDOM:1-3}.gif">. The would randomly load a gif from file pix1.gif, pix2.gif or pix3.gif.

RANDOMINCLUDE:filename:min-max

RANDOMINCLUDE combines the function of the RANDOM and INCLUDE variables, so that you can have a random file included in your page. The filename should have a "%d" somewhere within it, which will be replaced by the random number to create a random filename to include. For example, {RANDOMINCLUDE:file%d.txt:1-5} would pick a random file from those named file1.txt through file5.txt.

REMHOST

REMHOST is set to the name of the remote host (or its address if the name is unknown) that accessed the page.

REMADDR

REMADDR is set to the IP address of the remote host that accessed the page.

TIMESTAMP [+/-offset] [@filename] [:format]

UCTIMESTAMP [+/-offset] [@filename] [:format]

The TIMESTAMP and UCTIMESTAMP variables return the current date or time, optionally offset by some number of hours. They can also return the last-modified date and time of a file instead of the current time.

TIMESTAMP is set to the current time and date in the following format:

YYYYMMDD HHMMSS

TIMESTAMP can also be optionally followed by a + or - and an offset in hours. This can be used to adjust the current time from US/Pacific time to your own timezone. For example, using {TIMESTAMP+3} would give you US/EastCoast time. The UCTIMESTAMP variable uses Universal Coordinated Time as its base instead of US/Pacific time.

TIMESTAMP (and offset) can also be optionally followed by an at-sign (@) and a file name, to use the last-modified date/time of the file instead of the current date/time. The filename is relative to your top-level directory.

TIMESTAMP (and offset and filename) can also be optionally followed by a colon and then a formatting specification string. The formatting string is copied character-by-character, except for some special codes which allow certain things to be inserted into the string. For example, using

{TIMESTAMP:%a, %d-%b-%y %r}
would format the output like this:
Sat, 15-Apr-95 11:29:31 PM

  and the same time with the offset option:

{TIMESTAMP+3:%a, %d-%b-%y %r}
would format the output like this:
Sat, 16-Apr-95 02:29:31 AM

{TIMESTAMP@web/index.html:%B %d, %Y}
would output the date you last modified the file index.html in
your subdirectory called web.  It would be formatted like:
August 22, 1995
The TIMESTAMP formatting options are defined in the huge list below:
     %A    is replaced by the full weekday name.

     %a    is replaced by the abbreviated weekday name, where the abbreviation
           is the first three characters.

     %B    is replaced by the full month name.

     %b or %h
           is replaced by the abbreviated month name, where the abbreviation
           is the first three characters.

     %c    is equivalent to ``%m/%d/%y''.

     %D    is replaced by the date in the format ```mm/dd/yy'''.

     %d    is replaced by the day of the month as a decimal number (01-31).

     %e    is replaced by the day of month as a decimal number (1-31); single
           digits are preceded by a blank.

     %H    is replaced by the hour (24-hour clock) as a decimal number
           (00-23).

     %I    is replaced by the hour (12-hour clock) as a decimal number
           (01-12).

     %j    is replaced by the day of the year as a decimal number (001-366).

     %k    is replaced by the hour (24-hour clock) as a decimal number (0-23);
           single digits are preceded by a blank.

     %l    is replaced by the hour (12-hour clock) as a decimal number (1-12);
           single digits are preceded by a blank.

     %M    is replaced by the minute as a decimal number (00-59).
     %m    is replaced by the month as a decimal number (01-12).

     %n    is replaced by a newline.

     %p    is replaced by either ``AM'' or ``PM'' as appropriate.

     %R    is equivalent to ``%H:%M''

     %r    is equivalent to ``%I:%M:%S %p''.

     %t    is replaced by a tab.

     %S    is replaced by the second as a decimal number (00-60).

     %s    is replaced by the number of seconds since the Epoch, UCT.

     %T or %X
           is equivalent to ``%H:%M:%S''.

     %U    is replaced by the week number of the year (Sunday as the first day
           of the week) as a decimal number (00-53).

     %W    is replaced by the week number of the year (Monday as the first day
           of the week) as a decimal number (00-53).

     %w    is replaced by the weekday (Sunday as the first day of the week) as
           a decimal number (0-6).

     %x    is equivalent to ``%m/%d/%y %H:%M:%S''.

     %Y    is replaced by the year with century as a decimal number.

     %y    is replaced by the year without century as a decimal number (00-99).

     %Z    is replaced by the time zone name.

     %%    is replaced by `%'.

Return to the Help Pages...