<?php
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']='FM Чемпионаты';
include_once '../../../sys/inc/thead.php';
title();
aut();
include_once '../../online.php';
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `fm_chempionat`"), 0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
if ($k_post==0)echo '<div class="menu">Нет чемпионатов!</div>';
$q = mysql_query("SELECT * FROM `fm_chempionat` ORDER BY `time` DESC LIMIT $start, $set[p_str]");
while ($f = mysql_fetch_array($q))
{
if($num==1){
echo "<div class='f1'>";
$num=0;}
else{
echo "<div class='f2'>";
$num=1;}
$finish=($f['clubs']-1)*$f['clubs'];
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `fm_chempionat_game` WHERE  `id_chempionat` = '$f[id]'"),0)==$finish){$feri='Blue';}else{ if (mysql_result(mysql_query("SELECT COUNT(*) FROM `fm_chempionat_clubs` WHERE  `id_chempionat` = '$f[id]'"),0)==$f[clubs]){$feri='Red';}else{$feri='Green';}} 
echo "<img src='../icon/cup.png'> <a href='chempionat.php?id=$f[id]'><span style='color:$feri'>$f[name]</span></a> ($f[clubs])<br />\n";
echo "</div>";
}
if ($k_page>1)str("index.php?",$k_page,$page); // Вывод страниц
echo "<div class='menu'>";
echo "<span style='color:Blue'><b>Окончено</b></span>";
echo " | <span style='color:Red'><b>Началось</b></span>";
echo " | <span style='color:Green'><b>Ожидает</b></span>";
echo "</div>";
echo "<div class='foot'>";
echo "&#171; <a href='../index.php'>Назад</a><br/>";
echo "</div>";

include_once '../../../sys/inc/tfoot.php';

?>