25 lines
698 B
PHP
25 lines
698 B
PHP
<?php
|
|
// include database and object files
|
|
include_once '../config/init.php'; // contains $db
|
|
include_once '../config/error.php';
|
|
include_once '../objects/db_participates.php';
|
|
|
|
// prepare user object
|
|
$participation = new UserInGameSession($db);
|
|
$participation->sessionId = 1458;
|
|
$participation->userId = 6;
|
|
$participation->endStatus = 0;
|
|
|
|
// user leaves session
|
|
if ($participation->userLeaves())
|
|
{
|
|
// update score and averages
|
|
if ($participation->updateUserScores())
|
|
{
|
|
$participation_arr = $participation->getResultArray(true, "User_Left_OK");
|
|
print_r(json_encode($participation_arr)); // OK
|
|
}
|
|
else trigger_error("Calculate_Score_Failed");
|
|
}
|
|
else trigger_error("Leave_Session_Failed");
|
|
?>
|