Previous: tell me what you think please
Next: Comicc Awareness Week |
| Author |
Message |
William G Reinvents understanding
Joined: 15 Jan 2003 Posts: 560 Location: South central...Korea. Word.
|
Posted: Tue Apr 06, 2004 12:16 pm Post subject: Scripting to block remote linking |
|
|
Without getting into a long story, an asshole is linking to images from my site without my permission for the purposes of being an asshole. Is there some code that I can include in my HTML that will block it or is it something that can only be done via the server? _________________ Her lips are devil red, she's the color of mocha... |
|
| Back to top |
|
 |
Greg Stephens Forum Founder
Joined: 14 Apr 2001 Posts: 3869 Location: Los Angeles, California, USA
|
Posted: Tue Apr 06, 2004 12:58 pm Post subject: |
|
|
There are many ways. One of the easiest is to modify your .htaccess file. A Google search for "hotlinking htaccess" should help you out there.
There's a thread on "how to block hotlinking" here with many good replies.
There are ways to manage images with php as well, but I lack the time to explore futher to find a good link. The gist of how these work is that you move your images to a different directory where the leecher doesn't know to look. Then a small php script is called in your IMG tag rather than the image itself. The script knows to look in the proper directory and display the image for you site, but people linking to it (since they only see the location of the php script when they "view source" or right-moustclick) will either get nothing or a message saying that the image is unavailable. _________________ Good morning! That's a nice tnetennba. |
|
| Back to top |
|
 |
