[WEB4LIB] IP Address Detection

Araby Greene araby at unr.edu
Thu Nov 8 17:52:02 EST 2001


This may not be applicable to your situation, but with IIS and ASP, you can
get the visitor's IP address using:

Request.ServerVariables("REMOTE_ADDR")

To detect if the person is on campus, you might extract the first part of
the address:

strUserIP = (Left(Request.ServerVariables("REMOTE_ADDR"),8))
If (strUserIP = "134.197.") Then
    strUserLoc="OnCampus"
Else
    strUserLoc="OffCampus"
End If

In a Perl script, you could use:  $ip = "$ENV{REMOTE_ADDR}";

Hope this helps,
Araby Greene
________________________
Araby Greene
araby at unr.edu
Web Development Librarian
Getchell Library/322
Univ. of Nevada, Reno
http://www.library.unr.edu/


----- Original Message -----
From: "Donald Barclay" <dbarclay at library.tmc.edu>
To: "Multiple recipients of list" <web4lib at webjunction.org>
Sent: Thursday, November 08, 2001 1:45 PM
Subject: [WEB4LIB] IP Address Detection


> Anyone know of a quick, cheap, and good way to detect a site visitor's IP
> address and, based on this, direct them to a particular page on your site?
>
> Donald A. Barclay
> Assistant Director for Systems and Informatics
> Houston Academy of Medicine--
> Texas Medical Center Library
> dbarclay at library.tmc.edu <mailto:dbarclay at library.tmc.edu>
> 713.799.7120
>
> always the beautiful answer
> who asks a more beautiful question
>                  --e.e. cummings




More information about the Web4lib mailing list