CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Need a Custom or Prewritten Perl Program?: I need a program that...:
ip redirector

 



csjjpm
Deleted

Oct 10, 2000, 7:23 AM

Post #1 of 2 (529 views)
ip redirector Can't Post

I need a script that will redirect to a specific page/directory based on ip address/hostname of client.
I found a really good one at http://www.cgi-world.com/custom/ip_redirect/
but they havent qouted a price and I dont really want to have to pay.


Kanji
User / Moderator

Oct 14, 2000, 2:42 PM

Post #2 of 2 (529 views)
Re: ip redirector [In reply to] Can't Post

No warranty. No support. :-)

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>

#!/usr/bin/perl -wT

use strict;

my $ip = $ENV{'REMOTE_HOST'} || $ENV{'REMOTE_ADDR'} || "";

while ( <DATA> ) {
chomp;

my ( $address, $url ) = split;

if ( $address && $url && $address eq $ip ) {
print "Location: $url\n\n";
exit;
}
}

print "Content-Type: text/plain\n\nOops!";

__END__
IP/HOST REDIRECT TO...
127.0.0.1 http://www.perlguru.com/</pre><HR></BLOCKQUOTE>

[This message has been edited by Kanji (edited 10-14-2000).]

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives