Solved

Question

Posted on 1998-11-14
6
171 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
Comment Utility
What is the purpose of the script?  what is a "bandwidth" protector?
0
 

Author Comment

by:CMD
Comment Utility
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
Comment Utility
Is that something you can set on your server config?
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 10

Expert Comment

by:MasseyM
Comment Utility
OK, I see.  Thanks for the info
0
 

Accepted Solution

by:
adrianward earned 50 total points
Comment Utility
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
Comment Utility
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

771 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

7 Experts available now in Live!

Get 1:1 Help Now