battles/tournament.php

82 lines
2.2 KiB
PHP

<?php
session_start();
if (empty($_SESSION['uid'])) {
header("Location: index.php");
exit;
}
require_once "functions.php";
$user = $user ?? null;
if ($user->battle) {
header('location: fbattle.php');
exit;
}
$Tournament = new Tournament();
?>
<HTML>
<HEAD>
<META content="text/html; charset=utf-8" http-equiv=Content-type>
</head>
<body style="background-image:url('/i/tournament/tournament2.jpg');background-repeat:no-repeat;background-position:center top;">
<div style='color:#8F0000; font-weight:bold; font-size:16px; text-align:center; float:left;'>Турнирная</div>
<div style="float: right; padding-right: 6px;">
<input type="button" onclick="window.location='main.php?setch=1'" value="Вернуться">
</div>
<br>
<?php
if (count($_POST) > 0) {
if ($_POST['newtournament']) {
$Tournament->CreateTournament("Еженедельные турниры");
}
if ($_POST['preptournament']) {
$Tournament->PrepearTournir();
}
if ($_POST['addzayvka']) {
$Tournament->AddUserInTournament($_POST['idtur']);
}
if ($_POST['dellzayvka']) {
$Tournament->DellUserInTournament($_POST['idtur']);
}
if ($_POST['expenemy']) {
$Tournament->expectationenemy((int)$_POST['expenemy']);
}
}
//$Tournir->CreateHTML(7);
//echo $dateTime=mktime(20, 20, 0, 03, 31, 2010);
//$Tournir->PrepearTournir();
$dateD = mysql_fetch_row(mysql_query("select datetime from turnament where old=0 limit 1"));
if (mktime() >= ($dateD[0] + 10)) {
$Tournament->UpdateTournir();
}
$Tournament->showAllTurnament();
if (mktime() >= ($dateD[0] + 10)) {
$Tournament->StartTournir();
}
$Tournament->ShowTournirFinaliats();
?>
<form method="post">
<?php
if ($user['align'] == 2.99) {
?>
<table>
<tr>
<td>Добавление нового турнира</td>
<td><input type="submit" name="newtournament" value="Добавить"></td>
<td>Приготовить турнир и запустить</td>
<td><input type="submit" name="preptournament" value="Добавить"></td>
</tr>
</table>
<?php
}
?>
</form>
<META HTTP-EQUIV="REFRESH" CONTENT="10">
</body>
</html>