TorrentFlux.com Welcome, Guest. Please login or register.
02-09-2010, 03:10:23
Home Help Search Login Register donate
TorrentFlux Home | TorrentFlux Hosting

+  TorrentFlux Forums
|-+  Code Hacks and Tools
| |-+  TorrentFlux 1.x Hacks
| | |-+  Direct HTTP download, no FTP needed.
« previous next »
Pages: [1] Go Down Print
Author Topic: Direct HTTP download, no FTP needed.  (Read 49303 times)
art0rz
Newbie
*
Offline Offline

Posts: 1



View Profile
« on: 02-06-2006, 05:21:27 »

I've configured TF not to store files in a public place (not public_html/*), and since I can't be arsed opening my FTP client each time a torrent has finished downloading, I've created this little script which allows you to download if right off the HTTPd, without having to use FTP.

Note: PHP is not my native programming language, and this is a very basic script.

  • Open dir.php
  • After checkUserPath(); add
    if ($_GET['download'])
    {
       if(IsAdmin($cfg["user"]) || preg_match("/^" . $cfg["user"] . "/",$del))
       {
          $file = $cfg["path"] . $_GET{'download'};
          header("Content-type: application/octet-stream");
          header("Content-Disposition: attachment; filename=\"".$_GET['download']."\"");
          header('Content-Length: ' . filesize($file));
          $contents = file_get_contents($file);
          
          echo $contents;
          die;
       }
       else
       {
          header("Location: index.php");
          die;
       }
    }
  • Change line 222 to
    echo "<tr bgcolor=\"".$bg."\"><td><img src=\"".$image."\" width=\"16\" height=\"16\" alt=\"".$entry."\" border=\"0\"><a href=\"dir.php?download=".urlencode($_GET['dir']."/".$entry)."\" alt=\"\">".$entry."</a></td>";
  • Upload

That's it, I think. Tell me if I've missed something or it doesnt work.

Not tested on win32 boxen but I'm sure it'll work fine.
Logged
coder
Newbie
*
Offline Offline

Posts: 3



View Profile
« Reply #1 on: 06-11-2007, 21:15:36 »

sorry i can modify ! you can pater owen page of your ! it dir.php. i modify and have Erro !
Logged
Pages: [1] Go Up Print 
« previous next »
Jump to:  


Login with username, password and session length

Powered by MySQL Powered by SMF 1.1.1 | SMF © 2006, Simple Machines LLC Powered by PHP