Вход не выполнен.
Авторизируйтесь для закачки файлов.
(авторизация находиться выше)";
include_once("down.php");
exit;
}
$step = $_GET['step'];
if(isset($_POST['name_p']))
{
$sql = "SELECT * FROM `mus` WHERE `name` LIKE '%".$_POST['name']."%'";
$res = mysql_query($sql);
if(!$res) exit("Ошибка: ".mysql_error());
$i = 0;
While($result = mysql_fetch_array($res))
{
$i = $i + 1;
echo $i.") ".$result['name']." - ".$result['artist']."
";
}
ECHO "
Всего похожих ".$i;
exit ("
Вернуться");
}
if(isset($_POST['artist_p']))
{
$sql = "SELECT * FROM `mus` WHERE `artist` LIKE '%".$_POST['artist']."%'";
$res = mysql_query($sql);
if(!$res) exit("Ошибка: ".mysql_error());
$i = 0;
While($result = mysql_fetch_array($res))
{
$i = $i + 1;
echo $i.") ".$result['name']." - ".$result['artist']."
";
}
ECHO "
Всего похожих ".$i;
exit ("
Вернуться");
}
if($step == 1)
{
$artist = htmlspecialchars($_POST['artist']);
$name = htmlspecialchars($_POST['name']);
$album = htmlspecialchars($_POST['album']);
$year = htmlspecialchars($_POST['year']);
$genre = htmlspecialchars($_POST['genre']);
@unlink('./temp/'.$sesid.".mp3_");
if($name == "")
{
echo"Не введено название";
exit ("
Вернуться");
}
if($artist == "")
{
echo"Не введен исполнитель";
exit ("
Вернуться");
}
$valid_types = array("MP3", "mp3");
$filename = $_FILES['filename']['tmp_name'];
$ext = substr($_FILES['filename']['name'], 1 + strrpos($_FILES['filename']['name'], "."));
if (!in_array($ext, $valid_types))
{
echo 'Самый умный, да? А тебе череп не жмёт? Надо MP3-шки закачивать!!!';
exit();
}
if(copy($_FILES['filename']['tmp_name'],
'./temp/'.$sesid.".mp3"))
{
require_once 'MP3/Id.php';
$id3 = &new MP3_Id();
$result = $id3->read('./temp/'.$sesid.".mp3");
if (PEAR::isError($result) && $result->getCode() !== PEAR_MP3_ID_TNF)
{
die($result->getMessage() . "\n");
}
$id3->setTag('name', $name);
$id3->setTag('artists', $artist);
$id3->setTag('album', $album);
$id3->setTag('year', $year);
$id3->setTag('comment', '');
$id3->setTag('genre', $genre);
$id3->setTag('track', 1);
$result = $id3->write();
if (PEAR::isError($result))
{
die($result->getMessage() . "
");
}
$result = $id3->study();
if (PEAR::isError($result)) {
die($result->getMessage() . "
");
}
echo 'Название: ' . $name . "
";
echo 'Исполнитель: ' . $artist . "
";
echo 'Альбом: ' . $album . "
";
echo 'Год: ' . $year . "
";
echo 'Стиль: ' . $genre . "
";
echo 'MPEG ' . $id3->getTag('mpeg_ver') . ' Layer ' . $id3->getTag('layer') . "
";
echo $id3->getTag('mode') . "
";
echo 'Размер файла: ' . $id3->getTag('filesize') . " Bytes
";
echo 'Bitrate: ' . $id3->getTag('bitrate') . "kB/s
";
echo 'Длительность: ' . $id3->getTag('length') . " min
";
echo 'Samplerate: ' . $id3->getTag('frequency') . "Hz
";
// require_once 'MP3/pear/PEAR.php';
// require_once 'MP3/IDv2/Reader.php';
// require_once 'MP3/IDv2/Writer.php';
// require_once 'MP3/IDv2/Tag.php';
// require_once 'MP3/IDv2/Frame.php';
// require_once 'MP3/IDv2/Frame/TALB.php';
// require_once 'MP3/IDv2/Frame/TCOM.php';
// require_once 'MP3/IDv2/Frame/TCOP.php';
// require_once 'MP3/IDv2/Frame/TDAT.php';
// require_once 'MP3/IDv2/Frame/TIT2.php';
// require_once 'MP3/IDv2/Frame/TOAL.php';
// require_once 'MP3/IDv2/Frame/TORY.php';
// require_once 'MP3/IDv2/Frame/TPE1.php';
// require_once 'MP3/IDv2/Frame/TPE2.php';
// require_once 'MP3/IDv2/Frame/TYER.php';
// $tag = new MP3_IDv2_Tag();
// $fTALB = new MP3_IDv2_Frame_TALB();
// $fTALB->setText($album);
// $fTCOM = new MP3_IDv2_Frame_TCOM();
// $fTCOM->addComposer($artist);
// $fTCOP = new MP3_IDv2_Frame_TCOP();
// $fTCOP->setText($year);
// $fTDAT = new MP3_IDv2_Frame_TDAT();
// $fTDAT->setText($year);
// $fTIT2 = new MP3_IDv2_Frame_TIT2();
// $fTIT2->setText($name);
// $fTOAL = new MP3_IDv2_Frame_TOAL();
// $fTOAL->setText($album);
// $fTORY = new MP3_IDv2_Frame_TORY();
// $fTORY->setText($year);
// $fTPE1 = new MP3_IDv2_Frame_TPE1();
// $fTPE1->addArtist($artist);
// $fTPE2 = new MP3_IDv2_Frame_TPE2();
// $fTPE2->setText($artist);
// $fTYER = new MP3_IDv2_Frame_TYER();
// $fTYER->setText($year);
// $tag->addFrame($fTALB);
// $tag->addFrame($fTCOM);
// $tag->addFrame($fTCOP);
// $tag->addFrame($fTDAT);
// $tag->addFrame($fTIT2);
// $tag->addFrame($fTOAL);
// $tag->addFrame($fTORY);
// $tag->addFrame($fTPE1);
// $tag->addFrame($fTPE2);
// $tag->addFrame($fTYER);
// $writer = new MP3_IDv2_Writer();
// $writer->addTag($tag);
// $writer->write('./temp/'.$sesid.".mp3");
$sql = "INSERT INTO `mus` (`id`, `name`, `artist`, `album`, `year`, `size`, `admission`, `block`, `downloads`, `who_load`, `balls`) VALUES ('', '".$name."', '".$artist."', '".$album."', '".$year."', '".$id3->getTag('filesize')."', '0', '0', '0', '".$_SESSION["login"]."', '0')";
$res = mysql_query($sql);
if(!$res) exit("Ошибка: ".mysql_error());
$sql = "SELECT * FROM `mus` ORDER BY `id` DESC LIMIT 0 , 30";
$res = mysql_query($sql);
if(!$res) exit("Ошибка: ".mysql_error());
$result_id = mysql_fetch_array($res);
include_once("conftp.php");
$tmp = "./temp/".$sesid.".mp3";
//локальный файл
$aname = "/domains/musumi.net/public_html/mp3/".$result_id['id'].".mp3";
//файл на FTP
$res = ftp_put($connect, $aname, $tmp, FTP_BINARY);
if (!$res) echo "Ошибка. Файл не закачан";
else
{
echo $result['id'];
}
ftp_quit($connect);
@unlink('./temp/'.$sesid.".mp3");
@unlink('./temp/'.$sesid.".mp3_");
}
else
{
echo "Ошибка при загрузке, извините...";
}
include("down.php");
exit();
}
echo
'