[Web4lib] Script for databases access

Randy Norwood randy.norwood at ttu.edu
Thu Jun 2 09:27:14 EDT 2005


It's about that simple. As was noted by a previous post, ezproxy has this
functionality built-in, and this should be used if available. For other
general IP checking you could do something like this (in PHP--other
languages would be similar)....

For example, the link you would click on would point to this URL:
http://your.library.edu/check_ip.php?target=http://search.epnet.com

Then, "check_ip.php" would contain:

$url = urlencode($_GET[target]);



if(strpos($_SERVER[REMOTE_ADDR],"129.118.", 0) === 0) header("Location:
$_GET[target]"); // 129.118. is my university's IP range

else header("Location:
http://your.library.edu/error_message.php?target=$url");



On 06/02/05 7:30 AM, "David Pattern" <d.c.pattern at hud.ac.uk> wrote:

> Hi Jonathan
>  
> It should be fairly easy to do with Perl CGI (sorry, I don't have a prebuilt
> solution!) - you'll just need to check the "REMOTE_ADDR" environment variable
> to determine the IP address - e.g.
>  
>      print "Your IP address is " . $ENV{'REMOTE_ADDR'};
>  
> regards
> Dave Pattern
> University of Huddersfield
>  
> 
> -----Original Message-----
> From: Jonathan Bloy [mailto:JBloy at edgewood.edu]
> Sent: Wed 01/06/2005 21:18
> To: web4lib at webjunction.org
> Cc: 
> Subject: [Web4lib] Script for databases access
> 
> 
> 
> At my library, we're looking at getting away from separate links for on
> campus and off campus users accessing our databases.  I've seen some
> libraries that use a script to determine if a user is on or off campus
> (via I.P. address) and then send the off campus user through the
> library's proxy server, so they can be verified as an authorized user.
> 
> I'm fairly new when it comes to server side scripting and would like to
> avoid re-inventing the wheel.  Does anyone have a script they can share
> or point me toward?  Unfortunately PHP is not installed on our campus
> servers, so I would need something an ASP or a CGI Script.
> 
> ---
> Jonathan Bloy
> Web Services Librarian
> Edgewood College
> Madison, Wisconsin
> http://library.edgewood.edu
> 
> 608-663-3385
> 
> _______________________________________________
> Web4lib mailing list
> Web4lib at webjunction.org
> http://lists.webjunction.org/web4lib/
> 
> 
> _______________________________________________
> Web4lib mailing list
> Web4lib at webjunction.org
> http://lists.webjunction.org/web4lib/



More information about the Web4lib mailing list