Forum Moderators: open
I’ve got SSI enabled (inc. exec) and have tried (for one domain) using REMOTE_HOST – however, that sometimes yields REMOTE_ADDR, i.e. an IP address – so, I’d either need a way to resolve that to a textual name (for string matching) or find some other way to reliably find the domain the user's coming from.
I know nothing about Perl, CGI or server-side scripting (although I’d like to: and, btw, Perl/CGI/PHP are all enabled) and, as far as I can tell, I’m hosted on a Zeus web-server (Blueyonder.co.uk). Anyway, can someone suggest how I can do this please.
Thanks,
peetm
>tweak
You going to use perl?
#!/usr/bin/perl
my @bad_ips = qw(
111.222.333.44
111.22.333.45
111.226.111.45
);
$not_good=0;
foreach (@bad_ips) {
if ($ENV{'REMOTE_ADDR'} =~ /$_/) {$not_good=1}
}
if ($not_good){
print qq¦You bad IP, you go away now, I mean it!¦;
}
else {
print qq¦Hi good folks, come buy something.¦;
}
Another approach is to include some SSI code on the page you want to "tweak" such as:
<!--# if expr="\"$REMOTE_ADDR\"!= /111.111.111.111¦111.111.111.222/" -->
Display the usual page, substitute HTML code and content here
<!--#else -->
Display the "tweaked" page, substitute HTML code and content here
<!--# endif -->
You'll need to let Zeus know that the page containing this code needs to be parsed for SSI. On Apache, you could simply name the page using a .shtml extension. Who knows how Zeus does it... :)