MyBB Community Forums

Full Version: [REQUEST] Attachment mod, anti-hotlinking
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey guys,

I am looking for a modification that would help against hotlinking.

For example, say someone uploads a picture through a post attachment on your forum and the URL is "http://yourforum.com/attachment.php?aid=1"

Well, lets say they try to post it on another forum or post it using HTML on a webpage, if they use the image source URL as "http://yourforum.com/attachment.php?aid=1" it's obviously going to go through and display the image.

What I am requesting is a mod that checks if the viewer is coming from the forum domain or not, if it is it displays the attachment fine. If the person trying to view the image is not on the forums because it is remotely posted somewhere other than the forum it shows up as a custom anti-hotlinking image or a custom page that redirects to the forum.

Can anyone help out?
I think this would be extremely useful towards MyBB, maybe even something that could someday be included officially with it. It would really be a bandwidth-saver!
You should be able to prevent hotlinking with htaccess. Also you can restrict attachments to only logged in registered users.
I'm not sure how to do that with htaccess.

And isn't the restrictment on attachments only to upload them, not view them?
AndyM3 Wrote:And isn't the restrictment on attachments only to upload them, not view them?
Admin CP -> Forum Permissions -> *edit a selected usergroup* -> (Second option down) Can Download Attachments

Smile
Alright thanks guys, I just tested it from here and it does work. But is there any way I can make an anti-hotlinking image come up if someone else externally links to it?
AndyM3 Wrote:Alright thanks guys, I just tested it from here and it does work. But is there any way I can make an anti-hotlinking image come up if someone else externally links to it?

http://www.htmlbasix.com/disablehotlinking.shtml

^ Just something I pulled from g00gle. Smile
Try this plugin.

It should stop people hotlinking even if guests are allowed to download attachments. (Or if, for some strange reason, .htaccess doesn't work)

It works by checking to referer to the server name, so it may not work with some server configurations, but that problem should be rare, or non-existant.

It also has an option to redirect any browsers to any file, image, or webpage. Smile (Sadly not both Sad)
i have found a way around hotlinking. if you view the source and find the source of the file that you want for example if you want a picture right click and view the source then scroll down and find the place where the image has been embedded.

<img src="http://mywebsite.com/myimg.jpg">


highlight the source and right click and copy that. then open up a text and write <a href="http://mywebsite.com/myimg.jpg"> name of image</a>
save it on the desktop with an .html extension then open the file up and right click on the target and save as and you have the file without any need to hotlink!!!

you can do this with any file anywhere!!!!!!

hotlink protection is useless!!!!!!!!!!!!!!!!!!!!!!!!