ScriptAlias /cgi-bin/ /var/www/perl-cgi/
PerlSwitches -wT
SetHandler perl-script
PerlHandler ModPerl::Registry
PerlSendHeader On
AllowOverride None
Options +ExecCGI -MultiViews
####
use Data::Validate::IP qw(is_ip is_public_ip is_loopback_ip);
@IPs='';
undef $ip;
if (defined $ENV{HTTP_X_FORWARDED_FOR}) {
@IPs=split /,/, $ENV{HTTP_X_FORWARDED_FOR};
};
unshift (@IPs, $ENV{REMOTE_ADDR});
foreach $check (@IPs) {
$check =~ s/^\s*(.*?)\s*$/\1/g;
if (is_ip($check)) {
if (defined $ip) {
if (not is_public_ip($check)) { $check = $ip; };
if (is_loopback_ip($check)) { $check = $ip; };
if ($check eq "41.79.21.90") { $check = $ip; };
};
$ip = $check;
};
};
print "Content-type: text/html\nCache-Control: max-age=0,no-cache,no-store,post-check=0,pre-check=0\n\nCurrent IP CheckCurrent IP Address: $ip";