Greg Stephens Forum Founder
Joined: 14 Apr 2001 Posts: 3869 Location: Los Angeles, California, USA
|
Posted: Tue Apr 06, 2004 1:28 pm Post subject: |
|
|
Found a nice simple one, if your host runs php (most do):
Simple method to protect images.
I'm going to copy and paste the code here, in case that page goes away. I may want to use this myself someday:
| Code: |
<?php
// -------------------------------
//
// Anti-Leeching Image Output
// By: Andrew Heebner
//
// -------------------------------
//
// Usage:
// image.php?img=imagename.gif
//
// -------------------------------
// secret image directory
$sDir = "/home/andrew/public_html/a/";
// clean the $img variable up
$img = stripslashes(ltrim(rtrim($img)));
// create absolute path to image
$fDir = $sDir.$img;
// These are the allowable content types
$allowExt = array("gif","jpg","png");
// sites to allow
$allowSite = array("evilwalrus.com","www.evilwalrus.com");
// check if the file exists
if(file_exists($fDir)) {
if(!in_array($HTTP_REFERER,$allowSite)) {
print("Site not allowed");
die();
// check if the content is allowable according to the array();
if(!in_array(substr($img,-3),$allowExt)) {
print("Invalid image name/extension");
die();
} else {
$fType = substr($img,-3);
// change the jpg ext. to jpeg
if($fType == "jpg") $fType = "jpeg";
// define the content type
Header("Content-type: image/$fType");
$fp = @fopen($fDir,"rb");
// display the output
fpassthru($fp);
fclose($fp);
}
} else {
print("File does not exist");
die();
}
?>
|
(Guess I did have the time to research this after all.) _________________ Good morning! That's a nice tnetennba. |
|
| Back to top |
|
 |
William G Reinvents understanding
Joined: 15 Jan 2003 Posts: 560 Location: South central...Korea. Word.
|
|
| Back to top |
|
 |
William G Reinvents understanding
Joined: 15 Jan 2003 Posts: 560 Location: South central...Korea. Word.
|
Posted: Tue Apr 06, 2004 1:52 pm Post subject: |
|
|
Whoah! It worked a bit too well since I couldnt access my site after I plugged it in. I dont think I messed anything up...Oh well, I'll delete the file and try again later when my host is available. Thanks _________________ Her lips are devil red, she's the color of mocha... |
|
| Back to top |
|
 |
Greg Stephens Forum Founder
Joined: 14 Apr 2001 Posts: 3869 Location: Los Angeles, California, USA
|
Posted: Tue Apr 06, 2004 2:33 pm Post subject: |
|
|
I'm guessing you tried the .htaccess method, because that could block an entire site. You have to be careful with .htaccess files, but so long as you can delete the file, you'll be OK.
I'm assuming you have a hosting provider and aren't running your own server, so I'll mention this: Some FTP programs don't display the .htaccess file due to the "." at the start of the filename. Don't freak out if you can't see the file, just try to adjust the settings on your FTP program to make it show up. If that doesn't work, you can always try an alternate method, like telnet.
You can probably telnet into your site using the same username and password (in Windows, telnet is as simple as going to a command line and typing "telnet sitename" where "sitename" is your domain (zwol.org, in my case)). You'll probably be in a linux environment after you log in. I'm not sure how familiar you are with linux commands, but you change directories with "cd dirname" where "dirname" is the directory you want to switch to ("cd .." goes back up one level). I like to use "ls -la |more" to view the folder's contents (using "|more" will pause at the end of each page- use the spacebar to see the next page, use CTRL-C to break back to the command prompt). And to delete the file use "rm -v .htaccess" As always, be careful when deleting anything. You don't want to accidentally delete anything important, like your whole site. _________________ Good morning! That's a nice tnetennba. |
|
| Back to top |
|
 |
Tim Mallos Understands reinventing
Joined: 23 Apr 2001 Posts: 353 Location: Brighton, Michigan
|
Posted: Tue Apr 06, 2004 8:19 pm Post subject: |
|
|
Is he displaying your images in the context of his own site?
I always like changing the names on my files and links on my site and serving up something rude in its place.
Like, a graphic that says "The jerk wad running this page is stealing my content".
Of course, that's cat and mouse.
But gratifying once.
T _________________
Tim Mallos' Comics and Stuff |
|
| Back to top |
|
 |
William G Reinvents understanding
Joined: 15 Jan 2003 Posts: 560 Location: South central...Korea. Word.
|
Posted: Tue Apr 06, 2004 8:59 pm Post subject: |
|
|
Greg, I'm using a linux FTP program, and thankfully my host has things set to show hidden files, so I was able to clear out the .htaccess file after I posted that message.
But, I'll wait until I can chat with my host and then we can try those other options together in case of a bad result.
Tim, I'll give you the medium story-
When I was a mod at a famous ESL board, there were a couple of bored assholes who took to trolling and spamming the place. I came down pretty hard on them as did the site admin and the other mods and they were permabanned. This didnt settle with them so they made it their life's goal to get back at their enemies.
They even went as far as to start using IP spoofers to get back on to that board and spam the place up again. Thanks to them, I got a crash course in how to track web abuse back to it's source.
Long after I stopped being a mod at that board, I made the mistake of setting up a forum of my own, they pretty much launched into what they called "A war" and I decided to make a game of it. I managed to make them and their IP spoofers the laughing-stock of the ESL community. In retrospect, I should have simply made things boring for them and deleted without comment, but at that time I was enjoying their little chess match.
After my board went down, and I told the ESL community to go to hell, they continued to harrass me and their other "enemies", and they do so to this day. Joey over at Modern Tales has had to ban more accounts because of them than I figure he has in the entire two years of TAC's existance, simply because I have a fourm there.
Did I mention that this started two years ago?
Anyway, they started their own little Troll's Club board, and one of them has made an account in my name, and is trying to pass themselves off as me. Even going so far as to use my images from my site as avatars, sigs, and in posts. Obviously, since it's being done with the site admin's support, asking him to remove the material is pointless. I've changed the name of the image he was using but he simply used another one.
I sent a complaint to the InVision board people to point out how he's violating their TOS by using my copyrighted materials without permission, but they stonewalled me on it. I guess his $100/ month was more important than their following their own rules.
So, I can either restrict access to my materials to them, or I can call a lawyer and see what I can do here in Canada to someone based out of Virginia. Option two is financially impossible for me (And we know how weak cyber law is) so I figure blocking them is my only option right now.
These guys are sick. They once wrote this long how-to about molesting children on an unmoderated board and stuck the name of one of their "enemies" on it. And one of them Googled my name and went to every board I was involved with at the time and told people I was a rapist. Including Derek Kirk Kim's private board. Since Derek was the first guy to give me some support when I started, this pissed me right off.
These people should not be allowed to breathe and if I ever get enough money to hunt them down, justice will be met. But for now, I'm powerless and can do little beside blocking their access to my site. _________________ Her lips are devil red, she's the color of mocha... |
|
| Back to top |
|
 |
ragtag Consistant Poster
Joined: 22 Jul 2001 Posts: 138 Location: Iceland
|
Posted: Wed Apr 07, 2004 3:01 am Post subject: |
|
|
Some people really need a live. It's funny how people think they can do and say anything when they're on the web without any consequences. I wish you the best of luck with getting rid of them.
Ragnar
p.s. Trolls turn to stone when they come into the sunlight.  |
|
| Back to top |
|
 |
William G Reinvents understanding
Joined: 15 Jan 2003 Posts: 560 Location: South central...Korea. Word.
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|