<?
include "common.php";
if($sig || $song || $id){
if($id){
// download many.
// tar the files while sending.
include "$GLOBALS[lib_path]/audio-db.inc";
$adb = new AUDIO_DB;
$adb->connect("$GLOBALS[dbhost]","$GLOBALS[dbusername]","$GLOBALS[dbuserpassword]","$GLOBALS[dbname]");
$p = $adb->pull_md5path_to_filepath($id);
$disp_name = end(explode("/","$p"));
// a string to pass to the tar command.
while(each())
$files_string = "";
// the exec system call to tar the files.
exec("tar cf - $files_string");
}elseif($sig){
include "$GLOBALS[lib_path]/audio-db.inc";
$adb = new AUDIO_DB;
$adb->connect("$GLOBALS[dbhost]","$GLOBALS[dbusername]","$GLOBALS[dbuserpassword]","$GLOBALS[dbname]");
$p = $adb->pull_md5path_to_filepath($sig);
$disp_name = end(explode("/","$p"));
}elseif($song){
$rr_path = stripslashes(rawurldecode($r_path));
$rr_song = stripslashes(rawurldecode($song));
$p = "$GLOBALS[audio_folder]/$session_array[user_name]$rr_path/$rr_song";
$disp_name = "$rr_song";
}
header("Content-Type: audio/mpeg");
header("Content-Disposition: attachment; filename=$disp_name");
readfile("$p");
}
?>