function compareGames($sid1, $sid2) { $array1 = getGames($sid1); //var_dump($array1); echo "<br>"; echo "<br>"; $array2 = getGames($sid2); //var_dump($array2); $difference = array_intersect($array1, $array2); echo "<br>"; echo "<br>"; //var_dump($difference); return $difference; }
public function load() { $mode; if (!isset($_GET['mode']) || empty($_GET['mode'])) { $mode = 'joinable'; } else { $mode = $_GET['mode']; } //No cache for Game List header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past $max_game = $this->config->item('max_game'); if ($mode == 'friends') { $config = array('appId' => $this->config->item('fb_appid'), 'secret' => $this->config->item('fb_appsecret'), 'cookie' => $this->config->item('fb_cookie'), 'domain' => $this->config->item('fb_domain')); $this->facebook->init($config); $query = getGames($this->db, $max_game, $this->config->item('max_player'), $mode, $this->session->userdata('fid'), $this->facebook); } else { $query = getGames($this->db, $max_game, $this->config->item('max_player'), $mode); } $games = array(); foreach ($query->result_array() as $row) { $game = array(); $game['id'] = $row['gid']; $game['state'] = $row['state']; $game['players'] = getPlayersFromGid($this->db, $row['gid']); $games[] = $game; } $rows = array(); if ($query->num_rows() < $max_game && $mode == 'joinable') { $rows = createGames($this->db, $max_game - $query->num_rows()); foreach ($rows as $row) { $game = array(); $game['id'] = $row['gid']; $game['state'] = 0; $game['players'] = array(); $games[] = $game; } } $this->load->view('game_list_ajax', array("games" => $games, "appId" => $this->config->item('fb_appid'), "mode" => $mode)); }
$request = json_decode($postData); $method = $request->method; $username = $request->username; if ($method == "save") { $title = $request->title; $hint = $request->hint; $wordFinal = $request->wordFinal; $wordTemp = $request->wordTemp; $wordLength = $request->wordLength; $correct = $request->correct; $clickedString = $request->clickedString; $bad = $request->bad; saveGame($username, $title, $hint, $wordFinal, $wordTemp, $wordLength, $correct, $bad, $clickedString); } else { if ($method == "retrieve") { getGames($username); } else { if ($method == "delete") { $title = $request->title; deleteGame($username, $title); } } } /*Table: ID, Username, Title, wordFinal, wordTemp, wordLength, correct, bad*/ function saveGame($username, $title, $hint, $wordFinal, $wordTemp, $wordLength, $correct, $bad, $clickedString) { $data = array(); $connection = pdo_connect(); if (doesTitleExist($username, $title)) { $query = <<<SQL UPDATE SAVEGAMES
<?php $root = "/home/football/www/"; include $root . 'dbconnect_live_scores.php'; require_once $root . 'api/v1/api_functions.php'; include $root . 'dbconnect_new.php'; //require_once $root.'api/v2/app_functions.php'; global $dbconn_mysql; getGames($league_id); function getGames($lid) { global $dbconn_mysql; global $dbconn; $array = array(); $query3 = $dbconn_mysql->prepare("SELECT lm.*, ls.type AS score, ls.score AS type, t.name AS team_home_name, t2.name AS team_away_name\n\t\t\t\t\t\t\tFROM teams t, teams t2, live_match lm\n\t\t\t\t\t\t\tLEFT OUTER JOIN live_scores ls ON (ls.match_id=lm.id AND ls.score='CURRENT')\n\t\t\t\t\t\t\tWHERE lm.game_status!='Canc'\n\t\t\t\t\t\t\tAND lm.team_home_id=t.id\n\t\t\t\t\t\t\tAND lm.team_away_id=t2.id\n\t\t\t\t\t\t\tORDER BY lm.status_type='live' DESC"); $query3->execute(); $rows = $query3->fetchAll(); $array['match_data'] = $row; success($array); }
insertComment($comment); } // echo "<!-- Send the transaction and unlock the database. -->\n"; $app->commit(); header("location: /app/"); exit; break; // Reviews. // Reviews. case "review": require 'model/audiences.php'; $ages = getAges(); require 'model/genres.php'; $genres = getGenres(); require 'model/games.php'; $games = getGames(); $title = "Comparative Review - Review"; $active = "app"; include '../view/head.php'; include '../view/header.php'; include 'content/video_game_review.php'; break; case "submit_review": // echo "<!-- Get the different answers from the form. -->\n"; $review["age_id"] = filter_input(INPUT_POST, "age", FILTER_VALIDATE_INT); $review["like"] = trim(filter_input(INPUT_POST, "like", FILTER_SANITIZE_STRING)); $review["game"] = trim(filter_input(INPUT_POST, "game", FILTER_SANITIZE_STRING)); $review["genre"] = trim(filter_input(INPUT_POST, "genre", FILTER_SANITIZE_STRING)); $review["gender"] = trim(filter_input(INPUT_POST, "gender", FILTER_SANITIZE_STRING)); $review["comments"] = trim(filter_input(INPUT_POST, "comments", FILTER_SANITIZE_STRING)); $review["why_like"] = trim(filter_input(INPUT_POST, "why_like", FILTER_SANITIZE_STRING));
foreach ($seasoning as $season) { $response = file_get_contents("https://api.fantasydata.net/{$league}/v2/JSON/Games/{$season}", false, $context); $data = json_decode($response); foreach ($data as $game) { $badDate = str_replace("T", " ", $game->DateTime); if (empty($badDate) === false) { $teamChavez = Team::getTeamByTeamApiId($pdo, $game->AwayTeamID); $teamPaul = Team::getTeamByTeamApiId($pdo, $game->HomeTeamID); if ($teamChavez !== null && $teamPaul !== null) { $gameToInsert = new Game(null, $teamChavez->getTeamId(), $teamPaul->getTeamId(), $badDate); $gameToInsert->insert($pdo); } else { echo "<p>* * * SIX OF THIRTEEN SKIPPED THIS GAME * * *</p>" . PHP_EOL; } } } } } catch (Exception $exception) { echo "Something went wrong: " . $exception->getMessage() . PHP_EOL; } catch (TypeError $typeError) { echo "Something went wrong: " . $typeError->getMessage() . PHP_EOL; } } $sportLeagues = ["NHL", "NBA", "MLB"]; $pdo = connectToEncryptedMySQL("/etc/apache2/capstone-mysql/sprots.ini"); foreach ($sportLeagues as $sportLeague) { $sport = Sport::getSportBySportLeague($pdo, $sportLeague); getTeams($sportLeague, $sport->getSportId()); getGames($sportLeague); getPlayers($sportLeague); }
<?php require_once "../../../include/config.php"; require_once $basedir . "/admin/include/functions.php"; include $basedir . '/admin/include/isadmin.php'; $cats = getCategories(); $cats = getGames($cats, 'categories'); // get how many games are active for this category $gamemenu = 'active'; $datatables = 'active'; ?> <!DOCTYPE html> <html> <head> <?php include $basedir . '/admin/include/header.php'; ?> </head> <body class="skin-blue"> <!-- header logo: style can be found in header.less --> <header class="header"> <?php include $basedir . '/admin/include/header_menu.php'; ?> </header><!-- ./header --> <div class="wrapper row-offcanvas row-offcanvas-left"> <!-- Left side column. --> <aside class="left-side sidebar-offcanvas">
public function ticket($id, $nbMatch) { $tickets = TableRegistry::get('Tickets'); $prognostics = TableRegistry::get('Prognostics'); //The ticket focus $ticket = $tickets->find()->where(['id' => $id])->first(); if (!isset($ticket)) { return $this->redirect(['controller' => 'Pages', 'action' => 'page404']); } //List ticket's matchs today $matchs = $prognostics->find()->where(['n_ticket' => $ticket->id])->order(['date_match' => 'ASC']); $matchSelected = substr($nbMatch, 5); //Match Selected foreach ($matchs as $key => $ticketMatch) { if ($key == 0) { $firstMatch = $ticketMatch; } if ($key == $matchSelected - 1) { $match = $ticketMatch; break; } } if (!isset($match)) { return $this->redirect(['controller' => 'Pages', 'action' => 'page404']); } //All championship $allChampionship = getChampionships(); //$championship of the match foreach ($allChampionship as $championship) { if ($championship['caption'] == $match['competition']) { $thisChampionship = $championship; break; } } //All matchs championship $allMatchsChampionship = getGames($thisChampionship['fixtures']); //Match's stats between the teams foreach ($allMatchsChampionship as $matchChampionship) { if ($matchChampionship['homeTeamName'] == $match['home_team'] && $matchChampionship['awayTeamName'] == $match['away_team']) { $matchStats = $matchChampionship['showdown']; break; } } //Last match between the teams $lastMatchs = getStatsMatch($matchStats); //All teams championship $allTeamsChampionship = getTeams($thisChampionship['teams']); //Team's stats foreach ($allTeamsChampionship as $teamChampionship) { if ($teamChampionship['name'] == $match['home_team']) { $homeTeamStats = $teamChampionship; } if ($teamChampionship['name'] == $match['away_team']) { $awayTeamStats = $teamChampionship; } } //Ranking of the match $ranking = getRanking($thisChampionship['leagueTable'], $thisChampionship['teams'], $thisChampionship['fixtures']); if (!empty($ranking)) { foreach ($ranking as $team) { if (!is_array($team)) { if (!empty($homeTeamStats['fixtures'])) { //Home last matchs $homeLastMatchs = getLastMatchs($homeTeamStats['fixtures'], $thisChampionship['championship'], $team, $thisChampionship['teams']); $this->set('homeLastMatchs', $homeLastMatchs); } if (!empty($awayTeamStats['fixtures'])) { //Home last matchs $awayLastMatchs = getLastMatchs($awayTeamStats['fixtures'], $thisChampionship['championship'], $team, $thisChampionship['teams']); $this->set('awayLastMatchs', $awayLastMatchs); } break; } } $this->set('ranking', $ranking); } $this->set('firstMatch', $firstMatch); $this->set('match', $match); $this->set('lastMatchs', $lastMatchs); $this->set('homeTeamStats', $homeTeamStats); $this->set('awayTeamStats', $awayTeamStats); $this->set('matchs', $matchs); $this->set('ticket', $ticket); }
<?php $root = "/home/football/www/"; include $root . 'dbconnect_live_scores.php'; require_once $root . 'api/v1/api_functions.php'; include $root . 'dbconnect_new.php'; //require_once $root.'api/v2/app_functions.php'; global $dbconn_mysql; $type = isset($_REQUEST['type']) && $_REQUEST['type'] != '' ? $_REQUEST['type'] : false; $match_id = isset($_REQUEST['match_id']) && $_REQUEST['match_id'] != '' ? $_REQUEST['match_id'] : false; $league_id = isset($_REQUEST['league_id']) && $_REQUEST['league_id'] != '' ? $_REQUEST['league_id'] : false; $should_show_no_results_as_success = isset($_REQUEST['should_show_no_results_as_success']) && $_REQUEST['should_show_no_results_as_success'] != '' ? $_REQUEST['should_show_no_results_as_success'] : false; //league_id for GET_GAMES is actually country_id //Sorry, haven't got around to changing yet. if ($type == 'GET_GAMES') { getGames($league_id, $should_show_no_results_as_success); } else { if ($type == 'GET_GAME_DATA') { getGameData($match_id); } } function getGames($lid, $should_show_no_results_as_success) { global $dbconn_mysql; global $dbconn; $query = $dbconn->prepare("SELECT * FROM league WHERE country_id={$lid} ORDER BY SORT ASC"); $query->execute(); $rowco = $query->fetchAll(); if (count($rowco) == 0) { error("Sorry, we couldn't find any leagues associated with this country"); } else {
<?php require_once "../../../include/config.php"; require_once $basedir . "/admin/include/functions.php"; include $basedir . '/admin/include/isadmin.php'; $tags = getTags(); $tags = getGames($tags, 'tags'); // get how many games are active for this tags $gamemenu = 'active'; $datatables = 'active'; ?> <!DOCTYPE html> <html> <head> <?php include $basedir . '/admin/include/header.php'; ?> </head> <body class="skin-blue"> <!-- header logo: style can be found in header.less --> <header class="header"> <?php include $basedir . '/admin/include/header_menu.php'; ?> </header><!-- ./header --> <div class="wrapper row-offcanvas row-offcanvas-left"> <!-- Left side column. --> <aside class="left-side sidebar-offcanvas">