Home and Small
Business Bookstore
netqp.com domain names, Web hosting, Web sites, and email ... very cheap

Front Page
Catalog
Store Directory
Mailing Lists
Harry Potter
Electronic Gadgets

   search this site

  Front Page 
  Bookstore Catalog 
  Internet Marketing 
  Webmaster Center 
  Internet Software 
  Perl Books 
  JavaScript Books 
  Electronics 
  Mailing Lists 
  Real Estate Secrets 
  Dating Personals 
  Pardon Service 
  Contact Info 
  Terms & Conditions 
  Order Information 
  Store Directory 
 
 
 
 
 



Only You Personals Services

   Server Side Includes Examples  

The following is just a sampling in the use of server side includes. This sampling demonstrates the use of CGI Environment Variables using the #echo Server Side Includes.

In order to pass data about the information request from the server to the script, the server uses command line arguments as well as environment variables. These environment variables are set when the server executes the gateway program.

Some server configurations require the file containing SSI commands to end with .shtml whereas others do not. You should check with your system administrator concerning whether they support SSI. In many cases you can put the following in your .htaccess document which resides in your root directory:

AddHandler server-parsed .html
AddType text/html shtml

  1. This variable is the complete local directory path of the current document.
    <!--#echo var="DOCUMENT_NAME" -->
    : ssi.html

  2. This web page file size.
    <!--#config sizefmt="bytes" --><!--#fsize file="ssi.html" -->
    : [an error occurred while processing this directive]
    <!--#config sizefmt="abbrev" --><!--#fsize file="ssi.html" -->
    : [an error occurred while processing this directive]

  3. This variable is the local path of the current document referenced to the base directory of the web space.
    <!--#echo var="DOCUMENT_URI" -->
    : /books/ssi.html

  4. This variable is the unescaped query string sent by the client browser with all shell-special characters replaced with local system equivalents.
    <!--#echo var="QUERY_STRING_UNESCAPED" -->
    : (none)

  5. This variable is the date and time of the last modification of the current document.
    <!--#echo var="LAST_MODIFIED" -->
    : Sunday, 30-May-2004 00:01:03 CDT

  6. This variable is the IP address of the remote client browser.
    <!--#echo var="REMOTE_ADDR" -->
    : 38.107.179.207

  7. This variable is the raw query string sent from the remote browser.
    <!--#echo var="QUERY_STRING" -->
    :

  8. This variable is the name of the HTTP server software.
    <!--#echo var="SERVER_SOFTWARE" -->
    : Apache

  9. This variable is the local computer name of the HTTP server.
    <!--#echo var="SERVER_NAME" -->
    : www.microcaddesign.com

  10. This variable is the name/version of the Common Gateway Interface served on this HTTP server.
    <!--#echo var="GATEWAY_INTERFACE" -->
    : CGI/1.1

  11. This variable is the name/version of HTTP served on this HTTP server
    <!--#echo var="SERVER_PROTOCOL" -->
    : HTTP/1.1

  12. This variable is the IP port the HTTP server is answering on.
    <!--#echo var="SERVER_PORT" -->
    : 80

  13. This variable is the method by which the current document was requested.
    <!--#echo var="REQUEST_METHOD" -->
    : GET

  14. This variable is the extra path info that is sent.
    <!--#echo var="PATH_INFO" -->
    : (none)

  15. This variable is the 'PATH_INFO' with all shell-special characters replaced with local system equivalents.
    <!--#echo var="PATH_TRANSLATED" -->
    : (none)

  16. This variable is the virtual path of the script being executed.
    <!--#echo var="SCRIPT_NAME" -->
    : /books/ssi.html

  17. This variable is the host name of the remote client.
    <!--#echo var="REMOTE_HOST" -->
    : (none)

  18. This variable is the authentication method used to validate the remote client.
    <!--#echo var="AUTH_TYPE" -->
    : (none)

  19. This variable is the user name used to validate authentication from the remote client.
    <!--#echo var="REMOTE_USER" -->
    : (none)

  20. This variable is the remote user name if supporting RFC931 identification.
    <!--#echo var="REMOTE_IDENT" -->
    : (none)

  21. This variable is the content type of the attached information in the case of a POST or PUT.
    <!--#echo var="CONTENT_TYPE" -->
    : (none)

  22. This variable is the length of the attached information in the case of a POST or PUT.
    <!--#echo var="CONTENT_LENGTH" -->
    : (none)

  23. This variable is a comma separated list of mime types that are accepted by the remote browser.
    <!--#echo var="HTTP_ACCEPT" -->
    : text/html,application/xhtml+xml,text/xml;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5

  24. This variable is the name of the remote client browser software.
    <!--#echo var="HTTP_USER_AGENT" -->
    : CCBot/1.0 (+http://www.commoncrawl.org/bot.html)

  25. This variable is the URL of the HTML document which referred the remote client to this document.
    <!--#echo var="HTTP_REFERER" -->
    : (none)

  26. This variable is the name (most likely the-mail address) of the remote client user.
    <!--#echo var="FROM" -->
    : (none)

  27. This variable is the name of the proxy server through which this document is being processed.
    <!--#echo var="FORWARDED" -->
    : (none)

  28. This variable lists the human languages that are acceptable to the remote client.
    <!--#echo var="ACCEPT_LANGUGE" -->
    : (none)

  29. This variable contains the cookie sent by the remote client.
    <!--#echo var="HTTP_COOKIE" -->
    : (none)

  30. Number of accesses to current document since server was brought on line.
    <!--#echo var="PAGE_COUNT" -->
    : (none)

  31. Total pages served by server since brought on line.
    <!--#echo var="TOTAL_HITS" -->
    : (none)

  32. Executes a given shell command or CGI script. It must be activated to be used.
    <!--#exec cmd="ls -l" -->
    :

Data and time modification.
  1. This variable is current local date and time.
    <!--#echo var="DATE_LOCAL" -->
    : Monday, 06-Feb-2012 08:14:36 CST

  2. This variable is the current Greenwich Mean date and time.
    <!--#echo var="DATE_GMT" -->
    : Monday, 06-Feb-2012 14:14:36 GMT

  3. Modified data and time.
    <!--#config timefmt="%a, %d-%h-%Y at %I:%M:%S%p %Z" --><!--#echo var="DATE_LOCAL" -->
    : Mon, 06-Feb-2012 at 08:14:36AM CST

  4. Modified data and time.
    <!--#config timefmt="%A, %B %e, %Y" --><!--#echo var="DATE_LOCAL" -->
    : Monday, February 6, 2012

  5. Modified data and time.
    <!--#config timefmt="%D" --><!--#echo var="DATE_LOCAL" -->
    : 02/06/12

  6. Modified data and time.
    <!--#config timefmt="%r" --><!--#echo var="DATE_LOCAL" -->
    : 08:14:36 AM

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/06/12

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

For detailed SSI information, see:
NCSA HTTPd Server Side Includes
BigNoseBird.Com
Apache Tutorial

I don't know where you came from
<!--#if expr="${HTTP_REFERER} =/http/" -->
You came from:
<!--#echo var="HTTP_REFERER" -->

<!--#else -->
I don't know where you came from
<!--#endif -->

Return to HSBB front page
<!--#if expr="${HTTP_REFERER} =/microcaddesign/" -->
Return to <A HREF="<!--#echo var="HTTP_REFERER" -->">previous page</A>
<!--#else -->
Return to <A HREF="http://www.microcaddesign.com/books/">HSBB front page</A>
<!--#endif -->



Learn to Program with Visual Basic
Learn to Program with Visual Basic 6 by John Smiley
300 Incredible Things to Learn on the Internet
300 Incredible Things to Learn on the Internet by 300 Incredible Com Llc Staff (Editor), Robyn Freedman Spizman, Ken Leebow, Randy Glasbergen (Illustrator)
Teach Yourself Visually Computers
Teach Yourself Visually Computers (Teach Yourself Visually Computers) by Ruth Maran
Computers Simplified
Computers Simplified: Simply the Easiest Way to Learn by Ruth Maran, Paul Whitehead, Marangraphics Inc
HTML: A Beginner's Guide
HTML: A Beginner's Guide by Wendy Willard
PC Upgrade and Repair Simplified
PC Upgrade and Repair Simplified® by Paul Whitehead
Programming Perl
Programming Perl by Larry Wall, Tom Christiansen, Randal L. Schwartz, Stephen Potter
Learning Perl
Learning Perl by Randal L. Schwartz, Tom Christiansen, Larry Wall
Advanced Perl Programming
Advanced Perl Programming (Nutshell Handbook) by Sriram Srinivasan
Writing Apache Modules with Perl
Writing Apache Modules with Perl and C (Nutshell Series) by Lincoln Stein, Doug MacEachern, Linda Mui (Editor)
Powerful Techniques for Per
Mastering Regular Expressions : Powerful Techniques for Perl and Other Tools (Nutshell Handbook) by Jeffrey E. Friedl (Editor), Andy Oram
     

     
Copyright © 1996-2004 Home and Small Business Bookstore.
All rights reserved.
     

     

Fatal error: Call to undefined function virtual() in /home/microca/public_html/books/includes_ssi/footer.php on line 5