View Single Post
  #1  
Old 10-20-2001, 06:37 PM
auto auto is offline
 
Join Date: Nov 2001
Location: Los Angeles, CA
Posts: 85
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I know this has been discussed in the past.. but I feel the need to bring this up again [I wasn't involved in the previous discussion of this, so I have the right ]

I remember how great the hack was that converted the storage of avatars from db to folder...

The cons of doing the same to attachments is that if a person can upload an executable file and then executes it on the server, poop could happen. But what if I don't allow anything executable to be attached? these are the file types I allow on my site: gif jpg png txt zip bmp jpeg. This can in no way put the server in jeopardy [as far as I know, feel free to correct me if I am wrong ]
As a safety measure, we could also have a script such as this one included in this hack:

PHP Code:
 <?php

$folder
="samplefolderfile";
$filename=stripslashes(urldecode($QUERY_STRING));

if (
$filename=="") {
  die(
"<h1>Invalid File Request...</h1>");
}

//your domain
$domains="www.automotiveforums.com,automotiveforums.com,
            www.automotivecritics.com,automotivecritics.com"
;

$domainids explode(",",$domains);
$numdomain count($domainids);

//home domain information
$refr=getenv("HTTP_REFERER");
list(
$remove,$stuff)=split('//',$refr,2);
list(
$home,$stuff)=split('/',$stuff,2);

 
// print "home = $home<br>\n";

$good 0;
$counter 0;
$savecounter 0;

while (
$counter<$numdomain) {

 
// print "domains = $domainids[$counter]<br>\n";

  
if ($home!=$domainids[$counter]) {

  }
  if (
$home==$domainids[$counter]) {
     
$savecount $counter;
     
$good 1;
  }
  
$counter++;
}

if (
$good == 0) {
  die(
"<h1>Leecher!</h1>This file is from $domainids[$savecounter]");
}
else {

  
$fp=@fopen("http://".$domainids[$savecounter]."/".$folder."/".$filename,"r");

     if(
$fp) {
        if (
ereg(".mp3",$filename)) {
          
$xtype="audio/mpeg";
        }
        elseif(
ereg(".jpg",$filename)) {
          
$xtype="image/pjpeg";
        }
        elseif(
ereg(".zip",$filename)) {
          
$xtype="application/x-zip-compressed";
        }
        elseif(
ereg(".exe",$filename)) {
          
$xtype="application/x-msdownload";
        }
        else {
          
$xtype="application/octet-stream";
        }

        
Header("Content-Type: $xtype");
        
Header("Accept-Ranges: bytes");
        
Header("Content-Disposition: ; Filename=$filename");
        
readfile("http://".$domainids[$savecounter]."/".$folder."/".$filename);
     }
     else {
        die(
"file not found");
     }
}

?>

so all the attachments will be called not as a direct URL, but something like http://www.siteurl.com/vbulletin/attach.php?image.gif
this way, it will also serve as an anti-leech [that's the main function for the script above] and will keep the location of attachments unknown.


The reason I am asking for this hack is because some of my members are nuts and are attaching HUNDREDS, yes, HUNDREDS of images They are all quality and appropriate, and I have no problem with them.. but I just don't see why it should be in the database... lots of pain in the arse.

Thanks guys.
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01202 seconds
  • Memory Usage 1,808KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • 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
  • showpost_complete