home *** CD-ROM | disk | FTP | other *** search
- #!/usr/bin/perl
-
- # This example demonstrates how to use environment variables in Perl CGI scripts
- # Copyright (c) 2000 Alexander Dzyubenko, DzSoft Ltd.
- # All rights reserved.
- # May be distributed only as a part of DzSoft Perl Editor, http://www.dzsoft.com
-
- # Send the MIME HTTP header
- print "Content-type: text/html\n\n"; # \n means the line break, send two
- # line breaks after the HTTP header
-
- print "<html>\n";
-
- print "<head>\n";
- print "<title>Environment Variables Demo</title>\n";
- print "</head>\n";
-
- print "<style>\n"; # Stylesheet. Not required,
- print " {font-family : arial}\n"; # but helps to control the
- print " a {text-decoration: none}\n"; # page style. To find out
- print " a:hover {text-decoration: underline}\n"; # more about CSS, search the
- print "</style>\n"; # web for "CSS Tutorial"
-
- print "<body bgcolor=\"#495578\" \n"; # Full body tag with DzSoft colors.
- print " text=\"#FFFFCC\" \n"; # Note that if you need to print
- print " link=\"#FFFF00\" \n"; # " character, write \" instead in
- print " vlink=\"#FFFFCC\" \n"; # the scriot source. Quick Insert ->
- print " alink=\"#FFFFFF\"> \n"; # Print Function in DzSoft Perl Editor
- # does this automatically.
-
- print "<p align=\"center\"><big>Environment Variables</big></p>\n";
- print "<pre>\n";
-
- print "Request method: <b>$ENV{'REQUEST_METHOD'}</b>\n"; # Request method.
- # When you run the
- # script from DzSoft
- # Perl Editor it will
- # be always GET.
-
- print "Script name: <b>$ENV{'SCRIPT_NAME'}</b>\n"; # Server path to the script
-
- print "Server software: <b>$ENV{'SERVER_SOFTWARE'}</b>\n"; # Server software
- # (name/version)
-
- print "Gateway interface: <b>$ENV{'GATEWAY_INTERFACE'}</b>\n"; # Gateway
- # interface.
- # DzSoft Perl
- # Editor emulates
- # CGI gateway
- # interface.
-
- print "Query string: <b>$ENV{'QUERY_STRING'}</b>\n"; # Query string. Part of URL
- # (everything after "?").
- # In DzSoft Perl Editor you
- # can edit query string
- # in Environment Variables
- # dialog box.
-
- # NOTE: The following variables present in DzSoft Perl Editor only if they are
- # set in "Environment Variables Editor" dialog box. To ensure that they
- # are, click <reset to defaults> in Environment Variables Editor.
-
- print "HTTP user agent: <b>$ENV{'HTTP_USER_AGENT'}</b>\n"; # HTTP user agent.
- # Shows web browser
- # used by visitor.
-
- print "HTTP referer: <b>$ENV{'HTTP_REFERER'}</b>\n"; # HTTP referer. URL of the
- # web page from which the
- # visitor came.
-
- print "Remote host: <b>$ENV{'REMOTE_HOST'}</b>\n"; # Visitor's host name.
-
- print "Remote IP: <b>$ENV{'REMOTE_ADDR'}</b>\n"; # Visitor's IP address.
-
- print "Server name: <b>$ENV{'SERVER_NAME'}</b>\n"; # Server name, for example
- # www.dzsoft.com
-
- print "</pre>\n";
- print "</body>\n";
- print "</html>\n";
-