コード例 #1
0
/*
 Copyright (c) 2001 - 2006 Ampache.org
 All rights reserved.
 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License v2
 as published by the Free Software Foundation.
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/
require $_SERVER['DOCUMENT_ROOT'] . "/amfphp/services/ampache/AmpacheService.php";
$as = new AmpacheService();
$id = $_GET['id'];
$user = $_GET['user'];
$password = $_GET['password'];
$type = $_GET['type'];
if ($type == "cover") {
    $imagetype = "art";
    $cover = $as->getAlbum($user, $password, $id);
    header("Content-type: " . $cover[$imagetype . '_mime']);
    echo $cover[$imagetype];
} else {
    $song = $as->getSong($user, $password, $id);
    $file = $song['file'];
    $fp = fopen($file, 'r');
    header("Accept-Ranges: bytes");
    header("Content-Length: {$song->size}");
コード例 #2
0
<?php

require $_SERVER['DOCUMENT_ROOT'] . "/amfphp/services/ampache/AmpacheService.php";
require_once 'getid3/getid3/getid3.php';
$as = new AmpacheService();
$user = $_POST['user'];
$password = $_POST['password'];
$catalog = $_POST['catalog'];
$folder = $_POST['folder'];
echo "has access" . $as->hasAccess($user, $password) . ";" . $user . ":" . $passsword;
if ($as->hasAccess($user, $password)) {
    $cat_folder = $as->getPathFromCatalog($user, $password, $catalog);
    // fix windows mode
    if ($as->winfs) {
        $separator = "\\";
    } else {
        $separator = "/";
    }
    echo "sep: " . separator . ";" . $as->winfs;
    $path = $cat_folder . $separator . $folder;
    $index = "Filedata";
    $filename = $_FILES[$index]["name"];
    $filesize = $_FILES[$index]["size"];
    $tmpname = $_FILES[$index]["tmp_name"];
    $fullname = $path . $separator . $filename;
    if (preg_match('/\\.mp3$/', $filename)) {
        echo "catfolder: " . $cat_folder . "\n";
        echo "folder: " . $path . "\n";
        echo "fullname: " . $fullname . "\n";
        if (!is_dir($path)) {
            mkdir($path);