Вход Регистрация
Файл: forum/poll.php
Строк: 58
<?php
# Script by seg0ro http://mobilarts.ru
# Not for sale!!!

defined('_IN_JOHNCMS') or die('Error: restricted access');

$textl .= ' | Отдать голос';
require_once (
'../incfiles/head.php');

if (!
$topic){
  echo 
functions::display_error('Отсутствует идентификатор темы!<br /><a href="index.php">Форум</a>');
  require_once(
'../incfiles/end.php');
  exit;
}

if (!
$user_id || $ban['1'] || $ban['11'] || $topicRes['close']){
  echo 
functions::display_error('У вас недостаточно прав для просмотра этой страницы!<br /><a href="index.php">Форум</a>');
  require_once(
'../incfiles/end.php');
  exit;
}

if (!
$topicRes['poll_name'] && !isset($_POST['poll'])){
  echo 
functions::display_error('Ошибка!<br /><a href="index.php?topic='.$topicRes['topic'].'&amp;page='.$page.'">Назад</a>');
  require_once (
'../incfiles/end.php');
  exit;
}

$tree = array('<a href="index.php">Форум</a>''<a href="index.php?topic='.$topicRes['topic'].'&amp;page='.$page.'">'.functions::checkout($topicRes['topicname']).'</a>''Голосование');
echo 
'<div class="phdr">'.functions::display_menu($tree).'</div>';

if (empty(
$_POST['var'])){
  echo 
functions::display_error('Вы ничего не выбрали!<br /><a href="index.php?topic='.$topicRes['topic'].'&amp;page='.$page.'">Назад</a>');
  require_once (
'../incfiles/end.php');
  exit;
}

// Проверка на флуд
$flood functions::antiflood();
if (
$flood){
  echo 
functions::display_error('Слишком высокая активность!<br />Пожалуйста, подождите '.$flood.' сек.<br /><a href="index.php?topic='.$topicRes['topic'].'&amp;page='.$page.'">Назад</a>');
  require_once (
'../incfiles/end.php');
  exit;
}
  
$pollCheck mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_polled` WHERE `topic` = '$topic' AND `user_id` = '$user_id' LIMIT 1 "), 0);
if (!
$pollCheck){
  foreach (
$_POST['var'] as $var){
    
mysql_query("UPDATE `forum_polls` SET `count` = count + 1 WHERE `id` = '".intval($var)."' LIMIT 1 ");
    
mysql_query("INSERT INTO `forum_polled` SET
    `topic` = '
$topic',
    `poll` = '"
.intval($var)."',
    `user_id` = '
$user_id' ");
    ++
$i;
  }
  
$pollSet = array('poll_mod' => $pollSet['poll_mod'], 'total_polls' => ($pollSet['total_polls'] + $i), 'total_polled' => ($pollSet['total_polled'] + 1));
  
mysql_query("UPDATE `forum_topics` SET
  `poll_set` = '"
.serialize($pollSet)."'
  WHERE `topic` = '
$topic' LIMIT 1 ");
    
  
mysql_query("UPDATE `users` SET `lastpost` = '".time()."' WHERE `id` = '$user_id' ");
  
  
header ('Refresh:1; URL=index.php?topic='.$topicRes['topic'].'&page='.$page);
  echo 
'<div class="gmenu">Ваш голос принят, спасибо<br /><a href="index.php?topic='.$topicRes['topic'].'&amp;page='.$page.'">Далее</a></div>';
}else{
  echo 
functions::display_error('Вы уже отдавали голос!<br /><a href="index.php?topic='.$topicRes['topic'].'&amp;page='.$page.'">Назад</a>');
}
Онлайн: 2
Реклама