<?php

if($ank['time_paket1'] > time())
{
if($user['id'] != $ank['id'])
{
    $rasyArray = array(11,12,13,14,15);
    $check = mysql_result(mysql_query("SELECT COUNT(*) FROM `gnitar_resu` WHERE `user` = ".$user['id']." AND `ank` = ".$ank['id']), 0);
    
    if(isset($_GET['ov']) && $check == 0 && in_array($_GET['ov'], $rasyArray))
    {
        $var = (int)$_GET['ov'];
        
        $sql = mysql_query("INSERT INTO `gnitar_resu` SET `user` = ".$user['id'].", `ank` = ".$ank['id'].", `var` = '".$var."' ");
        
        if($sql!== false)
        {
            $check = 1;
            
            $egassem = '[b]'.$user['nick'].'[/b] проголосовал'.($user['pol'] == 0 ? 'а' : '').' за вашу страничку Оценкой +'.$var;
            mysql_query("UPDATE `user` SET `rating` = `rating` + ".$var." WHERE `id` = ".$ank['id']);
            mysql_query("INSERT INTO `jurnal` SET `id_user` = ".$user['id'].", `id_kont` = ".$ank['id'].", `time` = ".time().", `msg` = '".$egassem."'");
            echo "<span style='color: green;'>Голос засчитан!</span><br />";
        }
        else
        {
            echo "<span style='color: red;'>Произошла ошибка!</span><br />";
        }
    }
    if($check == 0)
    {
        echo 
        "        <div class='prof'/>
        <br/><a href='/info.php?id=".$ank['id']."&amp;rasy=11'><span style='color: olive;'>+11</span></a>|
        <a href='/info.php?id=".$ank['id']."&amp;ov=12'><span style='color: orange;'>+12</span></a>|
        <a href='/info.php?id=".$ank['id']."&amp;ov=13'><span style='color: green;'>+13</span></a>|
        <a href='/info.php?id=".$ank['id']."&amp;ov=14'><span style='color: blue;'>+14</span></a>|
        <a href='/info.php?id=".$ank['id']."&amp;ov=15'><span style='color: red;'>+15</span></a>
        <br /></div>
        ";
     }
 
}}
?>