I haven't tested this yet, but am I on the right track?I've already answered a better solution for the remote match in another node in this thread. The real point is that you don't need a regex, so stop using it!
This is not a good regex to match a hostname. You left out the hyphens, for example. At least you didn't use \w like so many do, incorrectly adding underscore to the mix. You get points for that. {grin}$remote =~ /([A-Za-z0-9\.]*[A-Za-z0-9]+\.[A-Za-z0-9]+)/;
There. That's your whole program. Short and sweet.my @GOODLIST = qw(10.0.1.5 10.0.2.1); use CGI qw(:all); use strict; for my $remote_addr (remote_addr()) { if (grep $remote_addr, @GOODLIST) { print redirect ("/secret/URL/here/foo.thingy"); } else { print header ( status => 404 ), start_html( 'error' ), "The resource you tried to access is not found", end_html; } }
-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.
In reply to •Re: Re: •Re: anti leech CGI
by merlyn
in thread anti leech CGI
by hiseldl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |