Update PlaceLauncher.php

This commit is contained in:
Mario 2023-02-13 11:11:51 +02:00 committed by GitHub
parent b7cd9ac98a
commit d547286e9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 46 additions and 27 deletions

View File

@ -11,35 +11,54 @@ $allstatus = [
10 => "USER_LEFT" 10 => "USER_LEFT"
]; ];
$token = $_GET["token"]; $token = $_GET["token"];
$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 $checkifuser = $con->prepare('SELECT COUNT(*) FROM tokens WHERE token=:token'); // bruh im too lazy to actually make a auto token generator thing and a table so rn this will be temporary
$checkifuser->bindParam(':token', $token); $checkifuser->bindParam(':token', $token);
$checkifuser->execute(); $checkifuser->execute();
$momentoftruth = $checkifuser->fetchColumn(); $momentoftruth = $checkifuser->fetchColumn();
if ($momentoftruth == 1) { if ($momentoftruth == 1) {
$status = "2"; $okbruh = "1";
$ip = $AvailableGameservers[1]; $haha = $con->prepare('SELECT COUNT(*) FROM tokens WHERE token=:token AND passedplacelauncher=:passed');
$port = 64989; $haha->bindParam(':token', $token);
$PortForGame = ""; // also pls define this $haha->bindParam(':passed', $okbruh);
$job = ""; // we will define this later when we start the job $haha->execute();
$placeid = ""; // also define this $moretrolling = $haha->fetchColumn();
// JOB STARTING CODE GOES HERE PLS HELP NOLAN if ($moretrolling == 1) {
// anyways after ur done with that header("Location: /");
$sendthatjob = $con->prepare('INSERT INTO jobs (jobid, placeid, port) VALUES (:jobid, :placeid, :port)'); } else if ($moretrolling == 0) {
$jobid = "not-null"; // this is just a temp workaround $hahatroll = $con->prepare('UPDATE tokens SET passedplacelauncher = 1 WHERE token=:token');
$sendthatjob->bindParam(':jobid', $jobid); $hahatroll->bindParam(':token', $token);
$tempplaceid = "1818"; $hahatroll->execute();
$sendthatjob->bindParam(':placeid', $tempplaceid); // another temporary thing since we don't have random token generator thing and token table $getstuff = $con->prepare('SELECT placeid FROM tokens WHERE token=:token');
$sendthatjob->bindParam(':port', $PortForGame); $getstuff->bindParam(':token', $token);
$sendthatjob->execute(); $getstuff->execute();
$response = [ $china = $getstuff->fetch(PDO::FETCH_BOTH);
"jobId" => $job, $placeid = $china['placeid']; // use this to start the job
"status" => $status, $status = "2";
"joinScriptUrl" => "http://". $soapcfg['url'] ."/game/join?token=". $token ."&jobid=". $job, $ip = $AvailableGameservers[1];
"authenticationUrl" => "http://". $soapcfg['url'] ."/Login/Negotiate.ashx", $port = 64989;
"authenticationTicket" => $token, $PortForGame = ""; // also pls define this
"message" => $allstatus[$status] $job = ""; // we will define this later when we start the job
]; // JOB STARTING CODE GOES HERE PLS HELP NOLAN
echo json_encode($response); // anyways after ur done with that
} else { $sendthatjob = $con->prepare('INSERT INTO jobs (jobid, placeid, port) VALUES (:jobid, :placeid, :port)');
header("Location: /"); $jobid = "notnull"; // 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" => $jobid,
"status" => $status,
"joinScriptUrl" => "http://". $soapcfg['url'] ."/game/join?token=". $token ."&jobid=". $jobid,
"authenticationUrl" => "http://". $soapcfg['url'] ."/Login/Negotiate.ashx",
"authenticationTicket" => $token,
"message" => $allstatus[$status]
];
echo json_encode($response);
// if u would of paid me to do all of these spaces i would rob u
} else {
header("Location: /");
}
} }
?>