Release Template files
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
// include database and object files
|
||||
include_once '../config/init.php'; // contains $db
|
||||
include_once '../config/error.php';
|
||||
include_once '../objects/db_reactevent.php';
|
||||
|
||||
// prepare user object
|
||||
$event = new ReactEvent($db);
|
||||
|
||||
// read mandatory $_POST properties
|
||||
// ensure sessionId, trigger index and event type are passed in $_POST parameters
|
||||
if (isset($_POST['srcEventIndex']) && $_POST['srcEventIndex'] >= 0)
|
||||
$event->srcEventIndex = $_POST['srcEventIndex'];
|
||||
else trigger_error( missing_parameter_error("srcEventIndex") );
|
||||
|
||||
if (isset($_POST['srcEventSessionId']) && $_POST['srcEventSessionId'] > 0)
|
||||
$event->srcEventSessionId = $_POST['srcEventSessionId'];
|
||||
else trigger_error( missing_parameter_error("srcEventSessionId") );
|
||||
|
||||
if (isset($_POST['type']))
|
||||
$event->reactType = $_POST['type'];
|
||||
else trigger_error( missing_parameter_error("type") );
|
||||
|
||||
|
||||
// read other $_POST properties
|
||||
$event->hitUserId = $_POST['hitUserId'];
|
||||
$event->hitTargetName = $_POST['targetName'];
|
||||
$event->hitBoneName = $_POST['boneName'];
|
||||
$event->damage = $_POST['damage'];
|
||||
$event->targetKilled = (strcasecmp( ($_POST['targetKilled'] ?? false), "true" ) == 0) ? 1 : 0;
|
||||
$event->objectHitLocationX = $_POST['objectHitLocationX'];
|
||||
$event->objectHitLocationY = $_POST['objectHitLocationY'];
|
||||
$event->objectHitTagLocation = $_POST['objectHitTagLocation'];
|
||||
$event->hitPrecision = $_POST['hitPrecision'];
|
||||
$event->distance = $_POST['distance'];
|
||||
$event->reactTime = $_POST['reactTime'];
|
||||
$event->reactMode = $_POST['reactMode'];
|
||||
$event->timeStamp = $_POST['timestamp'];
|
||||
|
||||
// create reactevent
|
||||
if ($event->record())
|
||||
{
|
||||
$evt_arr = $event->getResultArray(true, "Event_Stored_OK");
|
||||
print_r(json_encode($evt_arr)); // OK
|
||||
}
|
||||
else trigger_error("Error_Occured");
|
||||
?>
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
// include database and object files
|
||||
include_once '../config/init.php'; // contains $db
|
||||
include_once '../config/error.php';
|
||||
include_once '../objects/db_triggerevent.php';
|
||||
|
||||
// prepare user object
|
||||
$event = new TriggerEvent($db);
|
||||
|
||||
// read mandatory $_POST properties
|
||||
// ensure sessionId, userId and trigger index are passed in $_POST parameters
|
||||
if (isset($_POST['session']) && $_POST['session'] > 0)
|
||||
$event->sessionId = $_POST['session'];
|
||||
else trigger_error( missing_parameter_error("session") );
|
||||
|
||||
if (isset($_POST['user']) && $_POST['user'] >= 0)
|
||||
$event->srcUserId = $_POST['user'];
|
||||
else trigger_error( missing_parameter_error("user") );
|
||||
|
||||
if (isset($_POST['index']) && $_POST['index'] >= 0)
|
||||
$event->indexCount = $_POST['index'];
|
||||
else trigger_error( missing_parameter_error("index") );
|
||||
|
||||
// read other $_POST properties
|
||||
$event->type = $_POST['type'];
|
||||
$event->timeStamp = $_POST['timestamp'];
|
||||
$event->successful = $_POST['success'];
|
||||
|
||||
// create trigger event
|
||||
if ($event->record())
|
||||
{
|
||||
$evt_arr = $event->getResultArray(true, "Event_Stored_OK");
|
||||
print_r(json_encode($evt_arr)); // OK
|
||||
}
|
||||
else trigger_error("Error_Occured");
|
||||
?>
|
||||
Reference in New Issue
Block a user