Forum Moderators: open

Message Too Old, No Replies

User domain checking

how can I ...

         

peetm

8:34 am on Nov 8, 2002 (gmt 0)

10+ Year Member



I want to exclude requests for pages on my site emanating from certain domains. Actually, I'd not like to refuse them the page - just *tweak* it for them a bit.

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

engine

9:15 am on Nov 28, 2002 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Peetm, welcome to WebmasterWorld.

I'll try to raise some answers for you.

littleman

9:35 am on Nov 28, 2002 (gmt 0)



Peetm, go with tracking IPs, Host lookups fail and could cause a lag.

>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.¦;
}

DaveAtIFG

7:14 pm on Nov 28, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I downloaded a Zeus user guide here [support.zeus.com]. If your host will cooperate, section 8.7 Configuring Rewrite Request Scripts may offer a solution.

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 -->

This says "If the visiting IP is not 111.111.111.111 or 111.111.111.222, display the normal page. If it is one of those IPs, display the tweaked page."

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... :)