Update PlaceLauncher.php
This commit is contained in:
parent
08ef6ee47d
commit
be57637a1f
|
|
@ -1,23 +1,45 @@
|
||||||
<?php
|
<?php
|
||||||
require_once '../core/config.php';
|
require_once '../core/config.php';
|
||||||
|
header('content-type:application/json');
|
||||||
$allstatus = [
|
$allstatus = [
|
||||||
1 => "Wait",
|
1 => "0 or 1 is not an error - it is a sign that we should wait",
|
||||||
2 => "Working",
|
2 => "Success",
|
||||||
3 => "Disabled",
|
3 => "Disabled",
|
||||||
4 => "Failed to start",
|
4 => "Failed to start",
|
||||||
5 => "Game ended",
|
5 => "Game ended",
|
||||||
6 => "Full"
|
6 => "GAME_FULL",
|
||||||
|
10 => "USER_LEFT"
|
||||||
];
|
];
|
||||||
$status = 2;
|
$token = $_GET["token"];
|
||||||
$ip = "127.0.0.1";
|
$checkifuser = $con->prepare('SELECT COUNT(*) FROM users WHERE token=:token'); // bruh im too lazy to actually make a auto token generator thing and a table so rn this will be temporary
|
||||||
$port = 53640;
|
$checkifuser->bindParam(':token', $token);
|
||||||
$job = 69;
|
$checkifuser->execute();
|
||||||
$response = [
|
$momentoftruth = $checkifuser->fetchColumn();
|
||||||
|
if ($momentoftruth == 1) {
|
||||||
|
$status = "2";
|
||||||
|
$ip = $AvailableGameservers[1];
|
||||||
|
$port = 64989;
|
||||||
|
$PortForGame = ""; // also pls define this
|
||||||
|
$job = ""; // we will define this later when we start the job
|
||||||
|
$placeid = ""; // also define this
|
||||||
|
// JOB STARTING CODE GOES HERE PLS HELP NOLAN
|
||||||
|
// anyways after ur done with that
|
||||||
|
$sendthatjob = $con->prepare('INSERT INTO jobs (jobid, placeid, port) VALUES (:jobid, :placeid, :port)');
|
||||||
|
$jobid = "not-null"; // this is just a temp workaround
|
||||||
|
$sendthatjob->bindParam(':jobid', $jobid);
|
||||||
|
$tempplaceid = "1818";
|
||||||
|
$sendthatjob->bindParam(':placeid', $tempplaceid); // another temporary thing since we don't have random token generator thing and token table
|
||||||
|
$sendthatjob->bindParam(':port', $PortForGame);
|
||||||
|
$sendthatjob->execute();
|
||||||
|
$response = [
|
||||||
"jobId" => $job,
|
"jobId" => $job,
|
||||||
"status" => $status,
|
"status" => $status,
|
||||||
"joinScriptUrl" => $site["url"]."/game/join?ip=$ip&port=$port&gameid=1818&jobid=$job",
|
"joinScriptUrl" => "http://". $soapcfg['url'] ."/game/join?token=". $token ."&jobid=". $job,
|
||||||
"authenticationUrl" => $site["url"]."/Login/Negotiate.ashx",
|
"authenticationUrl" => "http://". $soapcfg['url'] ."/Login/Negotiate.ashx",
|
||||||
"authenticationTicket" => "1",
|
"authenticationTicket" => $token,
|
||||||
"message" => $allstatus[$status]
|
"message" => $allstatus[$status]
|
||||||
];
|
];
|
||||||
echo json_encode($response);
|
echo json_encode($response);
|
||||||
|
} else {
|
||||||
|
header("Location: /");
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue