<?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);
<?php

/*
	This cron renews all the caches
*/
require_once "../include/config.php";
require_once $basedir . "/include/functions.php";
//user_bets_active.php
getAllUserBetsNoWinnerAndWriteToCache();
//all_users.txt
$all_users = getAllUsers();
$file = $basedir . '/temp/all_users.txt';
$data = array();
foreach ($all_users as $au) {
    $data[$au['user_id']] = $au;
}
unlink($file);
file_put_contents($file, json_encode($data));
//all_coin_deals.txt
$coin_deals = getCoinDeals();
$file = $basedir . '/temp/all_coin_deals.txt';
$data = array();
foreach ($coin_deals as $cd) {
    $data[] = $cd;
}
unlink($file);
file_put_contents($file, json_encode($data));