Update PlaceLauncher.php
This commit is contained in:
parent
c61ce622ab
commit
e9943c083e
|
|
@ -1,11 +1,6 @@
|
|||
<?php
|
||||
require_once '../core/config.php';
|
||||
require_once '../core/Roblox/Grid/Rcc/Job.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';
|
||||
require_once '../core/classes.php';
|
||||
header('content-type:application/json');
|
||||
$allstatus = [
|
||||
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) {
|
||||
header("Location: /");
|
||||
} 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);
|
||||
$helppdo = '1';
|
||||
$checkifjobalreadyexists->bindParam(':isonline', $helppdo);
|
||||
$helppdo = '0';
|
||||
$checkifjobalreadyexists->bindParam(':hasended', $helppdo);
|
||||
$checkifjobalreadyexists->execute();
|
||||
$okcheck = $checkifjobalreadyexists->fetchColumn();
|
||||
if ($okcheck == 1) {
|
||||
|
|
@ -48,23 +43,23 @@ if ($momentoftruth == 1) {
|
|||
$hahatroll->bindParam(':passedplacelauncher', $passedplacelauncher);
|
||||
$hahatroll->bindParam(':token', $token);
|
||||
$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(':isonline', $helppdo);
|
||||
$getjobforalready->bindParam(':hasended', $helppdo);
|
||||
$getjobforalready->execute();
|
||||
$china2 = $getjobforalready->fetch(PDO::FETCH_BOTH);
|
||||
$jobid = $china2['jobid'];
|
||||
$response = [
|
||||
"jobId" => $jobid,
|
||||
"status" => $status,
|
||||
"joinScriptUrl" => $soapcfg["usehttps"] . $soapcfg['url'] ."/game/join?token=". $token ."&jobid=". $jobid,
|
||||
"authenticationUrl" => $soapcfg["usehttps"] . $soapcfg['url'] ."/Login/Negotiate.ashx",
|
||||
"joinScriptUrl" => $site['url'] ."/game/join?token=". $token ."&jobid=". $jobid,
|
||||
"authenticationUrl" => $site['url'] ."/Login/Negotiate.ashx",
|
||||
"authenticationTicket" => $token,
|
||||
"message" => $allstatus[$status]
|
||||
];
|
||||
echo json_encode($response);
|
||||
} 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->bindParam(':passedplacelauncher', $passedplacelauncher);
|
||||
$hahatroll->bindParam(':token', $token);
|
||||
|
|
@ -104,7 +99,6 @@ function generateRandomString($length = 25) {
|
|||
die("How did we get here?");
|
||||
} else if ($okbrahh == 0) {
|
||||
$accesstoken = generateRandomString(500);
|
||||
echo $accesstoken;
|
||||
$okaccesstoken = $con->prepare('INSERT INTO accesstokens (ip, accesstoken, placeid, jobid) VALUES (:ip, :accesstoken, :placeid, :jobid)');
|
||||
$okaccesstoken->bindParam(':ip', $AvailableGameservers[1]);
|
||||
$okaccesstoken->bindParam(':accesstoken', $accesstoken);
|
||||
|
|
@ -116,7 +110,7 @@ function generateRandomString($length = 25) {
|
|||
$script = 'print("Starting a new gameserver with JobID: " .. "' . $jobid . '" .. " and PlaceID: " .. "' . $placeid . '")
|
||||
|
||||
local placeId = ' . (int)$placeid . '
|
||||
local url = "'. $https . $soapcfg['url'] . '"
|
||||
local url = "'. $site['url'] . '"
|
||||
local accesstoken = "' . $accesstoken . '"
|
||||
|
||||
------------------- 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
|
||||
$funny = new Roblox\Grid\Rcc\ScriptExecution("Script".rand(1,getrandmax()), $script);
|
||||
$result = $RCCServiceSoap->OpenJob($job, $funny);
|
||||
jobOpened($jobid, 99999999999);
|
||||
$sendthatjob = $con->prepare('INSERT INTO jobs (jobid, placeid, port, ip) VALUES (:jobid, :placeid, :port, :ip)');
|
||||
$sendthatjob->bindParam(':jobid', $jobid);
|
||||
$sendthatjob->bindParam(':placeid', $placeid);
|
||||
|
|
@ -223,8 +218,8 @@ function generateRandomString($length = 25) {
|
|||
$response = [
|
||||
"jobId" => $jobid,
|
||||
"status" => $status,
|
||||
"joinScriptUrl" => $soapcfg["usehttps"] . $soapcfg['url'] ."/game/join?token=". $token ."&jobid=". $jobid,
|
||||
"authenticationUrl" => $soapcfg["usehttps"] . $soapcfg['url'] ."/Login/Negotiate.ashx",
|
||||
"joinScriptUrl" => $site['url'] ."/game/join?token=". $token ."&jobid=". $jobid,
|
||||
"authenticationUrl" => $site['url'] ."/Login/Negotiate.ashx",
|
||||
"authenticationTicket" => $token,
|
||||
"message" => $allstatus[$status]
|
||||
];
|
||||
|
|
|
|||
Loading…
Reference in New Issue