This is an interface to the Proc4 system. For more information about Proc4, go to Proc 4 home page.

App:
Uid:
Context:
Sender:
Message:
Timestamp:
data:
$app, 'uid' => $uid, 'context' => $_POST['context'], 'sender' => $_POST['sender'], 'message' => "Player Start", 'active' => TRUE, 'timestamp' => $timestamp, 'data' => $_POST['data'] ); $mong = new MongoDB\Client("mongodb://localhost"); // connect $col=$mong->Proc4->Players; $rec=$col->findOne(['app' => $app, 'uid' => $uid], ['limit' => 1,'sort' => ['timestamp' => -1]]); if ($rec == null) { $result = $col->insertOne($P4mess); } else { $result = $col->updateOne(['app' => $app, 'uid' => $uid], ['$set' => ['active' => true, 'timestamp' => $timestamp]]); $P4mess['data'] = $rec['data']; } $P4mess['message'] = "Player Start Acknolwedge"; $P4mess['sender'] = "Proc 4 dongle"; header('Access-Control-Allow-Credentials: true'); header('Access-Control-Allow-Headers: Content-Type, Accept, X-Access-Token,access-control-allow-credentials, access-control-allow-headers, access-control-allow-methods, access-control-allow-origin, access-control-max-age, X-Application-Name, X-Request-Time, X-Powered-by'); header('Access-Control-Allow-Methods: GET, POST, OPTIONS'); header('Access-Control-Allow-Origin: *'); header('Content-Type: application/json;charset=utf-8'); echo json_encode($P4mess); //printf("Player started: %s (%s)",$_POST['uid'],$_POST['app']); } elseif($_SERVER['REQUEST_METHOD']=="OPTIONS") { header('Access-Control-Allow-Credentials: true'); header('Access-Control-Allow-Headers: Content-Type, Accept, X-Access-Token,access-control-allow-credentials, access-control-allow-headers, access-control-allow-methods, access-control-allow-origin, access-control-max-age, X-Application-Name, X-Request-Time, X-Powered-by'); header('Access-Control-Allow-Methods: GET, POST, OPTIONS'); header('Access-Control-Allow-Origin: *'); header('Access-Control-Max-Age: 1728000'); header('Content-Length: 0'); header('Content-Type: text/plain'); } else { die("This script only works with GET and POST requests."); } ?>