<?php
require'../config.php';
$align='left';
$title='Музыка!';
aut();
head();
who_add(0, 'enter'); ///кто онлайн
require('sys/classAudioFile.php');
require('sys/tr.php');
$str = check($_GET['get']);
$s = explode('-',$str);
if(strlen($s[2])>12)$err=1;
$url = 'http://'.$s[0].'.vkontakte.ru/'.$s[1].'/audio/'.$s[2].'.mp3';
$get = get_headers($url,1);
if($get['Content-Type']!='audio/mpeg' || $get[0]!='HTTP/1.1 200 OK' || $get['Content-Length']<=0)$err=1;
if(@$err==1){header('Location: index.php');exit;}
$data = 'get/'.$_SERVER['HTTP_HOST'].'_'.$s[2].'.mp3';
///header('Location: '.$url);exit; //Вариант без копирования файлов к вам
if(is_file($data) && filesize($data)==$get['Content-Length'])
{
$mp = new AudioFile;
$mp->loadFile($data);
$mp->getSampleInfo();
$mp->id3_title = trim($mp->id3_title);
if(!empty($mp->id3_title))
{
if(!is_file('temp/'.$_SERVER['HTTP_HOST'].'_'.r2l($mp->id3_title).'.mp3'))
{
copy($data,'temp/'.$_SERVER['HTTP_HOST'].'_'.r2l($mp->id3_title).'.mp3');
sleep(2);
}
header('Location: temp/'.$_SERVER['HTTP_HOST'].'_'.r2l($mp->id3_title).'.mp3'); exit;
}else{
header('Location: '.$data); exit;
}
} else {
include 'sys/head.php';
include 'sys/copy.php';
}
?>