Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
VERY quick avatar/attachment protector Details »»
VERY quick avatar/attachment protector
Version: 1.00, by CJi CJi is offline
Developer Last Online: Nov 2023 Show Printable Version Email this Page

Version: 2.2.x Rating:
Released: 07-13-2002 Last Update: Never Installs: 4
 
No support by the author.

This has probably been written before (I haven't checked), but I am beginning to get annoyed with people linking to my attachments/users avatars. It's quick, it's dirty, and it works. Installation time: 15 seconds per file. Number of files to edit: 2.

PHP Code:
$referers = array ('www.yourforums.com','yourforums.com','aaa.bbb.ccc.ddd'); 

function 
check_referer($referers){ 
   if (
count($referers)){ 
      
$found false
      
$temp explode('/',getenv("HTTP_REFERER")); 
      
$referer $temp[2]; 
      for (
$x=0$x count($referers); $x++){ 
         if (
ereg ($referers[$x], $referer)) { 
            
$found true
         } 
      } 
      if (!
$found){ 
      exit;
      } 
         return 
$found
      } else { 
         return 
true;
   } 


check_referer($referers); 
Edit the $referers array with your details (DOMAINS and IP Addresses ONLY. Do NOT include path information or 'http://').

Place at the top of avatar.php and attachment.php just after:

PHP Code:
<?php
Hope this is of help to some people.

Show Your Support

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

Comments
  #32  
Old 10-24-2002, 03:24 AM
Mr_P Mr_P is offline
 
Join Date: Jan 2002
Location: Uk.
Posts: 202
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by omniweapon
I installed this hack, but users are complaining saying they can't see the images even when they're on the forum. And I've put these in the referrers array:

www.ppgworld.com , ppgworld.com , 206.126.4.17

The forums are located on forums.ppgworld.com
easy answer tell em to allow your site though their firewall not sure how it works but thats all i did and it works.

Before nobodys avator showed up so allowed pass on firewall and they all show now.
Reply With Quote
  #33  
Old 10-31-2002, 08:10 AM
SWFans.net's Avatar
SWFans.net SWFans.net is offline
 
Join Date: Oct 2001
Posts: 243
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I like the array set up of this one over how the other hot link prevention hack functions, but this hack just doesn't work for me, even with no firewall. No matter what, I get the echoed text I added so I could see what was going on.
PHP Code:
$referers = array ('www.sw-fans.net','sw-fans.net','swforums.net','www.swforums.net'); 

function 
check_referer($referers){ 
   if (
count($referers)){ 
      
$found false
      for (
$x=0$x count($referers); $x++){ 
      
$temp explode('/',getenv("HTTP_REFERER")); 
      
$referer $temp[2];
         if (
ereg ($referers[$x], $referer)) { 
            
$found true
         } 
      } 
      if (!
$found){
      echo 
"No hot linking allowed"
      exit;
      } 
         return 
$found
      } else { 
         return 
true;
   } 


check_referer($referers); 
Reply With Quote
  #34  
Old 12-29-2002, 09:15 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You moved this line up a few lines from the original code, that is probably why you can get it to work.

Code:
for ($x=0; $x < count($referers); $x++){
Reply With Quote
  #35  
Old 01-25-2003, 05:14 PM
Gutspiller's Avatar
Gutspiller Gutspiller is offline
 
Join Date: Dec 2001
Posts: 1,046
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I can't get this hack to work over multiple domains. I tested it using one and it worked for me, so I now know it's working, but when I add a second domain like this:

PHP Code:
$referers = array ('www.theforumz.com','theforumz.com','209.197.232.166','www.3dnewz.com','3dnewz.com'); 
It still doesn't work from 3dNewz.com. I didn't add the ip of 3dnewz.com because 3dnewz.com just redirects to TheForumz.com

Can somebody help me on how to get this to work with multiple domains? I have about 5 I need to add to this hack. Please help.
Reply With Quote
  #36  
Old 01-31-2003, 03:53 PM
smestas smestas is offline
 
Join Date: Nov 2002
Posts: 38
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

CJi,

Thank you for this hack. It worked perfect firt time!

Thanks!
Reply With Quote
  #37  
Old 03-24-2003, 04:54 PM
laycomp laycomp is offline
 
Join Date: Mar 2003
Posts: 40
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Very much help indeed, THANK YOU CJi!! :knockedout:
Reply With Quote
  #38  
Old 03-25-2003, 03:54 PM
laycomp laycomp is offline
 
Join Date: Mar 2003
Posts: 40
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I am having some problems.

I am using vb 2.3, I cannot get link protection for either avatar or attachment.

The avatars appear in my forum as typical "miising image" icons, I have worked with many perl/php scripts and well aware on entering referers for protection, I however, cannot get this too work. As far as attachments, when someone clicks, from the forum, an attachment link, he goes into a blank page.

I have tried my domain, my IP...you name it.

I do have a router.

Any suggestions please?

Regards,

LC
Reply With Quote
  #39  
Old 04-27-2003, 09:07 PM
CJi CJi is offline
 
Join Date: Oct 2001
Posts: 73
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

To be honest, for ultimate protection it's best to use htaccess. What you need to bear in mind is users can choose to withold, or even warp referrers, so hacks like this will never work. It's annoying, but 'one of those things'
Reply With Quote
  #40  
Old 04-28-2003, 12:41 AM
NanoEntity NanoEntity is offline
 
Join Date: Oct 2001
Posts: 65
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

There is a very simple way, you can do it with .htaccess, even diplay an image of your choice on a website that is linking your image.

Can protect whole domain or just 1 folder.

Anyways, nicely done
Reply With Quote
  #41  
Old 04-28-2003, 12:46 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Today at 08:41 PM NanoEntity said this in Post #39
There is a very simple way, you can do it with .htaccess, even diplay an image of your choice on a website that is linking your image.

Can protect whole domain or just 1 folder.

Anyways, nicely done
How would you do that?
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 07:49 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05041 seconds
  • Memory Usage 2,324KB
  • Queries Executed 25 (?)
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
  • (1)bbcode_code
  • (4)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)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
  • (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_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete