Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions


WDVL Newsletter

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us















Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


FHimageprotect V1.2

December 20, 1999

FHimageprotect V1.2 is a nifty little cgi script written by Dale Bulmer, former owner of free-help.com, a free internet help site. FHimageprotect prevents someone from stealing your bandwidth by linking directly to your images. Oh.... they can still link, but what is served up is not what they expect. Want to see what happens when an unauthorized site tries to link to an image on your server?

The zipped version of the script may be downloaded from WebGuard, or you can copy/paste the text into your favorite text editor, saving it with a .pl or .cgi extension. (Note, not all servers are set up to execute a .pl extension. It may be necessary to change the extension to .cgi.)

The first thing you'll need to do is change the variables in the script so that they point to your files and directories. The script itself is fairly basic only requiring four changes. Open the script in your favorite text editor, making adjustments to the lines indicated below.


#!/usr/bin/perl This line must reflect the location of perl on your server. If you have telnet access you can type "whereis perl" at the command prompt. All others contact their system admin or ISP for the location of perl.
@re=("yourdomain.com","www.yourdomain.com");
#Set the above line to valid refer's (refer assumed bad if not listed)
Specify your own domain as well as any other domains you would like to have access to your images. If a domain is not listed here, that site will not be able to link directly to your images.
$graphicsdir = "graphics";
#The relevant dir of the graphics
Change "graphics" to the location of your images directory; this is the directory where you will store the images you want to protect.
print "Location: http://yourdomain.com/cgi/stolen.gif\n\n";


The "\n\n" at the end of the line sends two line breaks (one for each "\n") which is standard when printing out an HTTP mime type (here, the type is location=some.gif)
This line reflects the location of a specially prepared image that notifies the general public that the image they were supposed to be viewing was stolen. Create an image that says something to the effect of "The image you are trying to view is stolen. Please send email to email@mydomain.com with the URL of the website attempting to post this image". Place the image in your root directory; if you place it elsewhere, you'll need to adjust the path to it in the script.

Now that all of the changes have been made to the cgi-script, you can upload it to your cgi-bin. Be sure to upload as ASCII text, not binary. The script should have permissions set to Read, Write, Execute for owner and Read, Execute for everyone else. Permissions are probably one of the most difficult concepts for the newbie to grasp, so if you're having trouble check out the Permissions Chart.

A slight change to your HTML file is necessary to get the script to work. The IMG SRC needs to be changed from

<IMG SRC = "image_directory/image.jpg">

to

<IMG align=left SRC="/cgi-bin/fhimageprotect.pl?image_jpg">

Note the dot (.) between the image name and the jpg extension has changed to an underscore (_). The path reflects the location of fhimageprotect.pl rather than the image itself.

Upload the html file to the directory specified in the cgi script and you're all set!

Disable Images Right Click
Protecting Images and Bandwidth
Conclusion


Up to => Home / Authoring / Graphics / Theft




Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers