Go Back   vb.org Archive > vBulletin Modifications > vBulletin 3.8 Modifications > vBulletin 3.8 Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Anti-Leech Attachments - prevent hotlinking and bandwidth theft! Details »»
Anti-Leech Attachments - prevent hotlinking and bandwidth theft!
Version: 1.1, by steadicamop steadicamop is offline
Developer Last Online: Dec 2014 Show Printable Version Email this Page

Category: Miscellaneous Hacks - Version: 3.6.x Rating:
Released: 06-13-2007 Last Update: 01-09-2009 Installs: 191
Uses Plugins Template Edits
 
No support by the author.

Title : Anti-Leech Attachments

Version : 1.1

Coder : Jason Williams

Purpose : Prevent your forum attachments from being directly linked to - prevent bandwidth abuse.

Why : Bandwidth can be expensive, plus I was frustrated with one of my members linking to three video clips on my forum from his own site, effectively abusing the bandwidth I pay for, so I set about a system that stops hotlinking, but at the same time, as a courtesy, providing a dynamic link to the post containing the attachment.

How : This could be replicated very easily using .htaccess but the one thing that it can't do is give you the link to the attachment itself. This mod displays a message informing the user that hotlinking is not allowed, then giving them the link to the post to view the attachment directly.

Known Issues : The security can be defeated by using the drop down style menu on the Anti Leech page - this has only been confirmed as an issue on Firefox. I have unsucessfully tried to find a way of removing the drop down on that page only.

Confirmed working with vBSEO 3.2.0.

Important : This has been tested on 3.6.2 and 3.8, I can presume it will be compatible with 3.7.x because it works on 3.8 - as always BACKUP FIRST!

Demo : http://www.steadiforum.com/attachmen...9&d=1180779148

Installation :

1. Import Product - product-antileech.xml
2. Save bandwidth!

File uploads : 0
Files to Import : 1
New Templates : 1
New Phrases : 2
Uses Hooks : 1
Uses Queries : 1

History :
v1.0 - Original release

v1.1 - Added enable/disable option, tested on VB 3.8

Done - if you like please click install! (and click Nominate for MOTM!)

Download Now

File Type: xml product-antileech.xml (3.4 KB, 728 views)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #52  
Old 01-15-2009, 12:17 PM
samuelss samuelss is offline
 
Join Date: Feb 2008
Posts: 40
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for the Mod. The options are not showing on my 3.80 also so there must be something somewhere.

Thanks.
Reply With Quote
  #53  
Old 01-16-2009, 03:28 PM
alik4277 alik4277 is offline
 
Join Date: Nov 2005
Location: Germany
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If you can not see option to enable Anti-Leech:

Go to AdminCP -> Plugin & Products -> Plugin Manager -> anti-leech Plugin

Replace all plugin code with
PHP Code:
    $ref str_replace('http://www.','',$_SERVER['SERVER_NAME']);
    if(!
strstr($_SERVER['HTTP_REFERER'],$ref)) {
        
$id $vbulletin->db->fetch_array($vbulletin->db->query_read("SELECT postid FROM ".TABLE_PREFIX."attachment WHERE attachmentid = ".mysql_escape_string($_REQUEST['attachmentid'])));
            eval(
'$navbar = "' fetch_template('navbar') . '";');
        eval(
'print_output("' fetch_template('antileech') . '");');
        exit;
    } 
Save
Reply With Quote
  #54  
Old 01-16-2009, 03:34 PM
MẪ$T?Я's Avatar
MẪ$T?Я MẪ$T?Я is offline
 
Join Date: Jan 2009
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

it`s nice :up:

will try it

ammm
Quote:
Important : This has been tested on 3.6.2 and 3.8, I can presume it will be compatible with 3.7.x because it works on 3.8 - as always BACKUP FIRST
backup for database ?

thanks
Reply With Quote
  #55  
Old 01-16-2009, 04:43 PM
YLP1 YLP1 is offline
 
Join Date: Aug 2004
Posts: 417
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Installed and just doing a test run. Woo Hoo! This is awesome!! Works like a charm... cept I still don't have the acp enable/disable to show --- I used the code snippet from a couple of posts abovea and that didn't allow this mod to show up in the vbacp either.
Reply With Quote
  #56  
Old 01-16-2009, 08:13 PM
samuelss samuelss is offline
 
Join Date: Feb 2008
Posts: 40
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by alik4277 View Post
If you can not see option to enable Anti-Leech:

Go to AdminCP -> Plugin & Products -> Plugin Manager -> anti-leech Plugin

Replace all plugin code with
PHP Code:
    $ref str_replace('http://www.','',$_SERVER['SERVER_NAME']);
    if(!
strstr($_SERVER['HTTP_REFERER'],$ref)) {
        
$id $vbulletin->db->fetch_array($vbulletin->db->query_read("SELECT postid FROM ".TABLE_PREFIX."attachment WHERE attachmentid = ".mysql_escape_string($_REQUEST['attachmentid'])));
            eval(
'$navbar = "' fetch_template('navbar') . '";');
        eval(
'print_output("' fetch_template('antileech') . '");');
        exit;
    } 
Save
I still cannot see this in my VBulletin Options on 3.8.0 even after i have changed the code as you mentioned above. I also noticed that "if ($vbulletin->options['al_disable'])" is missing from the code you quoted above.

Thanks
Reply With Quote
  #57  
Old 01-16-2009, 08:36 PM
alik4277 alik4277 is offline
 
Join Date: Nov 2005
Location: Germany
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

samuelss,
Replace, Save and test it
Reply With Quote
  #58  
Old 01-16-2009, 09:10 PM
samuelss samuelss is offline
 
Join Date: Feb 2008
Posts: 40
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks. I have replaced and saved with and without "if ($vbulletin->options['al_disable'])". I have also tried install and uninstall and nothing is still showing.

Thanks.
Reply With Quote
  #59  
Old 01-16-2009, 09:21 PM
alik4277 alik4277 is offline
 
Join Date: Nov 2005
Location: Germany
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You can nothing find.
Replace plugin code with mine code, save and open link to attach-file on new window
Reply With Quote
  #60  
Old 01-17-2009, 04:53 PM
Angel-Wings's Avatar
Angel-Wings Angel-Wings is offline
 
Join Date: Sep 2007
Posts: 206
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmmm - can't this be done already with htaccess ?

Something like:

Quote:
<FilesMatch "attachment\.php">
RewriteCond %{HTTP_REFERRER} !^http://(www\.)?example.com(/)?.*$ [NC]
RewriteRule .*\.*$ - [F,NC]
</FilesMatch>
And when using the filesystem as storage:

Quote:
<LocationMatch "/uploads">
RewriteCond %{HTTP_REFERRER} !^http://(www\.)?example.com(/)?.*$ [NC]
RewriteRule .*\.*$ - [F,NC]
</LocationMatch>
Or is there any difference like some additional check ? Reading the addon, if I understand it right you parse HTTP_REFERRER too via PHP, doing it directly via the Server is maybe less portable, but maybe also faster that PHP doesn't need to be called everytime.
Reply With Quote
  #61  
Old 02-02-2009, 05:00 AM
pipin's Avatar
pipin pipin is offline
 
Join Date: Jan 2005
Posts: 164
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by samuelss View Post
Thanks. I have replaced and saved with and without "if ($vbulletin->options['al_disable'])". I have also tried install and uninstall and nothing is still showing.

Thanks.
Same here with 3.8.1

Does not work and no Option in the vB Settings.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:53 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04645 seconds
  • Memory Usage 2,346KB
  • Queries Executed 26 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_php
  • (5)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (1)postbit_attachment
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete