game/tournament_test.php

42 lines
1.4 KiB
PHP
Raw Normal View History

2022-06-06 21:30:34 +00:00
<?php
use Insallah\Db, Insallah\Tournament, Insallah\TournamentModel;
require_once '_incl_data/__config.php';
require_once '_incl_data/class/Insallah/Core/Db.php';
require_once '_incl_data/class/Insallah/Tournament/Tournament.php';
require_once '_incl_data/class/Insallah/Tournament/TournamentModel.php';
$db = new Db();
$uid = $db::getValue('select id from users where login = ?', [$_COOKIE['login']]);
$tournamentsList = $db::getRows('select * from tournaments');
$tournaments = '<ul>';
foreach ($tournamentsList as $tournament) {
$level = $tournament['tid'];
$time = $tournament['start_time'];
$tournament_members_id = TournamentModel::getFreeFighters($tournament['tid']);
$members = [];
foreach ($tournament_members_id as $member) {
$members[] = TournamentModel::uidToLogin($member['uid']);
}
$tournaments .= "<li><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> {$tournament['tid']} <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.<br>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: " . date('G:i', $tournament['start_time']) . "<br>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:" . implode(', ', $members) . '</li>';
}
$tournaments .= '</ul>';
if (array_key_exists('tournament_start', $_POST)) {
(new Tournament())->join($uid);
}
?>
<h3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <?=$_COOKIE['login']?></h3>
<?= $tournaments ?>
<?php if (!TournamentModel::getTournamentIdByUserId($uid)): ?>
<form method="post">
<input type="submit" name="tournament_start" value="<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>">
</form>
<?php else: ?>
<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!
<?php endif; ?>