File size: 2Kb
<?
Error_Reporting(E_ALL & ~E_NOTICE);
include("modul/id.php");
include("func.php");
include("set.php");
include("start.php");
include("modul/head.php");
if($ver=='wml') print "<b>Нарезка</b><br/>"; else print "<div class=\"c\">Нарезка MP3<br/></div><br/>";
if(is_file("$dir_load/$did/$fid") && rsh($fid)=='mp3')
{
$dir = $dir_mp3_cut;
$rand = date("U").'_'.rand(100000,99999999).rand(10,999).".mp3";
$fnew = "$dir/$rand";
$file = "$dir_load/$did/$fid";
if($fi=fopen($file,"rb"))
{
$raz = filesize($file);
$s = intval($s);
$p = intval($p);
if($sposob=="size")
{
$s = $s*1024;
$p = $p*1024;
if($s>$raz||$s<0) $s = 0;
if($p>$raz||$p<$s) $p = $raz;
}
else
{
$id3 = new MP3_Id();
$result = $id3->read($file);
$result = $id3->study();
$byterate = $id3->getTag('bitrate')/8;
$secbit = $raz/1024/$byterate;
if($s>$secbit||$s<0){$s = 0;}
if($p>$secbit||$p<$s){$p = $secbit;}
$s = $s*$byterate*1024;
$p = $p*$byterate*1024;
}
$p = $p-$s;
fseek($fi, $s);
$filefp = @fread($fi, $p);
fclose($fi);
$fp=fopen($fnew,"xb");
if(!fwrite($fp, $filefp) === FALSE)
{
$fs=real_size($p);
$link=str_replace("//","/","$set_site_dl/$dir_down/$fnew");
print "<div class=\"b\">Файл успешно нарезан!<br/>Размер: $fs<br/>
<a href=\"http://$link\">Скачать</a><br/>
<input type=\"text\" class=\"itext\" name=\"link\" value=\"http://$set_site/$dir_down/$fnew\"/><br/></div>";
} else print "Ошибка. Возможно введены неверные данные.<br/>";
@fclose($fp);
@chmod($fnew,0777);
} else print "Ошибка при открытие mp3<br/>";
}
else print "Файл не найден или это не MP3.<br/>";
print "<a href=\"info.php?did=$did&fid=$fid&pg=$pg\">Назад</a><br/>";
include("modul/foot.php");
?>