function getGameFromCache($game_id) { global $config; $data = array(); $file = $config['basedir'] . '/temp/all_games.txt'; if (file_exists($file)) { $all_games = json_decode(file_get_contents($file), true); } else { $all_games = getAllGames(); file_put_contents($file, json_encode($all_games)); } foreach ($all_games as $g) { $g_id = $g['g_id']; if ($g_id == $game_id) { $data = $g; break; } } return $data; }
<!-- End signUp form --> <div class="popup-overlay"></div> <!-- End popup--> <?php include "user-login-menus.php"; include "sidebarlinks.php"; ?> <div class="featured-area"> <div class="container"> <div class="row"> <div class="col-md-10 col-sm-9"> <div id="tabs" class="score-tabs"> <ul> <?php $games_tabs = getAllGames(); if ($games_tabs > 0) { while ($game_tab = mysql_fetch_array($games_tabs)) { ?> <li ><a href="#tabs-<?php echo $game_tab['game_id']; ?> " onclick="return getGameScore(<?php echo $game_tab['game_id']; ?> );" ><?php echo $game_tab['game_name']; ?> </a></li> <?php }
if (isset($_GET["y"]) and is_numeric($_GET["y"]) and $_GET["y"] <= date("Y") and $_GET["y"] >= 1998) { $y = safeEscape((int) $_GET["y"]); $filter .= "AND YEAR(g.datetime) = '" . (int) $y . "'"; } if (isset($_GET["game_type"]) and is_numeric($_GET["game_type"])) { $filter .= " AND g.alias_id = '" . (int) $_GET["game_type"] . "' "; } $sth = $db->prepare("SELECT COUNT(*) FROM " . OSDB_GAMES . " as g\n WHERE (g.map) LIKE ('%" . OS_DEFAULT_MAP . "%') AND g.duration>='" . $MinDuration . "' " . $filter . " LIMIT 1"); $result = $sth->execute(); $r = $sth->fetch(PDO::FETCH_NUM); $numrows = $r[0]; $result_per_page = $GamesPerPage; $draw_pagination = 0; include 'inc/pagination.php'; $draw_pagination = 1; $sql = getAllGames($MinDuration, $offset, $rowsperpage, $filter, "datetime DESC"); } $sth = $db->prepare($sql); $result = $sth->execute(); $c = 0; $GamesData = array(); while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { $GamesData[$c]["win"] = ""; $GamesData[$c]["id"] = (int) $row["id"]; $GetMap = convEnt2(substr($row["map"], strripos($row["map"], '\\') + 1)); $Map = explode(".w", $GetMap); $GamesData[$c]["map"] = $Map[0]; //$GamesData[$c]["map"] = convEnt2(substr($row["map"], strripos($row["map"], '\\')+1)); //$GamesData[$c]["map"] = reset( explode(".w", $GamesData[$c]["map"] ) ); //$GamesData[$c]["map"] = substr($GamesData[$c]["map"],0,20); $GamesData[$c]["datetime"] = $row["datetime"];
within 15 minutes before betting ends. Will cancel game if minimum bet not reached. */ require_once "../include/config.php"; require_once $basedir . "/include/functions.php"; // get all user bets cache $cachefile = $basedir . '/temp/user_bets_active.php'; if (file_exists($cachefile)) { $all_bets = json_decode(file_get_contents($cachefile), TRUE); } else { $all_bets = getAllUserBetsNoWinnerAndWriteToCache(); } $time1 = time(); $time2 = time() + 60 * 60 * 15; $where = "g_schedTo >= '{$time1}' AND g_schedTo <= '{$time2}' AND g_betMinimum > 0 AND g_isClosed = 0"; $all_games = getAllGames($where); // get all the games if ($all_games) { foreach ($all_games as $ag) { $total_coins = 0; $g_id = $ag['g_id']; $bet_minimum = $ag['g_betMinimum']; if ($all_bets) { foreach ($all_bets as $ab) { if ($ab['g_id'] == $g_id) { $total_coins += $ab['ub_coins']; } } } else { break; }
<?php require "api/utils/games.php"; $app->group('/games', function () { //get games list $this->get('', function ($req, $res, $args) { $games = getAllGames(); if ($games) { return $res->withStatus(200)->write(json_encode($games)); } else { return $res->withStatus(400)->write($e->getMessage()); } })->setName('games'); //get ban with id $this->get('/{id}', function ($req, $res, $args) { $game = getGame($args['id']); if ($game) { return $res->withStatus(200)->write(json_encode($game)); } else { return $res->withStatus(400)->write($e->getMessage()); } }); //post new ban $this->post('', function ($req, $res, $args) { $game = $req->getParsedBody(); $sql = "INSERT INTO games (region, date, blue, red, blue_compo, red_compo, blue_bans, red_bans, winner) VALUES (:region, :date, :blue, :red, :blueCompo, :redCompo, :blueBans, :redBans, :winner)"; try { $db = getConnection(); $stmt = $db->prepare($sql); $stmt->bindParam("region", $game['region']); $stmt->bindParam("date", $game['date']);
<?php require_once '../include/config.php'; require_once $basedir . "/admin/include/functions.php"; include $basedir . '/admin/include/isadmin.php'; $games_file = $basedir . '/temp/all_games.txt'; $temp = array(); $all_games = array(); $sales_today = 0; $total_house_commission = 0; if (file_exists($games_file)) { $temp = json_decode(file_get_contents($games_file), true); } else { $temp = getAllGames(); } $filter = (isset($_GET['filter']) and $_GET['filter']) ? $_GET['filter'] : 'all'; $today = time(); $day_start = date('Y-m-d ') . '00:00:00'; $day_end = date('Y-m-d ') . "23:59:59"; foreach ($temp as $ag) { $sched_from = $ag['g_schedFrom']; $sched_to = $ag['g_schedTo']; if (!$ag['g_isClosed'] and !$ag['g_isCancelled'] and !$ag['g_isDeleted'] or $today >= $sched_from and $today <= $sched_to or $ag['g_isClosed'] and $ag['g_lastUpdated'] >= $day_start and $ag['g_lastUpdated'] <= $day_end or $ag['g_isCancelled'] and $ag['g_lastUpdated'] >= $day_start and $ag['g_lastUpdated'] <= $day_end) { // cancelled today $all_games[$ag['g_id']] = $ag; //$all_bets = getAllBets($ag['g_id']); //$info_per_bet_item = getInfoPerBetItem($all_bets); //$all_games[$ag['g_id']]['info_per_bet_item'] = $info_per_bet_item; } } $transactions_today = getTransactions(strtotime($day_start), strtotime($day_end));
<div class="col-md-5 div4"> <h1 class="H01">NEW GAMES</h1> <img src="images/cloudunderline.png" alt=""/> <div class="clearfix"></div> <br/> <?php $result = getAllGames(); if ($result > 0) { while ($games = mysql_fetch_array($result)) { ?> <a href="kids-games-<?php echo $games['seo_game']; ?> "> <div class="latestgames" style=""> <img src="games/game_images/<?php echo $games['game_image']; ?> " alt="<?php echo $games['game_name']; ?> " class="img-responsive img-thumbnail"/> </a> <a href="kids-games-<?php echo $games['seo_game']; ?> "> <p class="text-center" style="font-family:Cambria, 'Hoefler Text', 'Liberation Serif', Times, 'Times New Roman', serif;"><?php echo $games['game_name']; ?> </p>
<li><a class="icon2" href="https://plus.google.com/b/108438942958324909410/108438942958324909410/about" target="_blank"></a></li> <li><a class="icon3" href="https://twitter.com/GameMaverick" target="_blank"></a></li> <li class="last"><a class="icon4" href="https://www.pinterest.com/maverickgame/" target="_blank"></a></li> </ul> <p class="f-p">© 2015 MAVERICK GAME. ALL RIGHTS RESERVED. </p> </div> </div> </div> <div class="col-md-6 col-sm-6 animate-heading"> <div class="col-md-4"><div class="f-box wow lightSpeedIn"> <h4>Games </h4> <ul class="ft-nav2"> <?php $footergames = getAllGames(); if ($footergames > 0) { while ($footergame = mysql_fetch_array($footergames)) { ?> <li><a href="maverick-game-<?php echo $footergame['game_seo']; ?> "><?php echo $footergame['game_name']; ?> </a></li> <?php } } ?>
// but i put it here anyways. header('Location: ' . $baseurl . '/login.php'); exit; } } // betarea pre-set bets $coinperbet = $game['g_coinPerBet']; $betarr = array($coinperbet, $coinperbet * 2, $coinperbet * 3, $coinperbet * 4, $coinperbet * 5, $coinperbet * 5 * 2); // for getting related games $temp = array(); $related_games = array(); $games_file = $basedir . '/temp/all_games.txt'; if (file_exists($games_file)) { $all_games = json_decode(file_get_contents($games_file), true); } else { $all_games = getAllGames(); } $all_games = filterPublicGames($all_games); if ($user_id) { $my_likes = getLikes($user_id); $my_bookmarks = getBookmarks($user_id); } else { $my_likes = false; $my_bookmarks = false; } $i = 0; foreach ($all_games as $ag) { if ($LANGUAGE == 'en') { $this_field = 'g_engPage'; } else { $this_field = 'g_japPage';
function allMyGameItems($user_id, $filter, $cat, $sort) { global $config, $LANGUAGE; $data = array(); $temp = array(); $file = $config['basedir'] . '/temp/all_games.txt'; if (file_exists($file)) { $temp = json_decode(file_get_contents($file), true); } else { $temp = getAllGames(); } foreach ($temp as $t) { $all_games[$t['g_id']] = $t; } $all_bets = getAllBetsByUserId($user_id); $haswon = array(); $temp = array(); $bets_per_category = array(); foreach ($all_bets as $ab) { if ($ab['ub_iswinner']) { $haswon[$ab['g_id']] = true; } } foreach ($all_bets as $ab) { $do_skip = false; $g_id = $ab['g_id']; $game = $all_games[$g_id]; $suffix = getSuffix($game); // make sure category is equal to $cat $category = $game['g_categories']; $bets_per_category[$game['g_categories' . $suffix]] += 1; if ($category != $cat and $cat != 'all') { continue; } switch ($filter) { case 'all': break; case 'won': if (!$ab['ub_iswinner'] and !isset($haswon[$g_id])) { $do_skip = true; } break; case 'lose': if (isset($haswon[$g_id])) { $do_skip = true; } else { if (!$game['g_isClosed']) { $do_skip = true; } } break; case 'judgement': $now = time(); $do_skip = true; if ($game['g_schedTo'] < $now and !$game['g_isClosed'] and !$game['g_isCancelled']) { $do_skip = false; } break; case 'cancelled': if (!$game['g_isCancelled']) { $do_skip = true; } break; default: $do_skip = true; break; } if ($do_skip) { continue; } if (!isset($temp[$g_id])) { $temp[$g_id] = getBetItems($g_id); foreach ($temp[$g_id] as $t) { $bet_items[$t['bi_id']] = $t; } if ($game['g_isClosed'] and !$game['g_isCancelled']) { $key = 0; } else { $key = 'current'; } $data[$g_id]['won'] = $key; $data[$g_id]['game_id'] = $g_id; $data[$g_id]['title'] = $game['g_title' . $suffix]; $data[$g_id]['image'] = $game['g_image']; $data[$g_id]['from'] = $game['g_schedFrom']; $data[$g_id]['to'] = $game['g_schedTo']; $data[$g_id]['your_placed'] = 0; $data[$g_id]['housecom'] = $game['g_houseCom']; $data[$g_id]['total_placed'] = getGameTotalPlacedCoins($g_id); } if ($ab['ub_iswinner']) { $data[$g_id]['won'] = 1; } if (!isset($data[$g_id]['your_items'][$ab['bi_id']]['placed_coins'])) { $data[$g_id]['your_items'][$ab['bi_id']]['placed_coins'] = 0; } $data[$g_id]['your_placed'] += $ab['ub_coins']; $data[$g_id]['your_items'][$ab['bi_id']]['placed_coins'] += $ab['ub_coins']; $data[$g_id]['your_items'][$ab['bi_id']]['name'] = $bet_items[$ab['bi_id']]['bi_description' . $suffix]; $data[$g_id]['your_items'][$ab['bi_id']]['winner'] = $ab['ub_iswinner']; } if ($bets_per_category) { arsort($bets_per_category); } $data = sortMyBets($data, $sort); return array('data' => $data, 'bets_per_category' => $bets_per_category); }
function duplicateGame($game_id) { global $config; $basedir = $config['basedir']; $g = getGame($game_id); $bet_items = getBetItems($g['g_id']); $title = $g['g_title']; $description = $g['g_description']; $imgfilename = $g['g_image']; $category = $g['g_categories']; $tags = $g['g_tags']; $bet_info = $g['g_betInfo']; $bet_condition = $g['g_addInfo']; $title_jp = $g['g_title_jp']; $description_jp = $g['g_description_jp']; $category_jp = $g['g_categories_jp']; $tags_jp = $g['g_tags_jp']; $bet_info_jp = $g['g_betInfo_jp']; $bet_condition_jp = $g['g_addInfo_jp']; $reserve_time1 = time(); $reserve_time2 = time(); $timezone = $g['g_timezone']; $coin_per_bet = $g['g_coinPerBet']; $house_comm = $g['g_houseCom']; $publish_type = 'draft'; $is_recommend = $g['g_isRecommend']; $is_trial = $g['g_isTrial']; $jap_page = $g['g_japPage']; $eng_page = $g['g_engPage']; $bet_minimum = $g['g_betMinimum']; $q = "INSERT INTO games "; $q .= "(g_title, g_title_jp, g_description, g_description_jp, g_image, g_categories, g_categories_jp, g_tags, g_tags_jp, g_betInfo, g_betInfo_jp, g_addInfo, g_addInfo_jp, g_schedFrom, g_schedTo, g_timezone, g_coinPerBet, g_houseCom, g_publishType, g_isRecommend, g_isTrial, g_japPage, g_engPage, g_betMinimum, g_isCancelled, g_isClosed, g_isDeleted) "; $q .= "VALUES "; $q .= "('{$title}', '{$title_jp}', '{$description}', '{$description_jp}', '{$imgfilename}', '{$category}', '{$category_jp}', '{$tags}', '{$tags_jp}', '{$bet_info}', '{$bet_info_jp}', '{$bet_condition}', '{$bet_condition_jp}', '{$reserve_time1}', '{$reserve_time2}', '{$timezone}', '{$coin_per_bet}', '{$house_comm}', '{$publish_type}', '{$is_recommend}', '{$is_trial}', '{$jap_page}', '{$eng_page}', '{$bet_minimum}', '0', '0', '0')"; mysql_query($q); $insert_id = mysql_insert_id(); $cachefile = $basedir . '/temp/bet_items_active.php'; $cachedata = false; if (file_exists($cachefile)) { $cachedata = json_decode(file_get_contents($cachefile), true); } foreach ($bet_items as $bi) { $description = $bi['bi_description']; $description_jp = $bi['bi_description_jp']; $bet_id = addBetItem($insert_id, $description_jp, $description); if ($bet_id and $cachedata) { $cachedata[] = array('bi_id' => $bet_id, 'bi_game_id' => $insert_id, 'bi_description' => $description, 'bi_winner' => 0); } } if ($cachedata) { file_put_contents($cachefile, json_encode($cachedata)); } // erase the cache $filename = $basedir . '/temp/all_games.txt'; unlink($filename); $games = getAllGames(); file_put_contents($filename, json_encode($games)); return true; }
<div class="newgames"> <div class="container"> <div class="row"> <div class="col-md-10 col-sm-9"> <h2>New Games</h2> <div class="jcarousel-wrapper"> <div class="jcarousel"> <ul> <?php $newgames = getAllGames(); if ($newgames > 0) { while ($newgame = mysql_fetch_array($newgames)) { ?> <li> <div class="slidebox"> <a href="maverick-game-<?php echo $newgame['game_seo']; ?> "> <img src="silverhat_games/game_slider/<?php echo $newgame['game_slider']; ?> " alt=""> <h4><?php echo $newgame['game_name']; ?> </h4> <p><?php
<div class="col-md-12 col-sm-12"> <div class="row"> <div class="col-md-9 col-sm-9 col-xs-12"> <!--<div class="drk-box"><h2> <span></span></h2> <p> <a class="box-btn" href="javascript:;"></a></p> </div> --> <div class="three-box"> <h2>Maverick <span>Games</span></h2> <?php $maverick_games = getAllGames(); if ($maverick_games > 0) { while ($maverick_game = mysql_fetch_array($maverick_games)) { ?> <div class="col-md-4 col-sm-4 col-xs-12"> <div class="box wow zoomInUp"> <div class="border-line"> <img src="silverhat_games/game_image/<?php echo $maverick_game['game_image']; ?> " class="img-responsive" alt="Box Image" height="125" width="221"> </div> </div> </div>
</td> </tr> </table> <?php if (isset($_GET["game_type"])) { $filter .= " AND g.alias_id = '" . $_GET["game_type"] . "' "; } $sth = $db->prepare("SELECT COUNT(*) FROM " . OSDB_GAMES . " as g\n LEFT JOIN " . OSDB_DG . " as dg ON g.id = dg.gameid \n WHERE g.map LIKE '%" . OS_DEFAULT_MAP . "%' AND g.duration>='" . $duration . "' \n {$filter}\n LIMIT 1"); $result = $sth->execute(); $r = $sth->fetch(PDO::FETCH_NUM); $numrows = $r[0]; $result_per_page = $GamesPerPage; $draw_pagination = 1; $SHOW_TOTALS = 1; include 'pagination.php'; $sth = $db->prepare(getAllGames($duration, $offset, $rowsperpage, $filter, $orderby)); $result = $sth->execute(); ?> <table> <tr> <th width="240" class="padLeft ">Game name</th> <th width="64">Action</th> <th width="80">Duration</th> <th width="40">Type</th> <th width="140">Date</th> <th width="150">Creator</th> <th width="80" >Views</th> </tr> <?php while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { //REPLAY
$username = $CurrentPlayers[$c][$i]; $realm = $CurrentPlayers[$c][$i + 1]; $ping = $CurrentPlayers[$c][$i + 2]; $LivePlayers[$i][$c]["username"] = $CurrentPlayers[$c][$i]; $LivePlayers[$i][$c]["realm"] = $CurrentPlayers[$c][$i + 1]; $LivePlayers[$i][$c]["ping"] = $CurrentPlayers[$c][$i + 2]; } */ $c++; } //$db->free($result); } //RECENT GAMES if ($RecentGames == 1 and (!isset($_GET["post_id"]) and !$_GET)) { $sth = $db->prepare(getAllGames($MinDuration, 0, $TotalRecentGames)); $result = $sth->execute(); $c = 0; $RecentGamesData = array(); while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { $RecentGamesData[$c]["id"] = (int) $row["id"]; //$RecentGamesData[$c]["map"] = convEnt2(substr($row["map"], strripos($row["map"], '\\')+1)); //$RecentGamesData[$c]["map"] = reset( explode(".w", $RecentGamesData[$c]["map"] ) ); //$RecentGamesData[$c]["map"] = substr($RecentGamesData[$c]["map"],0,20); $GetMap = convEnt2(substr($row["map"], strripos($row["map"], '\\') + 1)); $Map = explode(".w", $GetMap); $RecentGamesData[$c]["map"] = $Map[0]; $RecentGamesData[$c]["datetime"] = $row["datetime"]; $RecentGamesData[$c]["gamename"] = $row["gamename"]; $RecentGamesData[$c]["ownername"] = $row["ownername"]; $RecentGamesData[$c]["duration"] = $row["duration"];