-
Notifications
You must be signed in to change notification settings - Fork 0
/
league.php
38 lines (32 loc) · 1.05 KB
/
league.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
include_once "includes/classes.php";
require_once "../vendor/autoload.php";
//REMOVE BELOW IN PPRODUCTION
ini_set('display_errors', true);
error_reporting(E_ALL);
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
//REMOVE ABOVE IN PRODUCTION
$loader = new Twig_Loader_Filesystem("templates");
$twig = new Twig_Environment($loader);
if (!isset($id)) {
echo "<script>window.location.replace('login.php');</script>";
exit("redirecting...");
}
$getData = new getData();
$league = $getData->getLeague();
if (isset($_POST["createLeague"])) {
$leagueTasks = new LeagueTasks();
$message = $leagueTasks->createPrivate();
echo $twig->render("createleague.twig", array("name" => $name, "message" => $message));
die();
}
if ($league == null) {
echo $twig->render("createleague.twig", array("name" => $name));
} else {
$leagueOwner = $getData->getLeagueOwner();
if ($leagueOwner == $id) {
$leagueName = $getData->getLeagueName();
echo $twig->render("league.twig", array("name" => $name, "leagueCode" => $league, "leagueName" => $leagueName));
}
}
?>