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); }
$dbh = dbConnect(); mysql_query("update scheduler set active = '{$active}' where id = '{$id}' limit 1;", $dbh); dbClose($dbh); break; case 'traffic': $type = $_GET['type']; $smarty->caching = true; $smarty->cache_lifetime = 7200; # 2h $tpl = $a . '.tpl'; $cacheId = md5($a . $type); if (!$smarty->isCached($tpl, $cacheId)) { smartyAssignStd($smarty); smartyAssignMenu($smarty, $user); $dbh = dbConnect(); $traffic = getDbTable($dbh, 'traffic'); dbClose($dbh); $list = ''; $n = 0; $trafficTotal = 0; $typeOut = ''; switch ($type) { default: $type = 'days'; case 'days': $typeOut = 'Days'; break; case 'months': $typeOut = 'Months'; break; case 'years':