2020-09-29 22:39:06 +00:00
|
|
|
<?php
|
|
|
|
session_start();
|
2020-09-30 12:30:00 +00:00
|
|
|
if (empty($_SESSION['uid'])) {
|
2020-09-29 22:39:06 +00:00
|
|
|
header("Location: index.php");
|
|
|
|
exit;
|
|
|
|
}
|
2020-09-30 12:30:00 +00:00
|
|
|
|
2020-09-29 22:39:06 +00:00
|
|
|
require_once "functions.php";
|
|
|
|
$user = $user ?? null;
|
|
|
|
if ($user->battle) {
|
|
|
|
header('location: fbattle.php');
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
$Tournament = new Tournament();
|
2020-10-28 20:21:08 +00:00
|
|
|
\Battles\Template::header('Турниры');
|
2020-09-29 22:39:06 +00:00
|
|
|
?>
|
2020-09-30 19:12:34 +00:00
|
|
|
<META HTTP-EQUIV="REFRESH" CONTENT="10">
|
2020-09-29 22:39:06 +00:00
|
|
|
<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
|
2020-09-30 19:12:34 +00:00
|
|
|
if (!empty($_POST)) {
|
2020-09-29 22:39:06 +00:00
|
|
|
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']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$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">
|
2020-09-30 19:12:34 +00:00
|
|
|
<?php if ($user->admin) { ?>
|
|
|
|
<div>
|
|
|
|
<input type="submit" name="newtournament" value="Добавить новый турнир">
|
|
|
|
<input type="submit" name="preptournament" value="Приготовить турнир и запустить">
|
|
|
|
</div>
|
|
|
|
<?php } ?>
|
|
|
|
</form>
|