function getCoinDeals() { $data = array(); $q = "SELECT * FROM coin_deals"; $result = mysql_query($q); $numrows = mysql_num_rows($result); if ($numrows) { while ($row = mysql_fetch_array($result)) { $data[] = $row; } } // check if no cache already exists if (!checkCacheExists('all_coin_deals.txt')) { recreateCache('all_coin_deals.txt', $data); } return $data; }
<?php require_once 'include/config.php'; require_once $basedir . "/include/functions.php"; require_once $basedir . "/include/user_functions.php"; if (!$user_id) { header('Location: ' . $baseurl . '#login'); exit; } $joinedgamemenu = 'active'; $categories = getCategories(); // get all data for pie graph if (checkCacheExists('all_coin_deals.txt')) { $all_coin_deals = getCoinDealsFromCache(); } else { $all_coin_deals = getCoinDeals(); } $coin_deals = getUserCoinDeals($user_id, $all_coin_deals); $fromto = getAllRange($coin_deals); $from = $fromto['from']; $to = $fromto['to']; $ret = winLoseRatio($user_id, $from, $to, $coin_deals); $pie = $ret['pie']; $win_lose = $ret['data']; $filter = isset($_GET['f']) ? $_GET['f'] : 'all'; // default to all $cat = isset($_GET['c']) ? $_GET['c'] : 'all'; // default to all $sort = isset($_GET['s']) ? $_GET['s'] : 'latest'; // default to newest $temp = allMyGameItems($user_id, $filter, $cat, $sort);