Файл: fo/down.php
Строк: 193
<?
require'../config.php';
$align='left';
$title='Дизайнеру';
aut();
include '../style/head.php';
who_add(0,'down');
###############Проверка переменных###############
$file = check(intval($_GET['file']));
// Получаем инфу о файле
$file_info = mysql_fetch_assoc($db->sql_query('SELECT * FROM `fo_files` WHERE `id` = '.$file));
if(!is_file($file_info['path'])){
die('Файл не существует');
}
$cat2 = @$db->sql_fetchrow($db->sql_query("select * from `fo_cat2` where path = '".$file_info['infolder']."'" ));
$cat = @$db->sql_fetchrow($db->sql_query("select * from `fo_cat` where id = '".$cat2['fid']."'" ));
if($set['vip'] == $cat2 and $user['level'] < 4)
{
echo 'У вас нет доступа!';
exit;
}
$k_post=$db->sql_fetchfield($db->sql_query("select count(*) as num from fo_komm where file = '".$file."'"),0);
if (isset($_GET['komm'])){
if (isset($_GET['delk'])){
if($user[level]>=1){
$db->sql_query("DELETE FROM `fo_komm` WHERE `id` = '".intval($_GET['delk'])."'");
}
header ('Location: ?komm&'.SID);
}
if (isset($_POST['msg'])){
if (strlen2($_POST['msg'])>3){
if ($user['translit']==1)$_POST['msg'] = translit($_POST['msg']);
if ($db->sql_query ("INSERT INTO fo_komm (file,user_id,time,msg) VALUES ('$file','$user[id]','$time','".check($_POST['msg'])."')")){header ('Location: ?komm&'.SID); exit;
}else echo 'Ошибка!<br />';
}
}
if (empty($user['max'])) $user['max']=10;
$max = $user['max'];
$k_post=$db->sql_fetchfield($db->sql_query("select count(*) as num from fo_komm where file = '".$file."'"),0);
$k_page=k_page($k_post,$max);
$page=page($k_page);
$start=$max*$page-$max;
$r = $db->sql_query ("Select * from fo_komm where file = '".$file."' order by time desc LIMIT $start, $max");
if ($k_post == 0)echo 'Комментариев нет<br />';
$post_k=$start+1;
while($a = @$db->sql_fetchrow($r)){
echo links.''.nik($a[user_id]).'';
if($user[level]>=5)echo '<small><a href="?komm&delk='.$a['id'].'">[X]</a></small>';
echo '('.times($a['time']).')'.$div9;
echo text($a[msg]);
echo '<dl></dl>';
}
if ($k_page>1){
echo "<dl><dt></dt></dl>";
str('?komm&',$k_page,$page); // Вывод страниц
echo "<br /><dl><dt></dt></dl><br />";
}
if ($ver!='wml')echo '<form action="?komm&'.SID.'" method="post">';
if ($ver=='wml')echo '<br />Ваш комментарий:<br /><input name="msg'.$ref.'" maxlength="15" title="Text"/><br/>';
else echo '<br />Ваш комментарий:<br /><textarea cols="'.$user['pole2'].'" rows="'.$user['pole1'].'" name="msg"></textarea><br/><br />';
if ($ver=='wml'){
echo '<anchor title="go">Добавить<go href="?komm&'.SID.'" method="post">';
echo '<postfield name="msg" value="$msg'.$ref.'"/>
</go></anchor><br /><br />';
;
}else{
echo '<input type="submit" class="ibutton" value="Добавить"/></form><br /><br />';
}
echo $div1.'<a href="/fo/down/'.$file.'">К файлу</a>'.$div9;
echo gb.'<a href="/fo/'.$cat['id'].'/'.$cat2['id'].'">В категорию</a>'.$div9;
echo gb.'<a href="/fo">Дизайнеру</a>'.div;
include '../style/foot.php';
}
$ex = pathinfo($file_info['path']);
$ext = strtolower($ex['extension']);
$cat2 = @$db->sql_fetchrow($db->sql_query("select * from `fo_cat2` where path = '".$file_info['infolder']."'" ));
$cat = @$db->sql_fetchrow($db->sql_query("select * from `fo_cat` where id = '".$cat2['fid']."'" ));
echo menu.'<a href="/fo">Дизайнеру</a>|<a href="/fo/'.$cat['id'].'">'.$cat['name'].'</a>|<a href="/fo/'.$cat['id'].'/'.$cat2['id'].'">'.$cat2['name'].'</a>'.div;
##############Система голосований##############
if(isset($_GET['vote'])){
$ips = explode("|",$file_info['ips']);
if(in_array($user['user'] ,$ips) === false)
{
$vote = 0;
if(empty($file_info['ips'])){
$ipp = $user['user'];
}
else{
$ipp = $file_info['ips']."|".$user['user'];
}
if($_GET['vote']==0){
$str = 'UPDATE `fo_files` SET `no`=`no`+1,`ips`="'.$ipp.'" WHERE `id` = '.$file_info['id'];
}else if($_GET['vote']==1){
$str = 'UPDATE `fo_files` SET `yes`=`yes`+1,`ips`="'.$ipp.'" WHERE `id` = '.$file_info['id'];
}
$db->sql_query($str);
$vote = 1;
$file_info = mysql_fetch_assoc($db->sql_query('SELECT * FROM `fo_files` WHERE `id` = '.$file));
}
else $vote = 2;
}
###############Красивый размер###################
if($file_info['size'] < 1024)$file_info['size'] = $file_info['size'].' б';
else if($file_info['size'] < 1048576 and $file_info['size'] >= 1024)$file_info['size'] = round($file_info['size']/1024, 2).' Кб';
else $file_info['size'] = round($file_info['size']/1024/1024, 2).' Мб';
if(isset($_GET['deler'])) {
if($file_info[user_id]==$user[id] || $user[level]>=5){
$flag = unlink (''.$file_info['path'].'');
if($flag){
@$db->sql_query("delete from `fo_files` WHERE `id`='".$file."';");
$del="Файл успешно удален<br />";
$d = (user_inf($file_info['user_id'],'fo_files')-1);
$db->sql_query('UPDATE `users` SET `fo_files` = "'.$d.'" WHERE `id` = "'.$file_info['user_id'].'"');
}else{
$del_audio="Ошибка удаления файла<br />";
}
echo $del;
echo gb.'<a href="/fo">Дизайнеру</a>'.div;
include '../style/foot.php';
}
}
if ($vote==1) echo '<b>Спасибо,ваш голос учтен!</b><br />';
if ($vote==2) echo '<b>Вы уже голосовали за этот файл.</b><br />';
/*if ($ext =='jar') echo ' <img src="/fo/ic.php?lf='.$file['path'].'&file='.$file[id].'" alt=""/><br /><img src="/fo/ext/file.gif" alt=""/> <b>'.$file_info['name'].'</b>';
else */echo ' <img src="/fo/ext/file.gif" alt=""/> <b>'.$file_info['name'].'</b>';
if($file_info['user_id']==$user['id'] || $user['level']>=5){
echo '| <a href="?deler">Удалить файл</a>';
}
echo '<br />Описание: '.text($file_info['about']).'<br />';
if (user_inf($file_info[user_id],'sex')==1)$sex = 'Загрузил'; else $sex = 'Загрузила';
echo $sex.': '.nik($file_info['user_id']).'<br />';
echo 'Формат: '.ucfirst($ext).'<br />';
echo 'Размер: '.$file_info['size'].'<br />';
echo'Скачиваний: '.$file_info['loads'].'<br />';
if($file_info['timeload'])echo 'Последнее скачивание: '.times($file_info['timeload']).'<br />';
echo 'Время добавления: '.times($file_info['timeupload']).'<br />';
if ($ext == 'gif' or $ext == 'jpg' or $ext == 'jpeg' or $ext == 'jpe' or $ext == 'png') {
$arr = array('100x100','128x128','128x160','132x176','176x220','240x320');
list($w_src,$h_src)=getimagesize($file_info['path']);
echo '<img src="/fo/img.php?file='.$file.'" alt=""><br />Разрешение: '.$w_src.'x'.$h_src.' px<br/>';
echo 'Выбрать: ';
foreach($arr as $v)
{
list ($W,$H) = explode('x',$v);
echo '<a href="/fo/img.php?file='.$file.'&H='.$H.'&W='.$W.'">'.$v.'</a>|';
}
}
if ($ext == 'gif' or $ext == 'jpg' or $ext == 'jpeg' or $ext == 'jpe' or $ext == 'png'){
echo '<br />Особое:<form action="/fo/img.php" method="GET">
<input type="hidden" name="file" value="'.$file.'">
<input type="text" name="W" maxlength="3" size="3">x<input type="text" name="H" maxlength="3" size="3"> px<input type="submit" class="ibutton" value="Ok"></form>';
}
###############Инфа о mp3###########################
elseif($ext == 'mp3' or $ext == 'wav'){
if (
!$h_ua ||
strpos($h_ua, 'windows') !== false ||
strpos($h_ua, 'linux') !== false ||
strpos($h_ua, 'bsd') !== false ||
strpos($h_ua, 'x11') !== false ||
strpos($h_ua, 'unix') !== false ||
strpos($h_ua, 'macintosh') !== false ||
strpos($h_ua, 'macos') !== false)
{
echo 'Прослушка: <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0 " width="96" height="20" id="own_flashplayer" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<embed src="/fo/own_flashplayer_plc.swf?file=/fo/'.$file_info['path']. '&sta rtplay=false" quality="high" bgcolor="#0B91C4" width="96" height="20" name="own_flashplayer" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object><br />'; }
include 'classAudioFile.php';
$AF = new AudioFile;
$AF->loadFile($file_info['path']);
$AF->printSampleInfo();
}
// Видео (ffmpeg)
elseif(($ext == '3gp' || $ext == 'avi' || $ext == 'mp4') && extension_loaded('ffmpeg')){
$mov = new ffmpeg_movie($file_info['path']);
// 80x80
echo '<img src="/fo/ffmpeg.php?file='.$file.'" alt="*"><br />
Koдeк: '.$mov->getVideoCodec().'<br />
Paзpeшeниe: '.$mov->GetFrameWidth().' x '.$mov->GetFrameHeight().'<br />';
}
if(($ext == 'avi' || $ext == 'flv' || $ext =='swf' || $ext =='mp4') AND (
!$h_ua ||
strpos($h_ua, 'windows') !== false ||
strpos($h_ua, 'linux') !== false ||
strpos($h_ua, 'bsd') !== false ||
strpos($h_ua, 'x11') !== false ||
strpos($h_ua, 'unix') !== false ||
strpos($h_ua, 'macintosh') !== false ||
strpos($h_ua, 'macos') !== false))
{
echo '<object type="application/x-shockwave-flash" data="uflvplayer_500x375.swf" height="99" width="125">
<param name="bgcolor" value="#DFE6EF" /><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="movie" value="uflvplayer_500x375.swf" />
<param name="FlashVars" value="way=/fo/'.$file_info['path'].'&swf=uflvplayer_500x375.swf&w=400&h=300&pic=/fo/ffmpeg.php?file=/fo/'.$file_info['id'].'&autoplay=0&tools=1&skin=white&volume=70&q=&comment=" /></object><br />';
}
/*elseif($ext == 'thm' || $ext == 'nth'){
echo '<img src="/fo/theme.php?file='.$file.'" alt="*"><br />';
}*/
###############Голосование###########################
$i = @round(($file_info['yes'])/($file_info['yes']+$file_info['no'])*100,0);
echo 'Рейтинг файла : (+'.$file_info['yes'].'|-'.$file_info['no'].')<br />';
if ($vote==0) echo '[<a href="?vote=1"><img src="/img/plus.gif" alt="+"/>Плюс</a> | <a href="?vote=0">Минус<img src="/img/minus.gif" alt="-"/></a>]<br />';
echo '<br />';
###############Нарезка###########################
/*if($set['cut_change'] == 1)
{
if ($ext == 'mp3') print '<a href="cut.php?id='.$file.'"><b>Нарезка</b></a><br /> <a href="cut1.php?id='.$file.'&s=10&p=17&way=time"><b>Прослушать отрывок [7c.]</b></a><br />';
}
###############Просмотр архива####################
if($set['zip_change'] == 1)
{
if($ext == 'zip'){
print '<a href="zip.php?id='.$file.'"><strong>Просмотр архива</strong></a><br />';
}
}*/
##############txt##############
if($ext == 'txt'){
echo '<img src="/fo/ext/doc.png" alt=""/> <b><a href="/fo/read/'.$file_info['id'].'">Читать</a></b><br />';
/*echo'<a href="/fo/load/'.$file.'">Скачать TXT</a><br/>
<a href="/fo/txt_zip/'.$file.'">Скачать ZIP</a><br/>
<a href="/fo/txt_jar/'.$file.'">Скачать JAR</a><br/><br />';*/
}
###############Меню закачек#######################
if(empty($file_info['pass'])){
echo '<a href="/fo/load/'.$file.'"><img src="/fo/ext/load2.gif" alt=""/> <b>Скачать</b></a><br />';
echo '<input class="enter" size="20" type="text" value="http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/'.$file_info['path'].'"/><br />';
}else{
if($file_info['pass']!=$_POST['pass']){
$buy_ok = '';
if(isset($_GET['buy'])){
if ($user['rur']<$file_info['price']){$buy_ok = 'Недостаточно средств!';
}else{
// Забераем рубли
$rur = $user['rur']-$file_info['price'];
$db->sql_query('UPDATE `users` SET `rur` = "'.$rur.'" WHERE `id` = "'.$user['id'].'"');
// Начисляем рубли
$rur2 = user_inf($file_info['user_id'],'rur')+$file_info['price'];
$db->sql_query('UPDATE `users` SET `rur` = "'.$rur2.'" WHERE `id` = "'.$file_info['user_id'].'"');
$buy_ok = $file_info['pass'];
}
}
if(isset($_POST['pass']))echo '<b>Неверный пароль!</b><br />';
echo 'Файл защищен паролем!<br />';
if($file_info['price']!=0&&$buy_ok=='')echo '<a href="?buy">Купить пароль('.$file_info['price'].' рублей)</a><br />';
if ($ver!='wml')echo '<form action="?'.SID.'" method="post">';
echo 'Пароль:<br/>';
echo '<input type="text" name="pass" value="'.$buy_ok.'" maxlength="50" title="Пароль"/><br/>';
if ($ver=='wml'){
echo '<br /><anchor title="go">Скачать<go href="?'.SID.'" method="post">';
echo '<postfield name="pass" value="$pass"/>
</go></anchor>';
echo '<br/><br />';
}else{
echo '<br /><input type="submit" class="ibutton" value="Скачать"/></form><br /><br />';
}
}else{
echo '<a href="/fo/load/'.$file.'?pass='.$file_info['pass'].'"><img src="/fo/ext/load2.gif" alt=""/> <b>Скачать</b></a><br />';
echo '<input class="enter" size="20" type="text" value="http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/'.$file_info['path'].'"/><br />';
}}
echo '<br /><a href="?komm">Комментарии</a> ('.$k_post.')<br />';
echo "<br />";
echo gb.'<a href="/fo/'.$cat['id'].'/'.$cat2['id'].'">В категорию</a>'.div;
echo gb.'<a href="/fo">Дизайнеру</a>'.div;
include '../style/foot.php';
?>