Файл: Kulinar/inc/dir.php
Строк: 90
<?
if ($l=='/')
{
$set['title']='Кулинария';
}else{
$set['title']='Кулинария - '.$dir_id['name'];
}
$_SESSION['page']=1;
include_once '../sys/inc/thead.php';
title();
aut();
if ($l!='/')
{
include 'inc/upload_act.php';
}
include 'inc/admin_act.php';
err();
if ($l!='/')
{
echo "<div class='p_t'>";
echo "<img src='/Kulinar/img/book.png'> <a href='/Kulinar/index.php'>Кулинария</a> > ".lib_path($l)."<br />";
echo "</div>";
}else{
if (isset($user))
{
echo "<div class='nav2'><img src='/Kulinar/img/logo.png' /></div> ";
echo '<table width="100%">';
echo '<tr>';
echo '<td class="nav1" width="50%">';
echo "<a href='/Kulinar/search.php'><div class='main2'>";
echo "<img src='/Kulinar/img/search.png'> Найти рецепт";
echo "</div></a>";
echo '</td>';
echo '<td class="nav1" width="50%">';
$my_st=mysql_result(mysql_query("SELECT COUNT(*) FROM `Kulinar_files` WHERE `id_user` = '".$user['id']."'"),0);
echo "<a href='/Kulinar/my.php'><div class='main2'>";
echo "<img src='/Kulinar/img/my.png'> Мои рецепты (".$my_st.")";
echo '</td>';
echo '</tr></div></div></table> ';
}
}
$list=null;
$q=mysql_query("SELECT * FROM `Kulinar_dir` WHERE `dir_osn` = '/".$l."' OR `dir_osn` = '".$l."/' OR `dir_osn` = '".$l."' ORDER BY `name`,`num` ASC");
while ($post = mysql_fetch_assoc($q))
{
$list[]=array('dir'=>1,'post'=>$post);
}
$q=mysql_query("SELECT * FROM `Kulinar_files` WHERE `id_dir` = '".$id_dir."' ORDER BY `time` DESC");
while ($post = mysql_fetch_assoc($q))
{
$list[]=array('dir'=>0,'post'=>$post);
}
$k_post=sizeof($list);
$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)
{
echo "<div class='err'>";
echo "Пусто!";
echo "</div>";
}
for ($i=$start;$i<$k_post && $i<$set['p_str']*$page;$i++)
{
echo "<table style='width:100%' cellspacing='1' cellpadding='1'>";
if ($list[$i]['dir']==1)
{
$post=$list[$i]['post'];
echo "<tr>";
echo "<td class='main'>";
echo "<img src='/Kulinar/img/book.png' alt='' /> ";
echo "<a href='/Kulinar".$post['dir']."'>".$post['name']."</a>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td class='main2'>";
$k_f=0;
$k_n=0;
$q3=mysql_query("SELECT * FROM `Kulinar_dir` WHERE `dir_osn` like '".$post['dir']."%'");
while ($post2 = mysql_fetch_assoc($q3))
{
$k_f=$k_f+mysql_result(mysql_query("SELECT COUNT(*) FROM `Kulinar_files` WHERE `id_dir` = '".$post2['id']."'"),0);
$k_n=$k_n+mysql_result(mysql_query("SELECT COUNT(*) FROM `Kulinar_files` WHERE `id_dir` = '".$post2['id']."' AND `time` > '".(time()-86400)."'",$db), 0);
}
$k_f=$k_f+mysql_result(mysql_query("SELECT COUNT(*) FROM `Kulinar_files` WHERE `id_dir` = '".$post['id']."'"),0);
$k_n=$k_n+mysql_result(mysql_query("SELECT COUNT(*) FROM `Kulinar_files` WHERE `id_dir` = '".$post['id']."' AND `time` > '".(time()-86400)."'",$db), 0);
if ($k_n==0)
{
$k_n=NULL;
}else{
$k_n='/+'.$k_n;
}
echo "<img src='/Kulinar/img/txt.png'> Рецептов: ".$k_f."".$k_n."<br />";
echo "</td>";
echo "</tr>";
}else{
$post=$list[$i]['post'];
$ras='txt';
$file=H."sys/lib/stats/".$post['id'].".txt.gz";
$name=$post['name'];
$size=$post['size'];
echo "<tr>";
echo "<td class='main'>";
if (is_file(H.'Kulinar/img/'.$ras.'.png'))
{
echo "<img src='/Kulinar/img/".$ras.".png' alt='".$ras."' /> ";
}else{
echo "<img src='/Kulinar/img/txt.png' alt='file' /> ";
}
echo "<a href='/Kulinar".$dir_id['dir']."".$post['name'].".htm'>".$post['name']."</a><br />";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td class='main2'>";
$ank=mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id` = '".$post['id_user']."' LIMIT 1"));
echo "<img src='/Kulinar/img/avtor.png'> Создал: <a href='/info.php?id=$ank[id]'>".$ank['nick']."</a> ".online($ank['id'])."<br />";
echo "</td>";
echo "</tr>";
}
echo "</table>";
}
if ($k_page>1)
{
str('?',$k_page,$page);
}
if ($l!='/')
{
include 'inc/upload_form.php';
}
include 'inc/admin_form.php';
?>