View file download.php

File size: 5.4Kb
<?php
/*
------------------------------
##############################
-       Загруз Центр         -
-         by Kemel           -
##############################
------------------------------
*/
define('Loads',true);
require_once 'system/power.php';
if ($id) {
$sql = $db -> query("SELECT * FROM `loads` WHERE `id` = '".$id."' LIMIT 1");
if ($sql -> num_rows > 0) {
$music = $sql -> fetch_assoc();
switch($do) {
case 'true':
if ($aut || (isset($_SESSION['code']) && isset($_POST['code']) && $_SESSION['code'] == $_POST['code'])) {
$way = '/downloads/'.$music['janre'].'/'.$music['name'];
if (file_exists($_SERVER['DOCUMENT_ROOT'].$way)) {
$db -> query("UPDATE `loads` SET `loads` = (`loads`+1), `lastload` = '".time()."' WHERE `id` = '".$id."' LIMIT 1");
header('location: '.$way);
} else {
$diz -> head('Музыкальный портал');
$diz -> title($music['fullname']);
$diz -> out('Песня не найдена!');
}
} else {
$_SESSION['code'] = mt_rand(1000,9999);
$diz -> head('Музыкальный портал');
$diz -> title($music['fullname']);
$msg .= 'Для скачивания этой песни введите код с картинки:<br/>
<form action="download.php?do=true&amp;id='.$id.'" method="post"><div>
<img src="code.php" alt=""/>
<br/><input type="text" name="code" maxlength="5"/>
<br/><input type="submit" value="Скачать"/></div></form>';
$msg .= '<br/>'.$diz -> img('back.png').'<a href="download.php?id='.$id.'">Назад</a>
<br/>'.$diz -> img('home.png').'<a href="index.php">На главную</a>';
$diz -> out($msg);
}
break;
default:
$diz -> head('Музыкальный портал');
$diz -> title('Инфо о песне');
$diz -> line('<span style="font-weight: bold;">'.$music['fullname'].'</span>');
if (!empty($music['who'])) {
$who = '<span style="text-decoration:underline;">Загрузил:</span> '.$music['who'].'<br/>';
} else $who = '';
$msg .= '<script type="text/javascript" src="http://'.htmlspecialchars($_SERVER['HTTP_HOST']).'/mp3js.js"></script>
		<script type="text/javascript">
		AudioPlayer.setup
		(
			"http://'.htmlspecialchars($_SERVER['HTTP_HOST']).'/mp3player.swf",
			{
				width:"360",
				animation:"yes",
				encode:"no",
				initialvolume:"70",
				remaining:"yes",
				noinfo:"no",
				buffer:"5",
				checkpolicy:"no",
				rtl:"no",
				bg:"f8fcff",
				text:"000000",
				leftbg:"EBF0FD",
				lefticon:"5895cc",
				volslider:"5895cc",
				voltrack:"ffffff",
				rightbg:"EBF0FD",
				rightbghover:"EBF0FD",
				righticon:"5895cc",
				righticonhover:"5895cc",
				track:"FFFFFF",
				loader:"5895cc",
				border:"5895cc",
				tracker:"EBF0FD",
				skip:"ff284b",
				pagebg:"FFFFFF",
				transparentpagebg:"yes"
			}
		);
        </script>';

$filename = explode(' - ',str_ireplace('.mp3','',$music['fullname']));
#			    soundFile: "http://foxload.ru/downloads/'.$music['janre'].'/'.$music['name'].'",
$msg .= '<p id="audioplayer_1">Alternative content</p>
<script type="text/javascript">
		AudioPlayer.embed
		(
			"audioplayer_1",
			{
			    soundFile: "http://'.htmlspecialchars($_SERVER['HTTP_HOST']).'/downloads/'.$music['janre'].'/'.$music['name'].'",
			    titles: "'.$filename[0].'",
			    artists: "'.$filename[1].'",
			    autostart: "no"
			}
		);
		</script><br/>';
$msg .= '
<span style="text-decoration:underline;">Звук:</span> '.$music['mode'].'<br/>
<span style="text-decoration:underline;">Размер:</span> '.$func -> size($music['size']).'<br/>
<span style="text-decoration:underline;">Битрейт:</span> '.$music['bit'].' кбит/сек<br/>
<span style="text-decoration:underline;">Длительность:</span> '.$music['length'].'<br/>
<span style="text-decoration:underline;">Частота дискретизации:</span> '.$music['frequency'].' Гц<br/>
<span style="text-decoration:underline;">Жанр:</span> '.$janre[$music['janre']].'<br/>
'.$who.'
<span style="text-decoration:underline;">Скачиваний:</span> '.$music['loads'].'<br/>
<span style="text-decoration:underline;">Посл.скач:</span> '.$func -> times(date('d m Y H:i:s',$music['lastload'])).'<br/>
'.$diz -> img('mp3.png').'<a href="download.php?do=true&amp;id='.$id.'">Скачать</a>';
if ($aut && $ya['right'] > 2) {
$msg .= '<br/>'.$diz -> img('editpaste.png').'<a href="admin.php?do=janre&amp;id='.$music['id'].'">Сменить жанр</a>
<br/>'.$diz -> img('rename.png').'<a href="admin.php?do=rename&amp;id='.$music['id'].'">Переименовать</a>
<br/>'.$diz -> img('remove.png').'<a href="admin.php?do=del&amp;id='.$music['id'].'">Удалить</a>';
}
$msg .= '<br/><a href="index.php?do=avtor&amp;who='.mb_substr($music['fullname'],0,1).'">'.mb_substr($music['fullname'],0,1).'</a>';
$fullname = str_replace('%','',mb_substr($music['fullname'],0,round(mb_strlen($music['fullname'])/2)));
$poh = $db -> query("SELECT `id`,`fullname` FROM `loads` WHERE `fullname` LIKE '%".$fullname."%' AND `id` != '".$id."'");
if ($poh -> num_rows > 0) {
$k = 1;
$msg .= '<div class="new">Похожие треки</div>';
while ($ass = $poh -> fetch_assoc()) {
$msg .= $k.') <a href="download.php?id='.$ass['id'].'">'.$ass['fullname'].'</a><br/>';
++$k;
}
}
$msg .= '<br/>'.$diz -> img('home.png').'<a href="/index.php">На главную</a>';
$diz -> out($msg);
}
} else header('location: index.php');
} else header('location: index.php');
?>