Update PlaceLauncher.php
This commit is contained in:
parent
c61ce622ab
commit
e9943c083e
|
|
@ -1,11 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
require_once '../core/config.php';
|
require_once '../core/config.php';
|
||||||
require_once '../core/Roblox/Grid/Rcc/Job.php';
|
require_once '../core/classes.php';
|
||||||
require_once '../core/Roblox/Grid/Rcc/LuaType.php';
|
|
||||||
require_once '../core/Roblox/Grid/Rcc/LuaValue.php';
|
|
||||||
require_once '../core/Roblox/Grid/Rcc/RCCServiceSoap.php';
|
|
||||||
require_once '../core/Roblox/Grid/Rcc/ScriptExecution.php';
|
|
||||||
require_once '../core/Roblox/Grid/Rcc/Status.php';
|
|
||||||
header('content-type:application/json');
|
header('content-type:application/json');
|
||||||
$allstatus = [
|
$allstatus = [
|
||||||
1 => "0 or 1 is not an error - it is a sign that we should wait",
|
1 => "0 or 1 is not an error - it is a sign that we should wait",
|
||||||
|
|
@ -36,10 +31,10 @@ if ($momentoftruth == 1) {
|
||||||
if ($moretrolling == 1) {
|
if ($moretrolling == 1) {
|
||||||
header("Location: /");
|
header("Location: /");
|
||||||
} else if ($moretrolling == 0) {
|
} else if ($moretrolling == 0) {
|
||||||
$checkifjobalreadyexists = $con->prepare('SELECT COUNT(*) FROM jobs WHERE placeid=:placeid AND isonline=:isonline');
|
$checkifjobalreadyexists = $con->prepare('SELECT COUNT(*) FROM jobs WHERE placeid=:placeid AND hasended=:hasended');
|
||||||
$checkifjobalreadyexists->bindParam(':placeid', $placeid);
|
$checkifjobalreadyexists->bindParam(':placeid', $placeid);
|
||||||
$helppdo = '1';
|
$helppdo = '0';
|
||||||
$checkifjobalreadyexists->bindParam(':isonline', $helppdo);
|
$checkifjobalreadyexists->bindParam(':hasended', $helppdo);
|
||||||
$checkifjobalreadyexists->execute();
|
$checkifjobalreadyexists->execute();
|
||||||
$okcheck = $checkifjobalreadyexists->fetchColumn();
|
$okcheck = $checkifjobalreadyexists->fetchColumn();
|
||||||
if ($okcheck == 1) {
|
if ($okcheck == 1) {
|
||||||
|
|
@ -48,23 +43,23 @@ if ($momentoftruth == 1) {
|
||||||
$hahatroll->bindParam(':passedplacelauncher', $passedplacelauncher);
|
$hahatroll->bindParam(':passedplacelauncher', $passedplacelauncher);
|
||||||
$hahatroll->bindParam(':token', $token);
|
$hahatroll->bindParam(':token', $token);
|
||||||
$hahatroll->execute();
|
$hahatroll->execute();
|
||||||
$getjobforalready = $con->prepare('SELECT jobid FROM jobs WHERE placeid=:placeid AND isonline=:isonline');
|
$getjobforalready = $con->prepare('SELECT jobid FROM jobs WHERE placeid=:placeid AND hasended=:hasended');
|
||||||
$getjobforalready->bindParam(':placeid', $placeid);
|
$getjobforalready->bindParam(':placeid', $placeid);
|
||||||
$getjobforalready->bindParam(':isonline', $helppdo);
|
$getjobforalready->bindParam(':hasended', $helppdo);
|
||||||
$getjobforalready->execute();
|
$getjobforalready->execute();
|
||||||
$china2 = $getjobforalready->fetch(PDO::FETCH_BOTH);
|
$china2 = $getjobforalready->fetch(PDO::FETCH_BOTH);
|
||||||
$jobid = $china2['jobid'];
|
$jobid = $china2['jobid'];
|
||||||
$response = [
|
$response = [
|
||||||
"jobId" => $jobid,
|
"jobId" => $jobid,
|
||||||
"status" => $status,
|
"status" => $status,
|
||||||
"joinScriptUrl" => $soapcfg["usehttps"] . $soapcfg['url'] ."/game/join?token=". $token ."&jobid=". $jobid,
|
"joinScriptUrl" => $site['url'] ."/game/join?token=". $token ."&jobid=". $jobid,
|
||||||
"authenticationUrl" => $soapcfg["usehttps"] . $soapcfg['url'] ."/Login/Negotiate.ashx",
|
"authenticationUrl" => $site['url'] ."/Login/Negotiate.ashx",
|
||||||
"authenticationTicket" => $token,
|
"authenticationTicket" => $token,
|
||||||
"message" => $allstatus[$status]
|
"message" => $allstatus[$status]
|
||||||
];
|
];
|
||||||
echo json_encode($response);
|
echo json_encode($response);
|
||||||
} else if ($okcheck == 0) {
|
} else if ($okcheck == 0) {
|
||||||
$passedplacelauncher = '0'; // IF THIS IS 0 THEN IT MEANS PLACELAUNCHER HASN'T PASSED MAKE SURE THIS IS ONLY IN UR TESTING
|
$passedplacelauncher = '1'; // IF THIS IS 0 THEN IT MEANS PLACELAUNCHER HASN'T PASSED MAKE SURE THIS IS ONLY IN UR TESTING
|
||||||
$hahatroll = $con->prepare('UPDATE tokens SET passedplacelauncher = :passedplacelauncher WHERE token=:token');
|
$hahatroll = $con->prepare('UPDATE tokens SET passedplacelauncher = :passedplacelauncher WHERE token=:token');
|
||||||
$hahatroll->bindParam(':passedplacelauncher', $passedplacelauncher);
|
$hahatroll->bindParam(':passedplacelauncher', $passedplacelauncher);
|
||||||
$hahatroll->bindParam(':token', $token);
|
$hahatroll->bindParam(':token', $token);
|
||||||
|
|
@ -104,7 +99,6 @@ function generateRandomString($length = 25) {
|
||||||
die("How did we get here?");
|
die("How did we get here?");
|
||||||
} else if ($okbrahh == 0) {
|
} else if ($okbrahh == 0) {
|
||||||
$accesstoken = generateRandomString(500);
|
$accesstoken = generateRandomString(500);
|
||||||
echo $accesstoken;
|
|
||||||
$okaccesstoken = $con->prepare('INSERT INTO accesstokens (ip, accesstoken, placeid, jobid) VALUES (:ip, :accesstoken, :placeid, :jobid)');
|
$okaccesstoken = $con->prepare('INSERT INTO accesstokens (ip, accesstoken, placeid, jobid) VALUES (:ip, :accesstoken, :placeid, :jobid)');
|
||||||
$okaccesstoken->bindParam(':ip', $AvailableGameservers[1]);
|
$okaccesstoken->bindParam(':ip', $AvailableGameservers[1]);
|
||||||
$okaccesstoken->bindParam(':accesstoken', $accesstoken);
|
$okaccesstoken->bindParam(':accesstoken', $accesstoken);
|
||||||
|
|
@ -116,7 +110,7 @@ function generateRandomString($length = 25) {
|
||||||
$script = 'print("Starting a new gameserver with JobID: " .. "' . $jobid . '" .. " and PlaceID: " .. "' . $placeid . '")
|
$script = 'print("Starting a new gameserver with JobID: " .. "' . $jobid . '" .. " and PlaceID: " .. "' . $placeid . '")
|
||||||
|
|
||||||
local placeId = ' . (int)$placeid . '
|
local placeId = ' . (int)$placeid . '
|
||||||
local url = "'. $https . $soapcfg['url'] . '"
|
local url = "'. $site['url'] . '"
|
||||||
local accesstoken = "' . $accesstoken . '"
|
local accesstoken = "' . $accesstoken . '"
|
||||||
|
|
||||||
------------------- UTILITY FUNCTIONS --------------------------
|
------------------- UTILITY FUNCTIONS --------------------------
|
||||||
|
|
@ -214,6 +208,7 @@ function generateRandomString($length = 25) {
|
||||||
$job = new Roblox\Grid\Rcc\Job($jobid, 99999999999); // pls only set to this amount WHEN ur hosting a gameserver when ur rendering do like 10 minutes
|
$job = new Roblox\Grid\Rcc\Job($jobid, 99999999999); // pls only set to this amount WHEN ur hosting a gameserver when ur rendering do like 10 minutes
|
||||||
$funny = new Roblox\Grid\Rcc\ScriptExecution("Script".rand(1,getrandmax()), $script);
|
$funny = new Roblox\Grid\Rcc\ScriptExecution("Script".rand(1,getrandmax()), $script);
|
||||||
$result = $RCCServiceSoap->OpenJob($job, $funny);
|
$result = $RCCServiceSoap->OpenJob($job, $funny);
|
||||||
|
jobOpened($jobid, 99999999999);
|
||||||
$sendthatjob = $con->prepare('INSERT INTO jobs (jobid, placeid, port, ip) VALUES (:jobid, :placeid, :port, :ip)');
|
$sendthatjob = $con->prepare('INSERT INTO jobs (jobid, placeid, port, ip) VALUES (:jobid, :placeid, :port, :ip)');
|
||||||
$sendthatjob->bindParam(':jobid', $jobid);
|
$sendthatjob->bindParam(':jobid', $jobid);
|
||||||
$sendthatjob->bindParam(':placeid', $placeid);
|
$sendthatjob->bindParam(':placeid', $placeid);
|
||||||
|
|
@ -223,8 +218,8 @@ function generateRandomString($length = 25) {
|
||||||
$response = [
|
$response = [
|
||||||
"jobId" => $jobid,
|
"jobId" => $jobid,
|
||||||
"status" => $status,
|
"status" => $status,
|
||||||
"joinScriptUrl" => $soapcfg["usehttps"] . $soapcfg['url'] ."/game/join?token=". $token ."&jobid=". $jobid,
|
"joinScriptUrl" => $site['url'] ."/game/join?token=". $token ."&jobid=". $jobid,
|
||||||
"authenticationUrl" => $soapcfg["usehttps"] . $soapcfg['url'] ."/Login/Negotiate.ashx",
|
"authenticationUrl" => $site['url'] ."/Login/Negotiate.ashx",
|
||||||
"authenticationTicket" => $token,
|
"authenticationTicket" => $token,
|
||||||
"message" => $allstatus[$status]
|
"message" => $allstatus[$status]
|
||||||
];
|
];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue