Solved

Question

Posted on 1998-11-14
6
172 Views
Last Modified: 2013-12-25
Is there a free bandwidth protector perl script around?

Thanks

-CMD
0
Comment
Question by:CMD
6 Comments
 
LVL 10

Expert Comment

by:MasseyM
ID: 1829570
What is the purpose of the script?  what is a "bandwidth" protector?
0
 

Author Comment

by:CMD
ID: 1829571
A bandwidth protector is a script which stops people linking to your images or graphics. So, your server can view the image, but if someone else strys to use your graphic from your server on his own server, it won't work.
It stops people from stealing your bandwidth

CMD
-----------
0
 
LVL 19

Expert Comment

by:cheekycj
ID: 1829572
Is that something you can set on your server config?
0
DevOps Toolchain Recommendations

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

 
LVL 10

Expert Comment

by:MasseyM
ID: 1829573
OK, I see.  Thanks for the info
0
 

Accepted Solution

by:
adrianward earned 50 total points
ID: 1829574
The problem is that if you put your images in your htdocs directory then you'll find that they're public (for anyone, anywhere). That's what the Internet is about. I'd question why you need to do this, it goes against the whole concept of a web site.

However, to do it is fairly simple. You'd upload your graphics etc into a directory outside of your htdocs. For example, say you have a cgi-bin, and I create a subdir in that called resources.

now I could write a script which gets a single parameter: a filename, and then it checks who's asking for the file and then returns it. In Perl:

#!/usr/bin/perl

if ($ENV{'REMOTE_ADDR'} eq "193.243.236.250") {
 print "Content-type: image/gif\n\n";
 print `cat resources/$ENV{'QUERY_STRING'}`;
} else {
 print "Content-type: text/plain\n\n";
 print "Only people at 193.243.236.250 are allowed to see that file";
}

But, this is a little sketchy, because it only checks on IP
addresses, which is probably not suitable for you. You could use
cookies which is better, but beyond the scope of 50 points!

Hope this helps you a little.
0
 

Expert Comment

by:adrianward
ID: 1829575
Oh, I forgot to mention how you'd use the script in my answer:

In your HTML you would then reference your images as

<IMG SRC="/cgi-bin/cgiscriptname.pl?image_file.gif">

Which would call the CGI above, passing the filename of the GIF you want to display.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

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…
Recently I have been answering a lot of questions like this in IT forums that I frequent. The question posed is usually something along the lines of "We have software X installed and need to uninstall it for reason Y" or some other variant of the sa…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

861 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

28 Experts available now in Live!

Get 1:1 Help Now