コード例 #1
0
ファイル: share.php プロジェクト: Rapiddot/ruTorrent
<?php

if (!isset($_GET['uh'])) {
    die('Invalid link');
}
$_SERVER['REMOTE_USER'] = base64_decode($_GET['uh']);
require_once dirname(__FILE__) . "/../../php/util.php";
require_once dirname(__FILE__) . "/../filemanager/flm.class.php";
include dirname(__FILE__) . '/share.class.php';
$f = new FSHARE();
if (!isset($_GET['s']) || !isset($f->data[$_GET['s']]) || $f->data[$_GET['s']]['expire'] < time()) {
    die('No such file or it expired');
}
function authenticate()
{
    header('WWW-Authenticate: Basic realm="LEAVE USERNAME EMPTY!! Password only!"');
    header('HTTP/1.0 401 Unauthorized');
    echo "Not permitted\n";
    exit;
}
if (!isset($_SERVER['PHP_AUTH_USER']) || $_SERVER['PHP_AUTH_PW'] != $f->data[$_GET['s']]['password']) {
    authenticate();
} else {
    $f->workdir = '';
    $f->send_file($f->data[$_GET['s']]['file']);
}
コード例 #2
0
ファイル: fsh.php プロジェクト: ravenstar/rutorrent-essential
<?php

require_once dirname(__FILE__) . "/../../php/cache.php";
require_once dirname(__FILE__) . "/../filemanager/flm.class.php";
include dirname(__FILE__) . '/share.class.php';
include dirname(__FILE__) . '/conf.php';
if (!isset($_POST['action'])) {
    die('Invalid action');
}
$f = new FSHARE();
switch ($f->postlist['action']) {
    case 'list':
        $f->show();
        break;
    case 'del':
        $f->del($f->postlist['target']);
        $f->show();
        break;
    case 'add':
        $f->add($f->postlist['file'], $f->postlist['target'], $f->postlist['to']);
        $f->show();
        break;
    case 'edit':
        $f->edit($f->postlist['file'], $f->postlist['target'], $f->postlist['to']);
        $f->show();
        break;
    default:
        die('Invalid action');
}