Solved

Want script to refuse selected browsers/dns..

Posted on 1998-01-09
4
145 Views
Last Modified: 2013-12-25
Hi,
We are looking for a script that we can use to prevent people browsing in from our competitor's companies from seeing our web site. I know we can't prevent the same people from browsing in from home accounts, but we must do what we can. We'll be using a unix server, and can take it in perl. The first reply with a URL to a good, cheap script to download will get the 50 points, so long as it ends up working as advertised.
0
Comment
Question by:retroman
  • 2
4 Comments
 
LVL 32

Accepted Solution

by:
jhance earned 50 total points
ID: 1831813
#!/usr/bin/perl

print "Location: ";

# Look for their hostname or IP address
if (($ENV{"REMOTE_HOST"} eq "www.competitor.com") ||
    ($ENV{"REMOTE_ADDR"} eq "192.168.0.10")){
        print "http://www.myhost.com/sorry_scumbag\n\n";
}
else{
        print "http://www.myhost.com/welcome\n\n";
}



0
 
LVL 84

Expert Comment

by:ozo
ID: 1831814
Or to prevent someone from going directly to http://www.myhost.com/welcome,
you might even try:

#!/usr/bin/perl
if( $ENV{"REMOTE_HOST"} eq "www.competitor.com") || ($ENV{"REMOTE_ADDR"} eq "192.168.0.10" ){
        open(F,"<sorry_scumbag")
}else{
        open(F,"<welcome")
}
print <F>;
close F;


(which doesn't prevent competitor.com from going through a relay,
but you do what you can)
0
 

Author Comment

by:retroman
ID: 1831815
THese both look good, but then I'm a gaper anyways. How would I modify it to prevent competitor1, competitor2, and competitor3 from accessing, and what is the difference between the two?
0
 

Author Comment

by:retroman
ID: 1831816
I'll use this one for another one of my sites. Unfortunately for me, my boss changed his mind and decided we didn't need this feature....
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction:   Welcome to my first article ever. To begin with, the reason I write this article.  I participated in a question on Experts Exchange about the start command in Windows and there were some discussion about the usage. The discussio…
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now