$total) {
$page = $total;
}
$start = $page * $num - $num;
switch ($_GET['op']) {
default:
$textl = 'Голосования';
require_once '../incfiles/head.php';
$res5 = mysql_query("
SELECT users.*, COUNT(" . $suf . ".id) AS cnt
FROM users
LEFT JOIN " . $suf . " ON " . $suf . ".id = users.id
GROUP BY users.id
ORDER BY cnt DESC
LIMIT $start, $num
");
while ($msg = mysql_fetch_assoc($res5)) {
echo '
';
/////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
}
////////////////////////////////////////////
////////////////////////////////////////////
/////////////////////////////////////////
///////////////////////////////////////
#################################################################################################
######################### Навигация ########################################################
#################################################################################################
if (!empty($posts)) {
echo "Юзеров: " . $posts . " | Страниц: " . $total . "
";
//echo $class_1;
if ($page != 1)
$pervpage = 'В начало < ';
if ($page != $total)
$nextpage = ' > В конец';
if ($page - 2 > 0)
$page2left = ' ' . ($page - 2) . ' ';
if ($page - 1 > 0)
$page1left = ' ' . ($page - 1) . ' ';
if ($page + 2 <= $total)
$page2right = ' ' . ($page + 2) . '';
if ($page + 1 <= $total)
$page1right = ' ' . ($page + 1) . '';
echo "" . $pervpage . $page2left . $page1left . "[" . $page . "]" . $page1right . $page2right . $nextpage . "";
} else {
echo 'Нет Пользователей в базе';
}
require_once ("../incfiles/end.php");
break;
/////////////////// Запись в базу
case 'yes':
if ($user_id) {
if (isset($_GET['go'])) {
$tiptrue = mysql_query("SELECT * FROM " . $suf . " WHERE `soft`='" . mysql_real_escape_string($_SERVER['HTTP_USER_AGENT']) . "' AND `ip`='" . $_SERVER['REMOTE_ADDR'] . "'");
if (mysql_num_rows($tiptrue)) {
$textl = 'Ошибка';
require_once ("../incfiles/head.php");
echo 'Вы Можете проголосовать только за одного человека!
Назад
';
require_once ("../incfiles/end.php");
exit;
}
$drr = mysql_fetch_array(mysql_query("SELECT * FROM users WHERE id='" . intval($_GET['go']) . "' LIMIT 1"));
$golos = mysql_result(mysql_query("SELECT text FROM " . $suf . " WHERE id='" . intval($_GET['go']) . "' LIMIT 1"), 0);
//$prohekt = $golos + 1;
$add = "Insert into " . $suf . " set dbid='', id = '" . $drr['id'] . "', text = '1', soft='" . mysql_real_escape_string($_SERVER['HTTP_USER_AGENT']) . "', ip='" . $_SERVER['REMOTE_ADDR'] . "', nik='" . $login . "'";
mysql_query($add);
$textl = 'Ваш голос учтен';
require_once ("../incfiles/head.php");
echo 'Ваш голос учтен за ' . $drr['name'] . ' !
Назад
';
require_once ("../incfiles/end.php");
exit;
}
} else {
$textl = 'Ошибка';
require_once ("../incfiles/head.php");
echo 'Голосовать могут только авторизированые пользователи';
}
break;
case 'who':
$kto = abs($_GET['kto']);
$posts = mysql_result(mysql_query("SELECT COUNT(*) FROM " . $suf . " WHERE " . $kto . ";"), 0);
$total = intval(($posts - 1) / $num) + 1;
if (empty($page) or $page < 0)
$page = 1;
if ($page > $total)
$page = $total;
$start = $page * $num - $num;
$resized = mysql_query("SELECT * FROM " . $suf . " WHERE `id`='" . $kto . "' ORDER BY dbid ASC LIMIT $start, $num");
$rioo = mysql_fetch_assoc(mysql_query("SELECT * FROM users WHERE id='" . $kto . "' LIMIT 1"));
$textl = 'Голоса За вас';
require_once ("../incfiles/head.php");
echo 'голоса за пользователя ' . $rioo['name'] . '';
while ($msg = mysql_fetch_assoc($resized)) {
echo 'Ник: ' . $msg['nik'] . '
' . "\r\n";
/////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
$noll = mysql_fetch_array(mysql_query("SELECT * FROM " . $suf . " WHERE `id`='" . $kto . "'"));
}
if (empty($noll['id'])) {
echo '
Не кто не голосовал!
';
}
echo '
Назад
';
if (!empty($posts)) {
echo "Юзеров: " . $posts . " | Страниц: " . $total . "
";
//echo $class_1;
if ($page != 1)
$pervpage = 'В начало < ';
if ($page != $total)
$nextpage = ' > В конец';
if ($page - 2 > 0)
$page2left = ' ' . ($page - 2) . ' ';
if ($page - 1 > 0)
$page1left = ' ' . ($page - 1) . ' ';
if ($page + 2 <= $total)
$page2right = ' ' . ($page + 2) . '';
if ($page + 1 <= $total)
$page1right = ' ' . ($page + 1) . '';
echo "" . $pervpage . $page2left . $page1left . "[" . $page . $page1right . $page2right . $nextpage . "]";
} else {
echo 'Нет Пользователей в базе';
}
break;
}
require_once ("../incfiles/end.php");
?>