<?

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();
aut();
if (!isset($_GET['id']) && !is_numeric($_GET['id'])){header("Location: index.php?".SID);exit;}
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `news` WHERE `id` = '".intval($_GET['id'])."' LIMIT 1",$db), 0)==0){header("Location: index.php?".SID);exit;}
$id=intval($_GET['id']);



$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `news_p_rating` WHERE `id_post` = '".$id."'"), 0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
$q = mysql_query("SELECT * FROM `news_p_rating` WHERE `id_post` = '".$id."' ORDER BY `id_user` DESC LIMIT $start, $set[p_str]");
echo "<table class='post'>\n";
if ($k_post==0)
{
echo "   <tr>\n";
echo "  <td class='p_t'>\n";
echo "Пока эта новость никому не понравилася :))\n";
echo "  </td>\n";
echo "   </tr>\n";
}
while ($post = mysql_fetch_array($q))
{
$ank=get_user($post['id_user']);
echo "   <tr>\n";

if ($set['set_show_icon']==2){
echo "  <td class='icon48' rowspan='2'>\n";
avatar($ank['id']);
echo "  </td>\n";
}
elseif ($set['set_show_icon']==1)
{
echo "  <td class='icon14'>\n";
echo "<img src='/style/themes/$set[set_them]/user/$ank[pol].png' alt='' />";
echo "  </td>\n";
}



echo "  <td class='p_m'>\n";
echo "<a href='/info.php?id=".$ank['id']."'>".$ank['nick']."</a>".online($ank['id'])."\n";
echo "  </td>\n";
echo "   </tr>\n";

}

echo "</table>\n";


if ($k_page>1)str("?id=".$id."&amp;",$k_page,$page); 

echo "<div class='reklf'>\n";
echo "- <a href='$_SERVER[HTTP_REFERER]'> Вернутся назад</a><br />\n";
echo "</div>\n";


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