<?php if (!function_exists('generateStats')) { function generateStats() { // Base template for all modes to use $acc = (double) rand(850000, 1000000) / 10000; // 85.0000 - 100.0000 $score = (double) rand(500000, 2000000000) * 2; // 500k - 4bil $playcount = rand(1000, 250000); // 1k - 250k return ['level' => rand(1, 104), 'count300' => rand(10000, 5000000), 'count100' => rand(10000, 2000000), 'count50' => rand(10000, 1000000), 'countMiss' => rand(10000, 1000000), 'accuracy_total' => rand(1000, 250000), 'accuracy_count' => rand(1000, 250000), 'accuracy' => $acc, 'accuracy_new' => $acc, 'playcount' => $playcount, 'fail_count' => rand($playcount * 0.1, $playcount * 0.2), 'exit_count' => rand($playcount * 0.2, $playcount * 0.3), 'ranked_score' => $score, 'total_score' => $score * 1.4, 'x_rank_count' => round($playcount * 0.001), 's_rank_count' => round($playcount * 0.05), 'a_rank_count' => round($playcount * 0.2), 'rank_score' => $score, 'rank_score_index' => rand(1, 500000), 'max_combo' => rand(500, 4000)]; } } $factory->define(App\Models\UserStatistics\Osu::class, function (Faker\Generator $faker) { return generateStats(); }); $factory->define(App\Models\UserStatistics\Fruits::class, function (Faker\Generator $faker) { return generateStats(); }); $factory->define(App\Models\UserStatistics\Mania::class, function (Faker\Generator $faker) { return generateStats(); }); $factory->define(App\Models\UserStatistics\Taiko::class, function (Faker\Generator $faker) { return generateStats(); });
swfobject.embedSWF( "open-flash-chart.swf", "my_chart", "100%", "600", "9.0.0", "expressInstall.swf", {"data-file":"reports-cache/{$filename}"} ); </script> </div> DIVMAP; echo _footer(); die; } // If this is a request, then construct // the SQL command. if ($_SERVER['REQUEST_METHOD'] == 'POST') { $retCacheId = generateStats($_POST); header("location: generate-report.php?cache_id={$retCacheId}"); die; } // else, please display the request form. echo _header("Statistics Generation"); echo <<<DIVMAP <div id="yui-main"> \t<h2>Report Set-up</h2> \t \t<form action="generate-report.php" method="post"> \t<p> \tPlease generate the report named \t\t<input id="reportName" name="reportName" value="Genie"> <br /> <br /> \t\t \tabout
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ set_time_limit(300); include_once "includes/config.php"; include_once "includes/utils.php"; include_once "includes/headfoot.php"; include_once "includes/recordanalyzer.php"; include_once 'includes/php-ofc-library/open-flash-chart.php'; $params = array(); $params['reportName'] = 'All Computers Weekly Report'; $params['reportType'] = 'computerStats'; $params['groupType'] = 'hourDayCombined'; $params['computerRange'] = 'all'; $params['timeFrame'] = '604800'; $params['endTimeFrame'] = '0'; $params['filterWeekends'] = '1'; $params['filterNights'] = '1'; $retCacheId = generateStats($params); $mailsubject = "Report(s) generated!"; $mailbody = "" . $params['reportName'] . " is ready:\n {$siteLocation}/generate-report.php?cache_id={$retCacheId}"; $reportmails = explode('|', $cronReportEmails); foreach ($reportmails as $reportmail) { if (mail($reportmail, $mailsubject, $mailbody)) { echo "Mail sent to {$reportmail} \n"; } } die;
{ global $bdd, $region; $statement = $bdd->prepare('SELECT id from `match` WHERE region = "' . $region . '"'); $statement->execute(); $data = $statement->fetchAll(); $numberOfGames = count($data); $items = array(); for ($i = 0; $i < $numberOfGames; $i++) { $id = $data[$i]["id"]; $statement = $bdd->prepare('SELECT item0, item1, item2, item3, item4, item5, item6 FROM stats WHERE stats.matchID = ' . $id); $statement->execute(); $result = $statement->fetchAll(); $countData = count($result); for ($j = 0; $j < $countData; $j++) { for ($k = 0; $k < 7; $k++) { $itemID = $result[$j][$k]; if (!isset($items[$itemID])) { $items[$itemID] = 0; } $items[$itemID]++; } } } arsort($items); $arr = $items; } // Launch the process generateStats();