Solved

Want script to refuse selected browsers/dns..

Posted on 1998-01-09
4
144 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction This tutorial will give you a fast look what you can do with WhizBase. I expect you already know how to work with HTML at least, and that you understand the basics of the internet and how the internet works. WhizBase is a server-s…
Making a simple AJAX shopping cart Couple years ago I made my first shopping cart, I used iframe and JavaScript, it was very good at that time, there were no sessions or AJAX, I used cookies on clients machine. Today we have more advanced techno…
The viewer will learn how to dynamically set the form action using jQuery.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

747 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

11 Experts available now in Live!

Get 1:1 Help Now