include("includes/settings.php"); $page = "statistics"; $activeMainMenu = 4; if (($_GET['season_type'] != "League" and $_GET['season_type'] != "Playoffs" and $_GET['season_type'] != "Exhibition") or intval($_GET['season_id']) == 0) { header('Location: /scorers.php?season_type=' . $row_global_game_type_id["game_type_name"] . '&season_id=' . $row_global_season['season_id'], true, 301); } else { $season_type = mysqli_real_escape_string($db_conn, $_GET['season_type']); $season_id = ($_GET['season_id']); if ($_GET['p1']) { $get_team_id = ($_GET['team_selection1']); } if ($_GET['p2']) { $get_team_id = ($_GET['team_selection2']); } } if ($season_type != "" and $season_id != "") { $getSeasonID = mysqli_fetch_assoc(mysqli_query($db_conn, "SELECT * FROM `game_types` WHERE game_type_name LIKE '{$season_type}' AND season_id={$season_id} ")); if (isset($getSeasonID["game_type_id"])) { $game_type_id = $getSeasonID["game_type_id"]; } else { $game_type_id = ""; } if (intval($game_type_id) == 0) { show_error_code(404); } $getSeasonYears = mysqli_fetch_assoc(mysqli_query($db_conn, "select * from seasons WHERE season_id = '" . $season_id . "' ")); $seasonYears = $getSeasonYears["season_start"] . "-" . $getSeasonYears["season_end"]; // if the user selects the current game type we show default if ($game_type_id == $row_general_settings['game_type_id']) { $default = 1; } else { $default = 0; } } else { // default season $default = 1; $getSeasonType = mysqli_fetch_assoc(mysqli_query($db_conn, " select game_type_name FROM `game_types` WHERE game_type_id={$row_general_settings['game_type_id']} ")); $game_type_id = $row_general_settings['game_type_id']; $season_type = $getSeasonType["game_type_name"]; $season_id = $row_general_settings['now_season_id']; $seasonYears = $row_global_season["season_start"] . " - " . $row_global_season["season_end"]; } if ($_GET['d1']) { $g1 = $_GET['d1']; $g2 = $_GET['d2']; $d1 = formatdate($g1); $d2 = formatdate($g2); // $d1 = $g1; $d2 = $g2; } else { $sql = " select *, DATE_FORMAT(start_date, \"%Y%m%d\") as g1, DATE_FORMAT(end_date, \"%Y%m%d\") as g2 from game_types gt where game_type_id = '" . $game_type_id . "'"; $gametype = mysqli_fetch_assoc(mysqli_query($db_conn, $sql)); $g1 = $gametype['g1']; $g2 = $gametype['g2']; $d1 = formatdate($g1); $d2 = formatdate($g2); } function formatdate($date) { $y = substr($date, 0, 4); $m = substr($date, 4, 2); $d = substr($date, 6, 2); return sprintf('%s-%s-%s', $m, $d, $y); } ############################################################################################################ ?>