<?php

defined('_IN_JOHNCMS') or die('Error: restricted access');
$error = false;
if ($id) {
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `library_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 `library_mavzu` SET `tema` = '$id', `us` = '$user_id', `javob` = '2'");
header('location: /library/index.php?id='.$id);
        
} else {
    header('location: index.php');
}
