示例#1
0
 function loadFiles()
 {
     $this->_dbhCheck();
     $res = mysql_query("select id from files where _packet = " . $this->data['id'] . " order by id;", $this->dbh);
     while ($row = mysql_fetch_assoc($res)) {
         #print "packet.loadFiles ".$row['id']."\n";
         $newfile = new dlfile($this->dbhConfig['DB_HOST'], $this->dbhConfig['DB_NAME'], $this->dbhConfig['DB_USER'], $this->dbhConfig['DB_PASS']);
         $newfile->loadById($row['id']);
         $this->files[$row['id']] = $newfile;
     }
     return $this->filesC();
 }
示例#2
0
文件: wget.php 项目: TheFox/phpdl
define('ANTIHACK', 1);
if (isset($_SERVER['SERVER_ADDR'])) {
    die('Hacking attempt.');
}
include_once './lib/config.php';
include_once './lib/functions.php';
include_once './lib/class.dlfile.php';
if (count($argv) >= 2) {
    print "\n";
    printd("start\n");
    $fileId = (int) $argv[1];
    if (!$fileId) {
        exit;
    }
    $dbh = dbConnect();
    $file = new dlfile($CONFIG['DB_HOST'], $CONFIG['DB_NAME'], $CONFIG['DB_USER'], $CONFIG['DB_PASS']);
    $hosters = getDbTable($dbh, 'hosters');
    dbClose($dbh);
    if ($file->loadById($fileId)) {
        $file->packetLoad();
        $packetDirBn = getPacketFilename($file->packet->get('id'), $file->packet->get('name'));
        $packetDownloadDir = 'downloads/loading/' . $packetDirBn;
        $packetFinishedDir = 'downloads/finished/' . $packetDirBn;
        printd("packet id: " . $file->packet->get('id') . "\n");
        printd("file id: {$fileId}\n");
        printd("download dir: '{$packetDownloadDir}'\n");
        printd("speed: " . $file->packet->get('speed') . "\n");
        printd("uri: '" . $file->get('uri') . "'\n");
        if (!file_exists($packetDownloadDir)) {
            mkdir($packetDownloadDir);
            chmod($packetDownloadDir, 0755);