Example #1
0
<?php

header("content-type: text/html; charset: utf-8");
$offset = 365 * 24 * 60 * 60;
$expire = "expires: " . gmdate("D, d M Y H:i:s", time() + $offset) . " GMT";
#header($expire);
if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) {
    ob_start("ob_gzhandler");
} else {
    ob_start();
}
require_once 'universal/universalinclude.php';
$datein = filter_input(INPUT_GET, 'd', FILTER_SANITIZE_NUMBER_INT);
if ($datein !== null) {
    $date0 = DateTime::createfromformat('Ymd', $datein);
} else {
    $date0 = new DateTime('now', new DateTimeZone('America/Montreal'));
    if ($date0->format('G') < 13) {
        $date0->sub(new DateInterval('P1D'));
    }
    $datein = $date0->format('Ymd');
}
$dateDisp = $date0->format('M j, Y');
$dateDisp2 = $date0->format('l, F j, Y');
$month = $date0->format('n');
$year = $date0->format('Y');
$date = $date0->format('Y-m-d');
if ($month < 8) {
    $yID = (string) ($year - 1);
    $yID .= $year;
} else {
Example #2
0
#header($expire);
if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) {
    ob_start("ob_gzhandler");
} else {
    ob_start();
}
require_once 'universal/universalinclude.php';
$game = intval(filter_input(INPUT_GET, 'g', FILTER_SANITIZE_NUMBER_INT));
$season = intval(filter_input(INPUT_GET, 's', FILTER_SANITIZE_NUMBER_INT));
$year = intval(filter_input(INPUT_GET, 'y', FILTER_SANITIZE_NUMBER_INT));
# `games`: GAME DATA
$gamedata = "SELECT * FROM `games` WHERE `gameNo`=" . $game . " AND `seasonNo`=" . $season . " AND year=" . $year;
$gamedata = $dbconnect->fetch1($gamedata);
$away = $gamedata['awayTeam'];
$home = $gamedata['homeTeam'];
$date = DateTime::createfromformat('Y-m-d', $gamedata['date']);
$date = $date->format('M j, Y');
# `box`: GAME PLAYERS
$pkeys = array('G', 'A', 'Points', 'TOI', 'PlusMinus', 'ShotAttempts', 'PIM', 'HIT', 'GPP', 'FOT', 'FOW', 'GIVE', 'TAKE', 'AgCHANCEEV', 'AgCHANCEEVG', 'AgCHANCEPP', 'AgCHANCEPPG', 'AgCHANCESH', 'AgCHANCESHG', 'totalOff', 'totalNeu', 'totalDef');
$gkeys = array('W', 'L', 'OTL', 'SOL', 'SOL', 'SVP', 'SA', 'GA');
$sqlP = $keyDB->keyData($pkeys, true);
$sqlG = $keyDB->keyData($gkeys, true);
$boxdata = "SELECT a.`playerID`, `playerTeam`, `playerPos`, `gameNo`, seasonNo, totG, totA,\n            " . $sqlP . ",\n            " . $sqlG . "\n            FROM `box" . $year . "` a\n             LEFT JOIN (SELECT `playerID`, SUM(`G`) as 'totG', SUM(`A`) as 'totA'\n                FROM `box" . $year . "`\n                    WHERE `gameNo`<" . $game . "\n                        AND `seasonNo`=" . $season . "\n                    GROUP BY `playerID`) b\n            ON a.playerID = b.playerID\n            WHERE `gameNo`=" . $game . "\n            AND `seasonNo`=" . $season . "\n            GROUP BY `playerID";
$boxdata = $dbconnect->fetchTotal2($boxdata);
$idQ = '';
foreach ($boxdata as $id => $boxplayer) {
    $idQ .= "`playerID`=" . $id . " OR ";
    if ($boxplayer[0]['playerTeam'] === $away) {
        $playerlist['away']['game'][$id] = $boxplayer[0]['TOI'];
        if ($boxplayer[0]['playerPos'] === 'G') {
            $playerlist['away']['gameG'][$id] = $boxplayer[0]['TOI'];