[thelist] Prevent people from using your graphics

Mike Ashton mashton at 4all.com
Tue Jul 4 20:19:33 CDT 2000


CD,
If you use perl, you can write a script that serves up your images, and when it
does it checks the referrer. If the referrer is not yours or an authorized one,
you can then serve up an alternative image or no image at all.

Here is a quick one I threw together.

Mike

===============start=======
#!/perl

require "Cgi-lib.pl";

&ReadParse(*search);

if ($ENV{'HTTP_REFERER'} =~ m#http://www.ematchcorp.com/test/# ) {

$expires='Expires: Wed, 26 Feb 1997 08:21:57 GMT\n';
$pragma='Pragma: no-cache';

$tmpfile="c:\\inetpub\\www\\ematch\\images\\$search{'file'}";
open( FROM, "< $tmpfile" );
binmode FROM;
binmode STDOUT;

# Print out the contents of the image file.
print "Content-type: image/$search{'type'}\n";
print $expires,"\n";
print $pragma,"\n";
print "\n";

##print <FROM>;

while (<FROM>) {
      print $_;
   }

close FROM;

} else {
## Unathorized access
print "Content-type: text/html\n";
print $expires,"\n";
print $pragma,"\n";
print "\n";
print "<html><body>copyrighted material</body></html>\n";

}

exit;
========end===========

CDitty wrote:

> Hello all.  I have noticed people linking directly to the graphics on my
> site and using them on theirs.  I have tried emailing them and asking them
> to remove the links, but it does no good.
>
> Is there something that I can put in the .htaccess file that will only
> allow my server to use graphics?
>
> Thanks
>
> CDitty
>
> <tip>
> Want to use Eudora for your email but don't want to pay for it?
> Now you can!!  Eudora 4.3 now has multiple versions.  Paid mode and sponsor
> mode.
> All you give up is a little square in the bottom left corner of the screen.
>
> Check it out
> http://www.eudora.com
> </tip>
>
> ---------------------------------------
> For unsubscribe and other options, including
> the Tip Harvester and archive of TheList go to:
> http://lists.evolt.org Workers of the Web, evolt !





More information about the thelist mailing list