Файл: downloads/file.php
Строк: 99
<?php
$title='Файл';
include_once '../system/head.php';
include 'classAudioFile.php';
$id = protect($_GET['id']);
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `files` WHERE `cat`='$id'"),0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
$query = mysql_query("select * from `files` WHERE `id`='$id' ORDER BY `id` DESC LIMIT $start, $set[p_str]");
$total = mysql_result(mysql_query("select count(*) from `files` WHERE `id`='$id'"),0);
if($total == 0)
{
echo '<div class="menu">Ошибка.</div>';
}
else
{
while ($row = mysql_fetch_assoc($query))
{
$path_parts = pathinfo(''.$row['file'].'');
$views=''.($row['view']+1).'';
mysql_query("UPDATE `files` SET `view`= '$views' WHERE `id`='$id'");
$cat = mysql_fetch_array(mysql_query("SELECT * FROM `cat` WHERE `id` LIKE '$row[cat]'"));
$podcat = mysql_fetch_array(mysql_query("SELECT * FROM `podcat` WHERE `id` LIKE '$row[podcat]'"));
echo'<div class="head">Файл - '.$row['name'].'</div>
<div class="menu"><small><a href="http://'.$_SERVER['HTTP_HOST'].'">Главная</a> / <a href="index.php">Загрузки</a> /
<a href="cat.php?id='.$row['cat'].'">'.$cat['name'].'</a> /
<a href="podcat.php?id='.$row['podcat'].'">'.$podcat['name'].'</a></small></div>';
if($user['level']=='1'){
echo'<div class="menu"><a href="/?mode=admin&fid=del_files&id='.protect($row['id']).'">[Удалить этот файл]</a><br>
<a href="/?mode=admin&fid=file&id='.$row['id'].'">[Редактировать этот файл]</a></div>';}
echo '<div class="menu">';
if($path_parts[extension] == 'mp3'
or $path_parts[extension] == 'wav'
or $path_parts[extension] == 'midi'
or $path_parts[extension] == 'ogg'
or $path_parts[extension] == 'wma'
or $path_parts[extension] == 'amr') // Если файл аудио
{echo '<object type="application/x-shockwave-flash" data="ump3player.swf" height="67" width="380">
<param name="wmode" value="transparent" /><param name="allowFullScreen" value="true" />
<param name="allowScriptAccess" value="always" /><param name="movie" value="/ump3player.swf" />
<param name="FlashVars" value="way='.$row[file].'&swf=ump3player.swf&w=380&h=67&&autoplay=0&q=&skin=grey&volume=100&comment=" />
</object><br/>';
$AF = new AudioFile;
$AF->loadFile($row[file]);
$AF->printSampleInfo();
echo'<br>';}
//////////////////////////////////
if($path_parts[extension] == 'jpg'
or $path_parts[extension] == 'bmp'
or $path_parts[extension] == 'jpeg'
or $path_parts[extension] == 'png'
or $path_parts[extension] == 'raw'
or $path_parts[extension] == 'tiff'
or $path_parts[extension] == 'tif'
or $path_parts[extension] == 'ico') // Если файл картинка
{echo'<a href="'.$row['file'].'"><img src="'.$row['file'].'" width="125" height="125" alt="'.$row['name'].'" /></a>';
$f=''.$row['file'].'';
$src = imagecreatefromjpeg($f);
$w_src = imagesx($src);
$h_src = imagesy($src);
echo '<br>Габариты : '.$h_src.' x '.$w_src.'<br />';}
//////////////////////////////////
if($path_parts[extension] == 'avi'
or $path_parts[extension] == 'flv'
or $path_parts[extension] == '3gp'
or $path_parts[extension] == 'mov'
or $path_parts[extension] == 'mp4'
or $path_parts[extension] == 'mpeg') // Если файл видео
{echo'<script type="text/javascript" src="script/script.js"></script>
<object type="application/x-shockwave-flash" data="player.swf" id="playerF">
<param name="quality" value="high">
<param name="allowfullscreen" value="true">
<param name="allowscriptaccess" value="sameDomain">
<param name="wmode" value="transparent">
<param name="flashvars" value="hq='.$row['file'].'&autoplay=true">
</object><br><br>';}
//////////////////////////////////
if($path_parts[extension] == 'txt') // Если файл текст
{$f = fopen("$row[file]", "r");
while(!feof($f)) {
echo'<b>';
echo fgets($f) . "<br /></b>";}
fclose($f);}
if($path_parts[extension] == 'jar')
{echo'<img src="icon.php?jar='.base64_encode(''.$row['file'].'').'"/>';}
//////////////////////////////////
if($path_parts[extension] == 'gif') // Если файл анимация
{echo'<a href="'.$row['file'].'"><img src="'.$row['file'].'" width="125" height="125" alt="'.$row['name'].'" /></a>';}
if(!empty($row[bitrate])){echo'<b>'.$row['bitrate'].'</b><br><br>';}
echo'<br/>Добавлен : '.clock($row['time']).'<br/>
Просмотров : '.$row['view'].'<br/>
Скачиваний : '.$row['down'].'<br/>
Категория : <a href="cat.php?id='.$row['cat'].'">'.$cat['name'].'</a><br/>
Папка : <a href="podcat.php?id='.$row['podcat'].'">'.$podcat['name'].'</a><br>
Скачать файл : <a href="down'.$row['id'].'">';
if(!empty($row['name'])){ echo ''.$row['name'].'';}else{echo'Неизвестный файл';}
echo'</a>';
echo'<br/>';
}
}
echo'</div>';
if ($k_page>1)str('?id='.$id.'&',$k_page,$page); // Вывод страниц
require_once '../system/foot.php';
?>