View Full Version : big challenge for all you webmasters out there
Weapon
March 31st, 2001, 04:41
I have two script on my page one is a image script so I don't have to make a page for every image and the second one is a anti leech script for the image
anti leech: http://yoursite.com/cgi-bin/downloader.cgi?site=1&filename=thefile.zip
image: http://yoursite.net/cgi-bin/image.pl?directoryofimage/the file.jpg
so how would I put the two script together so they can't steal my images but are still able to view them from the original site?
Canuckkev
March 31st, 2001, 14:43
Hmm, copy and paste the codes into the same script, then it should be able to show the image and make it anti-leechable. A bit of editing could fix it. If you give me your code, I could probably help.
Weapon
March 31st, 2001, 16:29
Originally posted by Canuckkev
If you give me your code, I could probably help.
The anti-leech:
#!/usr/bin/perl
$defaulturl = "http://cgi-scripting.com";
@okaysites = ("http://cgi-scripting.com", "http://www.cgi-scripting.com");
$url_1 = "http://yahoo.com";
$url_2 = "http://downloads.com";
$url_3 = "http://downloads.com/new";
@querypairs = split(/&/, $ENV{'QUERY_STRING'});
foreach $querypair (@querypairs) {
($queryname, $queryvalue) = split(/=/, $querypair);
$queryvalue =~ tr/+/ /;
$queryvalue =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$queryvalue =~ s/<([^>]|\n)*>//g;
if ($QUERY{$queryname}) { $QUERY{$queryname} = $QUERY{$queryname}.",".$queryvalue; }
else { $QUERY{$queryname} = $queryvalue; }
}
$reffer = $ENV{'HTTP_REFERER'};
$yes = 0;
foreach $domain (@okaysites) {
if ($reffer =~ /$domain/) {
$yes = 1;
}
}
if ($url_$QUERY{'site'} && $yes == 1) {
print "Location: $url_$QUERY{'site'}/$QUERY{'filename'}\n\n";
} else {
print "Location: $defaulturl\n\n";
}
exit;
The image script:
#!/usr/local/bin/perl
$headfile = '/data1/hypermart.net/otashki/header.txt';
$footfile = '/data1/hypermart.net/otashki/footer.txt';
$File = $ENV{'QUERY_STRING'};
unless (open (DATA,"$headfile")) {die (&error);}
if ($uselock eq '1') {
flock DATA, 2;
seek DATA, 0, 0;
}
@headinfo = <DATA>;
if ($uselock eq '1') {
flock DATA, 8;
}
close (DATA);
foreach $headline (@headinfo){
$heading = $heading.$headline;
}
unless (open (DATA,"$footfile")) {die (&error);}
if ($uselock eq '1') {
flock DATA, 2;
seek DATA, 0, 0;
}
@footinfo = <DATA>;
if ($uselock eq '1') {
flock DATA, 8;
}
close (DATA);
foreach $footline (@footinfo){
$footer = $footer.$footline;
}
print "Content-type:text/html\n\n";
print "$heading";
print "<CENTER><IMG SRC=\"$File\"></CENTER>";
print "$footer";
Cheap Bastard
March 31st, 2001, 23:29
so with anti-leech you merely mean they can't link to it from your site... Cool :)
(sorry can't help though)
Canuckkev
April 1st, 2001, 15:18
Just before I spend some time on this, let me clarify things. You want your .jpg's to be protected by the antileech, right? And the jpg's will show up on the cgi generated page, right? Just making sure I understand, cause if that is the case, in the line :
print "<CENTER><IMG SRC=\"$File\"></CENTER>";
You could replace it with
print "<CENTER><IMG SRC=\"http://yoursite.com/cgi-bin/downloader.cgi?site=1&filename=$File\"></CENTER>";
Might still need to be fixed up a bit, depending on where the directory is or stuff like that.
Oh, and by the way, that's the same image gallery script that I edited up to suit my own needs. :)
Weapon
April 1st, 2001, 22:33
Originally posted by Canuckkev
Just before I spend some time on this, let me clarify things. You want your .jpg's to be protected by the antileech, right? And the jpg's will show up on the cgi generated page, right? Just making sure I understand, cause if that is the case, in the line :
print "<CENTER><IMG SRC=\"$File\"></CENTER>";
You could replace it with
print "<CENTER><IMG SRC=\"http://yoursite.com/cgi-bin/downloader.cgi?site=1&filename=$File\"></CENTER>";
Might still need to be fixed up a bit, depending on where the directory is or stuff like that.
Oh, and by the way, that's the same image gallery script that I edited up to suit my own needs. :)
But if I do it that way I can link the images to multiple directory
Canuckkev
April 2nd, 2001, 18:47
Huh? Do you mean "Can I link the images to multiple directory?" I think so. If your ?query string is a http:// address, this will be possible. Otherwise you would have to add more scripting to receive variables from the ?query like ?file=pic.jpg&dir=pics. It would be easy if your anti-leech script was in the base directory, otherwise each ?query must be like
?http://mydomain.com/dir/file.jpg
Weapon
April 2nd, 2001, 22:27
do you know any other script that would save my images from being linked/stolen?
atlas
April 3rd, 2001, 17:39
Just edit your main script to check the referrer to make sure it's an accepted site. Either that or I'm not understanding what you wish to do.
-mk
Canuckkev
April 3rd, 2001, 18:22
Yeah, the easiest would be to check your refferer in the image script. Just use this script, and all should be good:
#!/usr/local/bin/perl
@okaysites = ("http://cgi-scripting.com", "http://www.cgi-scripting.com");
$reffer = $ENV{'HTTP_REFERER'};
$headfile = '/data1/hypermart.net/otashki/header.txt';
$footfile = '/data1/hypermart.net/otashki/footer.txt';
$File = $ENV{'QUERY_STRING'};
unless (open (DATA,"$headfile")) {die (&error);}
if ($uselock eq '1') {
flock DATA, 2;
seek DATA, 0, 0;
}
@headinfo = <DATA>;
if ($uselock eq '1') {
flock DATA, 8;
}
close (DATA);
foreach $headline (@headinfo){
$heading = $heading.$headline;
}
unless (open (DATA,"$footfile")) {die (&error);}
if ($uselock eq '1') {
flock DATA, 2;
seek DATA, 0, 0;
}
@footinfo = <DATA>;
if ($uselock eq '1') {
flock DATA, 8;
}
close (DATA);
foreach $footline (@footinfo){
$footer = $footer.$footline;
}
foreach $domain (@okaysites) {
if ($reffer =~ /$domain/) {
print "Content-type:text/html\n\n";
print "$heading";
print "<CENTER><IMG SRC=\"$File\"></CENTER>";
print "$footer";
exit;
}
}
sub error {
print "Content-type:text/html\n\n";
print "Error!";
exit;
}
[Edited by Canuckkev on 04-03-2001 at 07:24 PM]
}:8) Supermoo
April 3rd, 2001, 21:44
Did it work? Did it work? ;)
Weapon
April 3rd, 2001, 23:30
yeah it works, but I was thinking if they right click on the image after they click the link and the image loads will they still be able to go "copy image location..." then put it on their page?
}:8) Supermoo
April 3rd, 2001, 23:48
Originally posted by Weapon
yeah it works
How about a thankyou, to those that helped? ;)
lucifer
April 4th, 2001, 06:09
Originally posted by Weapon
yeah it works, but I was thinking if they right click on the image after they click the link and the image loads will they still be able to go "copy image location..." then put it on their page?
If they can see it they can steal it.
You can only stop them linking to your image rather than putting a copy of it on their site
}:8) Supermoo
April 4th, 2001, 16:03
Although you could try an onMouseOver & onButtonDown watermark. Which would stop many thefts.
Also, try encryting the HTML code and no-one should be able to find it! :)
Although don't over use this as it will most likley triple loading times, but if you need it... it will work. ;)
Canuckkev
April 4th, 2001, 17:19
Oh, I thought you wanted it to be unable to be linked from your site. Now you want it so they can't copy it? Well, put up a copyright statement...it may stop one or two people. If someone wants to copy it, they will be able to break any code you put in to make it uncopyable(sp?) Or, a real desperate person may take a screen shot.
Oh, and glad it works. I can never seem to get anything of my own to work.
Weapon
April 4th, 2001, 22:32
no this is just to stop bandwidth theft so would it? I don't want to pay for more bandwidth you know
Canuckkev
April 4th, 2001, 22:38
Well, it should stop bandwidth theft. Don;t see how it couldn't.
Weapon
April 5th, 2001, 22:18
Originally posted by Canuckkev
Well, it should stop bandwidth theft. Don;t see how it couldn't.
Can't they go right click in the image then properties then copy the url?
gyrbo
April 6th, 2001, 03:58
That's the good of the script! You need to link from a site under his server!
Weapon
April 6th, 2001, 04:44
Originally posted by gyrbo
That's the good of the script! You need to link from a site under his server!
What are you trying to say here? What I am trying to say is that I will have to pay for more bandwidth. Also anyone know the script to disable right click but instead of popping up a message it says nothing? and how do you link a .js file to your page like a style sheet?
[Edited by Weapon on 04-06-2001 at 06:13 AM]
gyrbo
April 6th, 2001, 06:58
Originally posted by Weapon
Originally posted by gyrbo
That's the good of the script! You need to link from a site under his server!
What are you trying to say here? What I am trying to say is that I will have to pay for more bandwidth. Also anyone know the script to disable right click but instead of popping up a message it says nothing? and how do you link a .js file to your page like a style sheet?
[Edited by Weapon on 04-06-2001 at 06:13 AM]
Just like a stylesheet?
<LINK REL="Something" TYPE="text/js" HREF="file.js">?
Weapon
April 7th, 2001, 06:52
well I managed to link the seperate .js file to my site but I was just wondering how do you put two script into one .js file? do you put a - or some sort to tell where one script ends and the other start?
lucifer
April 7th, 2001, 07:01
just put the second one after the first
maybe add a
// this is where the next script starts
comment for later reference
Powered by vBulletin® Version 4.1.7 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.