<?php
require'../config.php';
$align='left';
$title='Музыка!';
aut();
head();
who_add(0, 'enter'); ///кто онлайн
set_time_limit(0);

function isWml ()
{
    $mobile_agents = array(
        'w3c ','acs-','alav','alca','amoi','audi','avan','benq','bird','blac',
        'blaz','brew','cell','cldc','cmd-','dang','doco','eric','hipt','inno',
        'ipaq','java','jigs','kddi','keji','leno','lg-c','lg-d','lg-g','lge-',
        'maui','maxo','midp','mits','mmef','mobi','mot-','moto','mwbp','nec-',
        'newt','noki','oper','palm','pana','pant','phil','play','port','prox',
        'qwap','sage','sams','sany','sch-','sec-','send','seri','sgh-','shar',
        'sie-','siem','smal','smar','sony','sph-','symb','t-mo','teli','tim-',
        'tosh','tsm-','upg1','upsi','vk-v','voda','wap-','wapa','wapi','wapp',
        'wapr','webc','winw','winw','xda','xda-');

   return (preg_match('/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone)/i', $_SERVER['HTTP_USER_AGENT'])
            || ((strpos(strtolower($_SERVER['HTTP_ACCEPT']),'application/vnd.wap.xhtml+xml')>0) or ((isset($_SERVER['HTTP_X_WAP_PROFILE']) or isset($_SERVER['HTTP_PROFILE']))))
            || (in_array(strtolower(substr($_SERVER['HTTP_USER_AGENT'],0,4)),$mobile_agents)))
            && !(strpos(strtolower($_SERVER['HTTP_USER_AGENT']),'windows')>0);
}

$str = trim(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';

$pageTitle = 'Загрузка файла';
require('sys/head.php');
require('sys/classAudioFile.php');

echo 'Информация о файле<br />
Размер файла: '. round($get['Content-Length']/1024/1024,2).'Mb</br>';

if(filesize($data)!=$get['Content-Length'])
{
///echo 'Файл подготавливается информация не доступна!</br></br>';
} else {

$mp = new AudioFile;
$mp->loadFile($data);
$mp->printSampleInfo();

if(!isWml())
{
////echo '<object type="application/x-shockwave-flash" id="player1" allowscriptaccess="always" allowfullscreen="true" data="OriginalThinMusicPlayer.swf" width="220" height="21"><param name="movie" value="OriginalThinMusicPlayer.swf" /><param name="FlashVars" value="mediaPath='.$data.'" /></object>';
	echo '<object type="application/x-shockwave-flash" data="http://ucob.ru/ump3player_500x70.swf" width="470" height="80"><param name="wmode" VALUE="transparent" /><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="movie" value="http://ucob.ru/ump3player_500x70.swf" /><param name="FlashVars" value="way='.$data.'&swf=http://ucob.ru/ump3player_500x70.swf&w=470&h=70&time_seconds=0&autoplay=0&q=&skin=sky&volume=20&comment=" /></object>';
	
}
echo '
<a href="get-'.check($_GET['get']).'"><br /><b>Скачать mp3 файл</b></a>';

echo gb.'<a href="index.php">Назад к поиску</a>'.div;
}

include 'sys/copy.php';


	
echo gb.'<a href="'.H.'enter">Прихожая</a>'.div;
foot();
?>