Monday, October 29, 2007

Php environment variable

Clinet's Information
====================

(1) getenv from PHP
---------------

* REMOTEHOST

The hostname making the request. If the server does not have this information, it should set REMOTE_ADDR and leave this unset.


* REMOTE_ADDR

The IP address of the remote host making the request.

* REMOTE_USER

If the server supports user authentication, and the script is protected, this is the username they have authenticated as.


* REMOTE_IDENT

If the HTTP server supports RFC 931 identification, then this variable will be set to the remote user name retrieved from the server. Usage of this variable should be limited to logging only.

* CONTENT_TYPE

For queries which have attached information, such as HTTP POST and PUT, this is the content type of the data.

* CONTENT_LENGTH

The length of the said content as given by the client.

* PATH_INFO

The extra path information, as given by the client. In other words, scripts can be accessed by their virtual pathname, followed by extra information at the end of this path. The extra information is sent as PATH_INFO. This information should be decoded by the server if it comes from a URL before it is passed to the CGI script.


* PATH_TRANSLATED

The server provides a translated version of PATH_INFO, which takes the path and does any virtual-to-physical mapping to it.


* HTTP_ACCEPT
The MIME types which the client will accept, as given by HTTP headers. Other protocols may need to get this information from elsewhere. Each item in this list should be separated by commas as per the HTTP spec.
Format: type/subtype, type/subtype


* HTTP_USER_AGENT

The browser the client is using to send the request. General format: software/version library/version


* getmyuid ( void)

Returns the user ID of the current script

******************************************************************************************************

2) Javascript
==========


* getTimezoneOffset method

returns an integer value representing the number of minutes between the time on the current machine and UTC. These values are appropriate to the computer the script is executed on. If it is called from a server script, the return value is appropriate to the server. If it is called from a client script, the return value is appropriate to the client.
This number will be positive if you are behind UTC (e.g., Pacific Daylight Time), and negative if you are ahead of UTC (e.g., Japan).

For example, suppose a server in New York City is contacted by a client in Los Angeles on December 1. getTimezoneOffset returns 480 if executed on the client, or 300 if executed on the server.

The following example illustrates the use of the getTimezoneOffset method:

function TZDemo()
{
var d, tz, s = "The current local time is ";
d = new Date();
tz = d.getTimezoneOffset();
if (tz < 0)
s += tz / 60 + " hours before GMT";
else if (tz == 0)
s += "GMT";
else
s += tz / 60 + " hours after GMT";
return(s);
}

No comments: