<?
include_once '../sys/inc/start.php';
include_once '../sys/inc/compress.php';
include_once '../sys/inc/sess.php';
include_once '../sys/inc/home.php';
include_once '../sys/inc/settings.php';
include_once '../sys/inc/db_connect.php';
include_once '../sys/inc/ipua.php';
include_once '../sys/inc/fnc.php';
include_once '../sys/inc/user.php';


$set['title']='Картинки';
include_once '../sys/inc/thead.php';
title();

if (!isset($_GET['die']))
{
	$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `pricol_img`"),0);
	$k_page=k_page($k_post,$set['p_str']);
	$page=page($k_page);
	$start=$set['p_str']*$page-$set['p_str'];

$result = mysql_query ("SELECT * FROM pricol_img ORDER BY id DESC LIMIT $start, $set[p_str]");
$row = mysql_fetch_array($result);

do
{
echo "<div class='menu_razd'>";
echo "$row[name]<br />";
echo "</div>\n";
echo "<a href='?die&amp;id=$row[id]'><img src='files/$row[name].$row[ras]' width='70' height='70'></a><br />";	
echo "<img src='/style/icons/004.png' alt='' class='icon'/> <a href='delete.php?id=$row[id]&amp;delete'>Удалить файл</a><br />";	
}
while ($row = mysql_fetch_array($result));

if ($k_page>1){str("?id=$user[id]&",$k_page,$page);} // Вывод страниц
}







if (isset($_GET['die']))
{
	if (isset($_GET['id'])) {$id = $_GET['id'];}
	
	$result1 = mysql_query ("SELECT * FROM pricol_img WHERE id='$id'");
	$row1 = mysql_fetch_array($result1);

	$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `pricol_img_komm` WHERE id_img='$id'"),0);
	$k_page=k_page($k_post,$set['p_str']);
	$page=page($k_page);
	$start=$set['p_str']*$page-$set['p_str'];	

	$result2 = mysql_query ("SELECT * FROM pricol_img_komm WHERE id_img='$id' ORDER BY id DESC LIMIT $start, $set[p_str]");
	$myrow2 = mysql_fetch_array($result2);
	
	
	echo "<center><img src='files/$row1[name].$row1[ras]'></center><br /><br />";
	
if (mysql_num_rows ($result2) > 0)
{
do
{	
$ank=get_user($myrow2['id_user']);
echo "<div class='linechat'>";
echo "".online($ank['id'])." <a href='/info.php?id=$ank[id]'><span style=\"color:$ank[ncolor]\">$ank[nick]</span></a> \n";
if ($ank['obit']==0)
{
if ($ank['group_access']>1)echo "<img src='/style/adm.png'>\n";
}
echo "<br/> \n";
echo "<span style=\"color:$ank[mcolor]\">\n";
echo output_text($myrow2['msg'])."<br />\n";
echo "</span>\n";
echo "<div style='text-align: right;'><font color='#afb0a3'> ".vremja($myrow2['time'])." </font><img src='/style/icons/clock.png'></img>\n";
if (isset($user) && ($user['level']>$ank['level'] || $user['level']!=0 && $user['id']==$ank['id']))
echo " <a href='?id=$myrow2[id]&amp;delete'><b><font color='red'><img src='/style/icons/bdel.png' alt='' class='icon'/></font></b></a>\n";

echo "<br />Рейтинг: $myrow2[rating]<br />";

echo "</div>\n";
echo "</div><br />\n";
}
while ($myrow2 = mysql_fetch_array($result2));
}
else
{
echo "Нет не одного комментария<br />";
}

if ($k_page>1){str("?ids=$user[id]&id=$id&",$k_page,$page);} // Вывод страниц	
}

echo "<br /><img src='/style/back.gif' alt='' class='icon'/>\n";
echo "<a href='/pricol_img/'>Обратно</a>";

include_once '../sys/inc/tfoot.php';
?>
