Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 178
  • Last Modified:

Question

Is there a free bandwidth protector perl script around?

Thanks

-CMD
0
CMD
Asked:
CMD
1 Solution
 
MasseyMCommented:
What is the purpose of the script?  what is a "bandwidth" protector?
0
 
CMDAuthor Commented:
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
 
cheekycjCommented:
Is that something you can set on your server config?
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
MasseyMCommented:
OK, I see.  Thanks for the info
0
 
adrianwardCommented:
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
 
adrianwardCommented:
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now