<?php

/*
////////////////////////////////////////////////////////////////////////////////
// JohnCMS                Mobile Content Management System                    //
// Project site:          http://johncms.com                                  //
// Support site:          http://gazenwagen.com                               //
////////////////////////////////////////////////////////////////////////////////
// Lead Developer:        Oleg Kasyanov   (AlkatraZ)  alkatraz@gazenwagen.com //
// Development Team:      Eugene Ryabinin (john77)    john77@gazenwagen.com   //
//                        Dmitry Liseenko (FlySelf)   flyself@johncms.com     //
////////////////////////////////////////////////////////////////////////////////
*/

defined('_IN_JOHNCMS') or die('Error: restricted access');
require('../incfiles/head.php');
$error = false;
if ($id) {
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_mavzu` WHERE `tema` = '$id' AND `us` = '$user_id' AND `javob` = '2'"), 0) > 0)
{
    echo functions::display_error('Bitta mavzuga bir marta ovoz berishingiz mumkin!');
    require('../incfiles/end.php');
    exit;
}

mysql_query("INSERT INTO `forum_mavzu` SET `tema` = '$id', `us` = '$user_id', `javob` = '2'");
 header('location: /forum/index.php?id='.$id);
        
} else {
    header('location: index.php');
}
