BigNoseBird.Com- Home Small Logo
The 508 Compliant Guide to 
       Big Nose Bird
BACK

The ECHO Directive:
Displaying the Environment in
Server Side Includes!

The ECHO directive allows you to bring it information from the environment and show it on your pages. This can allow you to show people when a page was last updated, or even to make a real back button!

Now here is something that you have probably seen on quite a few pages, the date and time. Check your watch just to make sure I'm not trying to pull one over on you. I just have to hope my server has the right system time!

The Local Time is Saturday, 25-Mar-2017 01:50:37 EDT

The following little snippet of source code is all you need to add this feature to your page:

<B> The Local Time is
<!--#echo var="DATE_LOCAL" -->
</B>

Further down this page you can find all of the formatting commands you can use with date variables.

Making a Real Back Button
Here is a cute server side include trick, a back button that actually takes you back to where you came from.

The Real BACK BUTTON
How did the page know where you came from. Remember, we have our arsenal of server environment information and one tidbit at our disposal is HTTP_REFERER. This is the URL that brought you to this page. Here is the source code for this trick:
<A HREF="<!--#echo var="HTTP_REFERER"-->">BACK BUTTON</A>
If you came to this page directly, such as from a link in your e-mail or you hand-typed it in, then (none) would be the value for HTTP_REFERER.

Here are the other values you can let var= are:

AUTH_TYPE client authorization method if any
CONTENT_LENGTH size of input posted from client
CONTENT_TYPE MIME type of content
DATE_GMT The current GMT (greenwich, UK) can be formatted using #config
DATE_LOCAL current time/date, can be formatted using #config
DOCUMENT_NAME document name that was requested
DOCUMENT_URI URL of the document
LAST_MODIFIED document modified date, can be formatted using #config
PAGE_COUNT number of accesses to current document since server was brought on line
HTTP_REFERER URL of the document the client came from
REMOTE_ADDR Numeric IP address of the client
REMOTE_HOST domain name of the client (DNS option must be active on server)
REMOTE_USER ID of user, rarely ever found
REQUEST_METHOD HTTP method: GET OR POST
SERVER_NAME server hostname (i.e., www.bignosebird.com)
SERVER_PORT the port used by httpd (usually 80)
SERVER_PROTOCOL Which version of Httpd compliance
SERVER_SOFTWARE The name of the server software, i.e., apache 1.2.5
TOTAL_HITS total pages served by server since brought on line

You can control the exact appearence of your time and date information by setting the timefmt using a config such as the one below. Just include this config before the actual include that calls the date.
<!--#config timefmt="%m/%d/%y" -->

Will give you a date such as 02/17/97

The complete list of unix style date format codes follow:

CODEPURPOSE OF CODE
%a abbreviated weekday name
%A full weekday name
%b abbreviated month name
%B full month name
%c locale's appropriate date and time representation
%C default date and time format
%d day of month - 01 to 31
%D date as %m/%d/%y
%e day of month - 1 to 31 (single digits are preceded by a blank)
%h abbreviated month name (alias for %b)
%H hour - 00 to 23
%I hour - 01 to 12
%j day of year - 001 to 366
%m month of year - 01 to 12
%M minute - 00 to 59
%n insert a newline character
%p string containing AM or PM
%r time as %I:%M:%S %p
%R time as %H:%M
%S second - 00 to 61
%t insert a tab character
%T time as %H:%M:%S
%U week number of year (Sunday is the first day of the week) - 00 to 53
%w day of week - Sunday=0
%W week number of year (Monday is the first day of the week) - 00 to 53
%x Country-specific date format
%X Country-specific time format
%y year within century - 00 to 99
%Y year as CCYY (4 digits)
%Z timezone name

 


Find or Give Help on the BBS
 
Home Top E-Mail
If it looks great, it's by Christine
Some Fine Print
© 1997-2003 BigNoseBird.Com®, Inc. All rights reserved. All other trademarks are the sole property of their respective owners. The products that we recommend are only ones that we use. We have no relationship with any of the authors or their companies. We cannot assume responsibility for their ultimate performance or lack of same. We also cannot assume responsibility for either any programs provided here, or for any advice that is given since we have no control over what happens after our code or words leave this site. Always use prudent judgment in implementing any program- and always make a backup first! For further information, please read our Privacy Statement. We can be contacted at webmaster@bignosebird.com.


<reallybig.com>
Web Builder Network Portal
Advertise
on the
Reallybig.com
Network
BigNoseBird Newsletter
Subscribe
Un-Subscribe


Sign up today to receive our low volume newsletter. Tips, tricks, news, and whatever else crosses our minds.
Back Issues
Privacy Statement