Friday, October 04, 2002


TIP - Getting server information about your user - Using CGI you can get a lot of information about your user like their domain name and IP address which you can log in a database or display on screen. It is easy to do this with app servers like ColdFusion and ASP, but to do it in Javascript is less documented but it can be done.

Here is a simple example of getting the user's IP address and displaying that back into an alert box.

<script>
var ip = '';
alert("Your IP address is "+ip);
</script>

You will need to save the file as .shtm or .shtml for the CGI portion to evaluate.

Here is a list of the variables available to you:
(for IIS and from the IIS help system. For other servers, there are more variables you can access so check in your server's documentation.)

ALL_HTTP All HTTP headers
 
AUTH_TYPE This contains the type of authentication used.

AUTH_PASSWORD The value entered in the client's authentication dialog box.

AUTH_USER The value entered in the client's authentication dialog box.
 
CONTENT_LENGTH bytes that the script can expect to receive from the client.
 
CONTENT_TYPE The content type of the information supplied in the body of a POST request.

DOCUMENT_NAME The current file name.

DOCUMENT_URI The virtual path to the current document.

DATE_GMT The current date in Greenwich Mean Time (GMT).

DATE_LOCAL The current date in the local time zone.

GATEWAY_INTERFACE The revision of the CGI specification used by the Web server.

HTTP_ACCEPT Special-case HTTP header.

LAST_MODIFIED The date that the current document was last modified.

PATH_INFO Additional path information consisting of the trailing part of the URL after the script name, but before the query string, if any.

PATH_TRANSLATED This is the value of PATH_INFO, but with any virtual path expanded into a directory specification.

QUERY_STRING The information that follows the question mark (?) in the URL that referenced this script.

QUERY_STRING_UNESCAPED Unescaped version of the query string; that is, a version that is not URL encoded. 

REMOTE_ADDR The IP address of the client or agent of the client (for example, gateway or firewall) that sent the request.

REMOTE_HOST The host name of the client or agent of the client (for example, gateway or firewall) that sent the request. IIS 2.0 and 3.0 returned an IP address for this parameter. 

REMOTE_USER This contains the user name supplied by the client and authenticated by the server. This comes back as an empty string when the user is anonymous (but authenticated).

REQUEST_METHOD The HTTP request method.

SCRIPT_NAME The name of the script program being executed.

SERVER_NAME The server’s host name, or IP address, as it should appear in self-referencing URLs.
 
SERVER_PORT The TCP/IP port on which the request was received.

SERVER_PORT_SECURE A string of either 0 or 1. If the request is being handled on the secure port, this will be 1. Otherwise, it will be 0.

SERVER_PROTOCOL The name and version of the information retrieval protocol relating to this request. This is usually HTTP/1.0. The protocol is returned in the format name/version.

SERVER_SOFTWARE The name and version of the Web server answering the request. The server information is returned in the format name/version.

URL Gives the base portion of the URL. Parameter values will not be included. The value is determined when the Web server parses the URL from the header.

[Matt Brown's Radio Weblog]
2:20:27 PM    

Rival v3 Home:"Welcome to the next revolution in evolutionary IM. Rival Messenger is a windows based instant messaging client based roughly on everything good that's available in the different commercial Instant Messaging Clients. Rival is proud to be powered by Jabber, the worlds most flexible XML router. Rival messenger is built for style and ease of use. The knowledge gained from the two previous versions of Rival has been styled, and molded to what the end users have wanted. Functionality with features that make your messaging experience more enjoyable. Bold and easy to understand layout, options with explanations, and notifications of events as they happen. With great icons and imagery put together by Peter Coyne and myself, its got the looks as well as the charm. "

jabber tools


1:15:40 PM