<?php
	defined('_IN_JOHNCMS') or die('Error: restricted access');
	$textl = 'Блоги | Список голосовавших';
	require_once('../incfiles/head.php');
	$counts = @ mysql_result(mysql_query('SELECT COUNT(*) FROM `' . $set['prefblog'] . 'blogs` WHERE `id`=' . $id . ';'), 0);
	if($counts==0)
	{
		echo '<div class="menu">Ошибка! Статьи не существует!</div>';
		require_once '../incfiles/end.php';
		exit;
	}
	echo '<div class="phdr"><a href="./">Блоги</a> | Список голосовавших</div>';
	$total = mysql_result(mysql_query("SELECT COUNT(*) FROM `" . $set['prefblog'] . "blogs_rat` WHERE `ref`='" . $id . "';"), 0);
	if($total>0)
	{
		$res = mysql_query("SELECT * FROM `" . $set['prefblog'] . "blogs_rat` WHERE `ref`='" . $id . "' LIMIT ".$start.", ".$kmess);
		while ($row = mysql_fetch_assoc($res))
		{
			$req = mysql_fetch_assoc(mysql_query('SELECT `id`, `name`, `sex`, `lastdate`, `datereg`, `status`, `rights`, `rights`, `ip`, `browser` FROM `users` WHERE `id`='.$row['user_id'].''));
			echo ($i % 2) ? '<div class="list2">' : '<div class="list1">';
			echo show_user($req, 1, NULL) . '</div>';
			++$i;
		}
		echo '<div class="phdr">Всего: ' . $total . '</div>';
	}
	else
	{
		echo '<div class="menu">Ни кто не голосовал</div>';
	}
	if ($total > $kmess)
	{
		echo '<p class="menu">' . pagenav('?act=golosa&amp;', $start, $total, $kmess) . '<br />';
		echo '<form action="" method="post">
		<input type="text" name="page" size="2"/> <input type="submit" value="GO"/></form></p>';
	}
	echo '<div class="menu"><a href="?act=view&amp;id='.$id.'">Назад</a></div>';
?>