Table 6-1. Entries in $_SERVER
Element
|
Example
|
Description
|
---|
QUERY_STRING
|
category=kitchen&price=5
|
The part of the URL after the question mark where the URL parameters
live. The example query string shown is for the URL
http://www.example.com/catalog/store.php?category=kitchen&price=5.
|
PATH_INFO
|
/browse
|
Extra path information tacked onto the end of the URL after a slash.
This is a way to pass information to a script without using the query
string. The example PATH_INFO shown is for the URL
http://www.example.com/catalog/store.php/browse.
|
SERVER_NAME
|
www.example.com
|
The name of the web site on which the PHP interpreter is running. If
the web server hosts many different virtual domains, this is the name
of the particular virtual domain that is being accessed.
|
DOCUMENT_ROOT
|
/usr/local/htdocs
|
The directory on the web server computer that holds the documents
available on the web site. If the document root is
/usr/local/htdocs for the web site
http://www.example.com, then a request for
http://www.example.com/catalog/store.php
corresponds to the file
/usr/local/htdocs/catalog/store.php.
|
REMOTE_ADDR
|
175.56.28.3
|
The IP address of the user making the request to your web server.
|
REMOTE_HOST
|
pool0560.cvx.dialup.verizon.net
|
If your web server is configured to translate user IP addresses into
hostnames, this is the hostname of the user making the request to
your web server. Because this address-to-name translation is
relatively expensive (in terms of computational time), most web
servers do not do it.
|
HTTP_REFERER
|
http://directory.google.com/Top/Shopping/Clothing/
|
If someone clicked on a link to reach the current URL,
HTTP_REFERER contains the URL of the page that
contained the link. This value can be faked, so
don't use it as your sole criteria for giving access
to private web pages. It can, however, be useful for finding out
who's linking to you.
|
HTTP_USER_AGENT
|
Mozilla/4.0 (compatible; MSIE 6.0;
Windows NT 5.1)
|
The web browser that retrieved the page. The example value is the
signature of Internet Explorer 6.0 running on Windows XP. Like
HTTP_REFERER, this value can be faked, but is
useful for analysis.
|