1
0
Fork 0
OpenSim.land/api/register.php

22 lines
1.1 KiB
PHP
Raw Normal View History

2020-06-03 15:35:33 +00:00
<?php
2021-11-05 02:01:38 +00:00
$data = json_decode(file_get_contents('php://input'), true);
2021-11-05 02:47:08 +00:00
file_put_contents("debug.txt", print_r($data, true));
//Add User to DB if not exist
$QueueStatement = $RUNTIME['PDO']->prepare("INSERT IGNORE INTO users VALUES (?, ?, ?)");
$QueueStatement->execute(array($data['RegionOwnerID'], $data['RegionOwnerName'], $data['RegionOwnerMail']));
//Add Grid to DB if not exist
$rawGridInfo = getDataFromHTTP(@$data['RegionOwnerURL']['HomeURI']."get_grid_info");
$gridInfo = new SimpleXMLElement($rawGridInfo);
$QueueStatement = $RUNTIME['PDO']->prepare("INSERT IGNORE INTO grids VALUES (?, ?, ?, ?)");
$QueueStatement->execute(array($gridInfo->gridname, @$data['RegionOwnerURL']['HomeURI'], @$data['RegionOwnerURL']['AssetServerURI'], @$data['RegionOwnerURL']['IMServerURI']));
//Add Region to DB if not exist
$QueueStatement = $RUNTIME['PDO']->prepare("INSERT INTO queue VALUES (?, ?, ?)");
$QueueStatement->execute(array(guidv4(), "addRegion", json_encode($data)));
//Set LastSeen online time from Region.
RegionManager::setOnlineTime($data['UUID']);
?>