Файл: test.masteram.us/obmen/index.php
Строк: 202
<?
include '../Core.php';include_once '../sys/inc/obmen.php';
$show_all=true; // показ для всех
$id = intval($_GET['id']);
if (!$id) {
$d['dir'] = '/';
$d['upload'] = '0';
} else {
$d = mysql_fetch_assoc(mysql_query('SELECT * FROM `obmennik_dir` WHERE `id` = '.$id.' LIMIT 1'));
}
$_SESSION['page']=1;
//// Информация файла
if(isset($_GET['id']) && isset($_GET['f'])){
$files = mysql_fetch_array(mysql_query('SELECT * FROM `obmennik_files` WHERE `id` = '.intval($_GET['f']).' LIMIT 1'));
$set['title']='Зона Обмена - '.$files['name']; // заголовок страницы
include_once '../sys/inc/thead.php';
title();
##############Рейтинг файла#####################
if (isset($user) && $user['id']!=$ank['id'] && mysql_result(mysql_query("SELECT COUNT(*) FROM `obmennik_rating` WHERE `id_user` = '$user[id]' AND `id_files` = '$files[id]'"), 0)==0)
{
if (isset($_GET['rating']) && $_GET['rating']=='plus'){
mysql_query("UPDATE `obmennik_files` SET `rating` = '".($files['rating']+1)."' WHERE `id` = '$files[id]' LIMIT 1",$db);
mysql_query("INSERT INTO `obmennik_rating` (`id_user`, `id_files`) values('$user[id]', '$files[id]')",$db);
msg ('Ваш голос учтен');
}
elseif(isset($_GET['rating']) && $_GET['rating']=='minus'){
mysql_query("UPDATE `obmennik_files` SET `rating` = '".($files['rating']-1)."' WHERE `id` = '$files[id]' LIMIT 1",$db);
mysql_query("INSERT INTO `obmennik_rating` (`id_user`, `id_files`) values('$user[id]', '$files[id]')",$db);
msg ('Ваш голос учтен');
}
}
################################################
include_once 'inc/file_act.php';
$ras=$files['ras'];
$file=H."obmen/files/".retranslit($files['name']).".$ras";
$name=$files['name'];
$size=$files['size'];
$ank=get_user($files['id_user']);
echo "<div class='tmn'>";
echo "<a href='/obmen/'>Обменник</a> | ".obmen_path($d['dir'])."<br />n";
echo "</div>n";
if(is_file("inc/file/$ras.php"))include "inc/file/$ras.php";
else
include_once 'inc/file.php';
echo "<div class='linechat'>";
##############Рейтинг файла#####################
echo "Рейтинг:n";
if (isset($user) && $user['id']!=$ank['id'] && mysql_result(mysql_query("SELECT COUNT(*) FROM `obmennik_rating` WHERE `id_user` = '$user[id]' AND `id_files` = '$files[id]'"), 0)==0)
{
echo "[<a href="?rating=minus" title="Отдать отрицательный голос">-</a>] ";
echo "<b>$files[rating]</b>";
echo " [<a href="?rating=plus" title="Отдать положительный голос">+</a>]<br/>";
}
else echo "<b>$files[rating]</b><br/>";
################################################
echo "Добавил: <a href='/info.php?id=$ank[id]'>$ank[nick]</a><br/>n";
echo "<img src='/obmen/fail.gif' alt=''/>n";
echo "<a href='/obmen/files/$files[id_dir]/$files[id]/".retranslit($files['name']).".$files[ras]'>Скачать</a> (".size_file($size).")n";
echo "</div>";
include_once 'inc/komm.php';
echo "<div class='tmn'>";
echo "<a href='/obmen/'>Обменник</a> | ".obmen_path($d['dir'])."<br />n";
echo "</div>n";
include_once 'inc/file_form.php';
}else{ //// Выводим категории и папки
if (!$id) $set['title']='Зона Обмена'; // заголовок страницы
else $set['title']='Зона Обмена - '.$d['name']; // заголовок страницы
include_once '../sys/inc/thead.php';
title();
include 'inc/upload_act.php';
include 'inc/admin_act.php';
err();
if(!$id){
echo "<div class='tmn'>";
$k_p=mysql_result(mysql_query("SELECT COUNT(*) FROM `obmennik_files`",$db), 0);
$k_n= mysql_result(mysql_query("SELECT COUNT(*) FROM `obmennik_files` WHERE `time` > '".(time()-60*60*$set['loads_new_file_hour'])."'",$db), 0);
if ($k_n==0)$k_n=NULL;
else $k_n='+'.$k_n;
echo "<img src='/style/obmen/018.png' alt=''/> Bсего файлов <font color='red'>$k_p</font><br/>";
echo "<img src='/style/obmen/083.png' alt=''/>n";
echo "<a href='/obmen/new.php'> Новые файлы</a>n";
echo "<font color='red'>$k_n</font>";
echo "</div>n";
}
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `obmennik_dir` WHERE `dir_osn` = '$d[dir]'"),0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
$k_dir=$k_post;
if($id){
echo "<div class='tmn'>";
echo "<a href='/obmen/'>Обменник</a> | ".obmen_path($d['dir'])."<br />n";
echo "</div>n";
}
$q=mysql_query("SELECT * FROM `obmennik_dir` WHERE `dir_osn` = '$d[dir]' ORDER BY `name`");
while ($post = mysql_fetch_array($q))
{
echo "<div class='linechat'>";
echo "<img src='/obmen/dir.png' alt='' /> <a href='/obmen/$post[id]/'>$post[name]</a>n";
$k_f=0;
$k_n=0;
$q3=mysql_query("SELECT * FROM `obmennik_dir` WHERE `dir_osn` like '$post[dir]%'");
while ($post2 = mysql_fetch_array($q3))
{
$k_f=$k_f+mysql_result(mysql_query("SELECT COUNT(*) FROM `obmennik_files` WHERE `id_dir` = '$post2[id]'"),0);
$k_n=$k_n+mysql_result(mysql_query("SELECT COUNT(*) FROM `obmennik_files` WHERE `id_dir` = '$post2[id]' AND `time` > '".(time()-86400)."'",$db), 0);
}
$k_f=$k_f+mysql_result(mysql_query("SELECT COUNT(*) FROM `obmennik_files` WHERE `id_dir` = '$post[id]'"),0);
$k_n=$k_n+mysql_result(mysql_query("SELECT COUNT(*) FROM `obmennik_files` WHERE `id_dir` = '$post[id]' AND `time` > '".(time()-86400)."'",$db), 0);
if ($k_n==0)$k_n=NULL;
else $k_n='<span style="color:red;">+'.$k_n.'</span>';
echo "($k_f) $k_n<br />n";
echo "</div>";
}
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `obmennik_files` WHERE `id_dir` = '$id'"),0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
if ($k_post==0 && $k_dir==0)
{
echo "<div class='linechat'>";
echo "Пака пуста!<br/>n";
echo "</div>";
}
$q=mysql_query("SELECT * FROM `obmennik_files` WHERE `id_dir` = '$id' ORDER BY `time` DESC LIMIT $start, 15");
while ($post = mysql_fetch_array($q))
{
$ras=$post['ras'];
$file=H."obmen/files/".retranslit($post['name']).".$ras";
echo "<div class='linechat'>";
include 'inc/icon14.php';
echo "<a href='/obmen/$post[id_dir]/$post[id]/'>$post[name].$ras</a> (".size_file($post['size']).")n";
echo "</div>";
}
if ($k_page>1)str('?',$k_page,$page); // Вывод страниц
include 'inc/upload_form.php';
echo "<div class='menu_razd'>";
echo "<img src='/style/adm.png'><a href='/obmen/moder.php'>Модераторы</a>n";
echo "</div>n";
if($id){
echo "<div class='tmn'>";
echo "<a href='/obmen/'>Обменник</a> | ".obmen_path($d['dir'])."<br />n";
echo "</div>n";
}
include 'inc/admin_form.php';
}
include_once '../sys/inc/tfoot.php';
?>