Файл: index.php
Строк: 134
<?
include_once '../sys/inc/start.php';
include_once '../sys/inc/compress.php';
include_once '../sys/inc/sess.php';
include_once '../sys/inc/home.php';
include_once '../sys/inc/settings.php';
include_once '../sys/inc/db_connect.php';
include_once '../sys/inc/ipua.php';
include_once '../sys/inc/fnc.php';
include_once '../sys/inc/user.php';
$set['title']='Битва брэндов'; // заголовок страницы
include_once '../sys/inc/thead.php';
include_once 'func.php';
title();
aut();
$all = mysql_result(mysql_query("SELECT count(*) FROM `brand`"), 0);
if($all == 0) echo 'Битвы еще не созданы';
$result = mysql_query("SELECT * FROM brand order by id desc limit 1");
while($brand = mysql_fetch_assoc($result)){
echo '<div class="title"><b>' . $brand['name'] . '</b></div>';
echo '<center>';
echo '<div class="guser_aut"><b>' . $brand['brand1'] . '</b> VS <b>' . $brand['brand2'] . '</b></div>';
echo '<div class="menu">';
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/>';
$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);
if ($brand['time'] > time())
echo '<b><a href="vote.php?mod=1&bitva='.$brand['id'].'&id='.$user[id].'">' . $brand['brand1'] . '</a> ['.$vote1.'] </b> или <b><a href="vote.php?mod=2&bitva='.$brand['id'].'&id='.$user[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>';
}
echo'</center>';
echo '</div>';
if ($brand['time'] > time())
echo '<div class="title"><b>Пора выяснить что круче!</b></div><div class="guser_aut">';
echo '<b>Битва запущена:</b> ' . date2($brand['date']) . '</b><br/>';
$coments = mysql_result(mysql_query("SELECT count(*) FROM `brand_coment` WHERE `brand` = '".$brand['id']."'"), 0);
if ($brand['coment'] == 1)
echo '<b><a href="coment.php?bitva='.$brand['id'].'">Коментарии</a></b> ['.$coments.']<br/>';
echo'</div>';
}
$brand_all = mysql_result(mysql_query("SELECT count(*) FROM `brand`"), 0);
echo '<div class="menu"><b>Все битвы</b> ['.$brand_all.']<br/>';
if($brand_all){
$onpage = 5;
$allpage = ceil($brand_all/$onpage);
$this_page = (isset($_GET['p'])) ? intval($_GET['p']) : 1 ;
if($this_page < 1 || $this_page > $allpage)$this_page = 1;
$start = $this_page*$onpage - $onpage;
$result = mysql_query("SELECT * FROM brand order by id desc limit ".num($start).",".num($onpage)."");
while($brand = mysql_fetch_assoc($result)){
$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);
if ($vote1 > $vote2)
$znak = '>';
elseif($vote1 < $vote2)
$znak = '<';
else
$znak = '=';
echo '<b><a href="view.php?bitva='.$brand['id'].'">' . $brand['brand1'] . ' '.$znak.' ' . $brand['brand2'] . '</a></b> ['.$vote1.'/'.$vote2.']<br/>';
}
echo '</div>';
echo '<div class="page_foot"><b>Страницы:</b> ';
navigation($allpage,"index.php?p={p}",1,1);
}
echo '<br/><b><a href="apanel.php?mod=add">Добавить свою битву</a>';
echo '<br><a href="end.php">Завершенные битвы</a></b>
</div>';
include_once '../sys/inc/tfoot.php';
?>