<?
include '../config.php';
include '../func.php';
head();
aut();
ban();


$bitva = num($_GET['bitva']);
echo head . 'Битва брендов' . div . katalog;
echo '<center>';

$brand = mysql_fetch_assoc(mysql_query("SELECT * FROM `brand` WHERE `id` = '".$bitva."'"));
if (empty($brand['id'])) $err = 'Данной битвы не существует';
  $vote1 = mysql_result(mysql_query("SELECT count(*) FROM `brand_vote` WHERE `golos` = '1' AND `brand` = '".$brand['id']."'"), 0);
    $vote2 = mysql_result(mysql_query("SELECT count(*) FROM `brand_vote` WHERE `golos` = '2' AND `brand` = '".$brand['id']."'"), 0);
    echo '<b>' . $brand['name'] . '</b><br/><br/>';
    echo '<b>' . $brand['brand1'] . '</b> VS <b>' . $brand['brand2'] . '</b><br/>';
    
    if ($brand['time'] > time())
        echo '<b>Битва активна</b><br/>';
    else
        echo 'Битва завершена<br/>';
        
    echo '<br/>';
    
    echo '<img src="files/'.$brand['f_brand_1'].'" alt="" /> VS <img src="files/'.$brand['f_brand_2'].'" alt="" /><br/>';
    
if ($brand['time'] > time()) {
      
        echo '<b><a href="vote.php?mod=1&bitva='.$brand['id'].'">' . $brand['brand1'] . '</a> ['.$vote1.'] </b> или <b><a href="vote.php?mod=2&bitva='.$brand['id'].'">' . $brand['brand2'] . '</a> ['.$vote2.'] </b>?<br/><br/>';
    
    } else {
        if ($vote1 > $vote2)
            $znak = '>';
        elseif($vote1 < $vote2)
            $znak = '<';
        else
            $znak = '=';
            
        echo '<b>' . $brand['brand1'] . ' ['.$vote1.'] </b> '.$znak.' <b>' . $brand['brand2'] . ' ['.$vote2.'] </b><br/><br/>';
    
    }

echo '</center>';
echo div;


echo div;
navig();
foot();
?>
