Release Template files

This commit is contained in:
2026-07-13 11:37:58 +02:00
parent e673b1954c
commit d21c1f24b7
238 changed files with 39672 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
<?php
// include database and object files
include_once '../config/init.php'; // contains $db
include_once '../config/error.php';
include_once '../objects/stats_object.php';
$userId = isset($_POST['userId']) ? $_POST['userId'] : -1;
$sessionId = isset($_POST['sessionId']) ? $_POST['sessionId'] : -1;
$sessionType = isset($_POST['sessionType']) ? $_POST['sessionType'] : -1; // useless because it is "re-calculated"
$fromUserId = isset($_POST['fromUserId']) ? $_POST['fromUserId'] : -1;
if ($sessionId > 0)// && $sessionType < 0) // "calculate" sessionType based on session
{
$session = new GameSession($db);
$session->id = $sessionId;
$session->load();
$sessionType = $session->sessionType;
}
$stats = new StatsObject($db);
$stats->get($sessionId, $userId, $sessionType, $fromUserId);
$stats_arr = $stats->getResultArray(true, "Stats_Collected_OK");
print_r(json_encode($stats_arr)); // OK
?>

View File

@@ -0,0 +1,30 @@
<?php
// include database and object files
include_once '../config/init.php'; // contains $db
include_once '../config/error.php';
include_once '../objects/stats_object.php';
$userId = -1;
$sessionId = -1;
$quickMode = 0;
if (isset($_POST['userId']))
$userId = $_POST['userId'];
else trigger_error( missing_parameter_error("userId") );
if (isset($_POST['sessionId']))
$sessionId = $_POST['sessionId'];
else trigger_error( missing_parameter_error("sessionId") );
if (isset($_POST['quickMode']))
$quickMode = strtolower($_POST['quickMode']) == "true" ? 1 : 0;
//if ($userId > 0 && $sessionId > 0)
{
$stats = new StatsObject($db);
$stats->getUserHistory($userId, $sessionId, $quickMode);
$stats_arr = $stats->getResultArray(true, "Results_Collected_OK");
print_r(json_encode($stats_arr)); // OK
}
?>