Файл: moduls/forum/vote.php
Строк: 38
<?php
/**
* @package Prime Social
* @link http://primesocial.ru
* @copyright Copyright (C) 2016 Prime Social
* @author BoB | http://primesocial.ru/about
*/
require_once('../../core/start.php');
check_auth();
$variant = abs(num($_POST['variant']));
$theme = DB::$dbs->queryFetch("SELECT * FROM ".FORUMS_THEME." WHERE `id` = ? ", array(abs(num($_GET['theme']))));
if (empty($theme)) {
head('Mavzu topilmadi');
echo DIV_ERROR . 'Xatolik!' . CLOSE_DIV;
echo DIV_GO . '<a href="'.HOME.'/">Bosh sahifa</a> / <a href="'.HOME.'/forum/">Forum</a> / <b>Mavzu topilmadi</b>' . CLOSE_DIV;
require_once('../../core/stop.php');
exit();
}
if ($theme['status'] == 1) {
head('Mavzu yopilgan');
echo DIV_ERROR . 'Xatolik!' . CLOSE_DIV;
echo DIV_GO . '<a href="'.HOME.'/">Bosh sahifa</a> / <a href="'.HOME.'/forum/">Forum</a> / <b>Mavzu yopilgan</b>' . CLOSE_DIV;
require_once('../../core/stop.php');
exit();
}
if (empty($theme['vote'])) {
head('Mavzuda so`rovnoma ochilmagan');
echo DIV_ERROR . 'Xatolik!' . CLOSE_DIV;
echo DIV_GO . '<a href="'.HOME.'/">Bosh sahifa</a> / <a href="'.HOME.'/forum/">Forum</a> / <b>Mavzuda so`rovnoma ochilmagan</b>' . CLOSE_DIV;
require_once('../../core/stop.php');
exit();
}
if (empty($theme['vote_'.$variant]) || $variant > 10) {
head('Mavjud bo`lmagan variant');
echo DIV_ERROR . 'Xatolik!' . CLOSE_DIV;
echo DIV_GO . '<a href="'.HOME.'/">Bosh sahifa</a> / <a href="'.HOME.'/forum/">Forum</a> / <b>Mavjud bo`lmagan variant</b>' . CLOSE_DIV;
require_once('../../core/stop.php');
exit();
}
if (DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".FORUM_VOTE." WHERE `theme_id` = ? && `user_id` = ? ", array($theme['id'], $user['user_id'])) == TRUE) {
head('Siz ovoz bergansiz');
echo DIV_TITLE . 'Siz ovoz bergansiz' . CLOSE_DIV;
echo DIV_ERROR . 'Xatolik!' . CLOSE_DIV;
echo DIV_GO . '<a href="'.HOME.'/">Bosh sahifa</a> / <a href="'.HOME.'/forum/">Forum</a> / <b>Siz ovoz bergansiz</b>' . CLOSE_DIV;
require_once('../../core/stop.php');
exit();
}
head('So`rovnoma: ' . $theme['name']);
$forum = DB::$dbs->queryFetch("SELECT * FROM ".FORUMS." WHERE `id` = ? ", array($theme['forum_id']));
$forumc = DB::$dbs->queryFetch("SELECT * FROM ".FORUMS_CAT." WHERE `id` = ? ", array($theme['forumc_id']));
DB::$dbs->query("INSERT INTO ".FORUM_VOTE." (`theme_id`, `user_id`, `variant`) VALUES (?,?,?)", array($theme['id'], $user['user_id'], $variant));
header("Location: ".HOME."/forum/".$forum['id']."/".$forumc['id']."/".$theme['id']."/");
echo DIV_GO . '<a href="'.HOME.'/">Bosh sahifa</a> / <a href="'.HOME.'/forum/">Forum</a> / <a href="'.HOME.'/forum/'.$forum['id'].'/">'.$forum['name'].'</a> / <a href="'.HOME.'/forum/'.$forum['id'].'/'.$forumc['id'].'/">'.$forumc['name'].'</a> / <a href="'.HOME.'/forum/'.$forum['id'].'/'.$forumc['id'].'/'.$theme['id'].'">'.$theme['name'].'</a> / <b>So`rovnoma</b>' . CLOSE_DIV;
require_once('../../core/stop.php');
?>