Update Join.php

This commit is contained in:
Mario 2023-05-22 13:21:11 +03:00 committed by GitHub
parent af5e01fc02
commit 31cbeefa04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 23 additions and 21 deletions

View File

@ -1,12 +1,11 @@
<?php <?php
require_once 'core/classes.php'; require_once '../core/classes.php';
headStart();require_once '../core/config.php'; require_once '../core/config.php';
require_once '../core/classes/user.php'; require_once '../core/classes/user.php';
headStart();
$privatekey = $gameSettings["privatekey"]; $privatekey = $gameSettings["privatekey"]; // get the private key
header('content-type: application/json'); // set the content type to json which makes it look cool
header('content-type:application/json'); function authticket($id, $name, $charapp, $jobid, $privatekey) { // clientticket generator provided by wumbomumbo/ficello! thank you
function authticket($id, $name, $charapp, $jobid, $privatekey) {
$ticket = $id . "\n" . $jobid . "\n" . date('n\/j\/Y\ g\:i\:s\ A'); $ticket = $id . "\n" . $jobid . "\n" . date('n\/j\/Y\ g\:i\:s\ A');
openssl_sign($ticket, $sig, $privatekey, OPENSSL_ALGO_SHA1); openssl_sign($ticket, $sig, $privatekey, OPENSSL_ALGO_SHA1);
$sig = base64_encode($sig); $sig = base64_encode($sig);
@ -16,8 +15,9 @@ function authticket($id, $name, $charapp, $jobid, $privatekey) {
$final = date('n\/j\/Y\ g\:i\:s\ A') . ";" . $sig2 . ";" . $sig; $final = date('n\/j\/Y\ g\:i\:s\ A') . ";" . $sig2 . ";" . $sig;
return($final); return($final);
} }
$token = $_GET["token"]; if(isset($_GET["token"]) && isset($_GET["jobid"])) {
$jobid = $_GET["jobid"]; $token = $_GET["token"]; // get the token
$jobid = $_GET["jobid"]; // get the jobid
$checkjob = $con->prepare('SELECT COUNT(*) FROM jobs WHERE jobid=:jobid'); // bruh im too lazy to actually make a auto token generator thing and a table so rn this will be temporary $checkjob = $con->prepare('SELECT COUNT(*) FROM jobs WHERE jobid=:jobid'); // bruh im too lazy to actually make a auto token generator thing and a table so rn this will be temporary
$checkjob->bindParam(':jobid', $jobid); $checkjob->bindParam(':jobid', $jobid);
$checkjob->execute(); $checkjob->execute();
@ -28,30 +28,30 @@ $checkuser->execute();
$anotheranothermomentoftruth = $checkuser->fetchColumn(); $anotheranothermomentoftruth = $checkuser->fetchColumn();
if ($anothermomentoftruth == 1 && $anotheranothermomentoftruth == 1) { if ($anothermomentoftruth == 1 && $anotheranothermomentoftruth == 1) {
$okbruh = "1"; $okbruh = "1";
$haha = $con->prepare('SELECT COUNT(*) FROM tokens WHERE token=:token AND passedjoinscript=:passed'); $haha = $con->prepare('SELECT COUNT(*) FROM tokens WHERE token=:token AND passedjoinscript=:passed'); // have we already passed the joinscript on this token?
$haha->bindParam(':token', $token); $haha->bindParam(':token', $token);
$haha->bindParam(':passed', $okbruh); $haha->bindParam(':passed', $okbruh);
$haha->execute(); $haha->execute();
$moretrolling = $haha->fetchColumn(); $moretrolling = $haha->fetchColumn();
if ($moretrolling == 1) { if ($moretrolling == 1) {
header("Location: /"); header("Location: /");
} else if ($moretrolling == 0) { } elseif ($moretrolling == 0) {
$hahatroll = $con->prepare('UPDATE tokens SET passedjoinscript = 1 WHERE token=:token'); $hahatroll = $con->prepare('UPDATE tokens SET passedjoinscript = 1 WHERE token=:token'); // make it pass the joinscript
$hahatroll->bindParam(':token', $token); $hahatroll->bindParam(':token', $token);
$hahatroll->execute(); $hahatroll->execute();
$getstuff = $con->prepare('SELECT placeid,userid FROM tokens WHERE token=:token'); $getstuff = $con->prepare('SELECT placeid,userid FROM tokens WHERE token=:token'); // get user info
$getstuff->bindParam(':token', $token); $getstuff->bindParam(':token', $token);
$getstuff->execute(); $getstuff->execute();
$china = $getstuff->fetch(PDO::FETCH_BOTH); $china = $getstuff->fetch(PDO::FETCH_BOTH);
$placeid = $china['placeid']; $placeid = $china['placeid'];
$id = $china['userid']; $id = $china['userid'];
$getusername = $con->prepare('SELECT username FROM users WHERE id=:id'); $getusername = $con->prepare('SELECT username FROM users WHERE id=:id'); // get username
$getusername->bindParam(':id', $id); $getusername->bindParam(':id', $id);
$getusername->execute(); $getusername->execute();
$ok = $getusername->fetch(PDO::FETCH_BOTH); $ok = $getusername->fetch(PDO::FETCH_BOTH);
$username = $ok['username']; $username = $ok['username'];
$china = $getstuff->fetch(PDO::FETCH_BOTH); $china = $getstuff->fetch(PDO::FETCH_BOTH);
$jobstuff = $con->prepare('SELECT jobid,placeid,port,ip FROM jobs WHERE jobid=:jobid'); $jobstuff = $con->prepare('SELECT jobid,placeid,port,ip FROM jobs WHERE jobid=:jobid'); // get server info
$jobstuff->bindParam(':jobid', $jobid); $jobstuff->bindParam(':jobid', $jobid);
$jobstuff->execute(); $jobstuff->execute();
$actualthing = $jobstuff->fetch(PDO::FETCH_BOTH); $actualthing = $jobstuff->fetch(PDO::FETCH_BOTH);
@ -60,8 +60,9 @@ if ($anothermomentoftruth == 1 && $anotheranothermomentoftruth == 1) {
$port = $actualthing['port']; $port = $actualthing['port'];
$ip = $actualthing['ip']; $ip = $actualthing['ip'];
// still need to add charapp and membership // still need to add charapp and membership
$authticket = authticket($id, $username, "", $jobid, $gameSettings["privatekey"]); $authticket = authticket($id, $username, "0", $jobid, $gameSettings["privatekey"]); // this is where the clientticket gets generated NOTE: make the charapp 0 if theres no charapp
$joinscript = [ // here the magic begins
$joinscript = [
"ClientPort" => 0, "ClientPort" => 0,
"MachineAddress" => $ip, "MachineAddress" => $ip,
"ServerPort" => $port, "ServerPort" => $port,
@ -77,7 +78,7 @@ if ($anothermomentoftruth == 1 && $anotheranothermomentoftruth == 1) {
"PlaceId" => $placeid, "PlaceId" => $placeid,
"MeasurementUrl" => "", "MeasurementUrl" => "",
"WaitingForCharacterGuid" => "26eb3e21-aa80-475b-a777-b43c3ea5f7d2", "WaitingForCharacterGuid" => "26eb3e21-aa80-475b-a777-b43c3ea5f7d2",
"BaseUrl" => "http://" . $soapcfg['url'] . "/", "BaseUrl" => "http://" . $soapcfg["url"] . "/",
"ChatStyle" => "ClassicAndBubble", "ChatStyle" => "ClassicAndBubble",
"VendorId" => "0", "VendorId" => "0",
"ScreenShotInfo" => "", "ScreenShotInfo" => "",
@ -89,12 +90,12 @@ if ($anothermomentoftruth == 1 && $anotheranothermomentoftruth == 1) {
"CookieStoreFirstTimePlayKey" => "rbx_evt_ftp", "CookieStoreFirstTimePlayKey" => "rbx_evt_ftp",
"CookieStoreFiveMinutePlayKey" => "rbx_evt_fmp", "CookieStoreFiveMinutePlayKey" => "rbx_evt_fmp",
"CookieStoreEnabled" => true, "CookieStoreEnabled" => true,
"IsRobloxPlace" => false, "IsRobloxPlace" => false, // this is for event games useful for awarding hats/gears/whatever
"GenerateTeleportJoin" => false, "GenerateTeleportJoin" => false,
"IsUnknownOrUnder13" => false, "IsUnknownOrUnder13" => false,
"SessionId" => "", "SessionId" => "",
"DataCenterId" => 0, "DataCenterId" => 0,
"UniverseId" => 3, "UniverseId" => $placeid,
"BrowserTrackerId" => 0, "BrowserTrackerId" => 0,
"UsePortraitMode" => false, "UsePortraitMode" => false,
"FollowUserId" => 0, "FollowUserId" => 0,
@ -112,8 +113,9 @@ $signature = "";
openssl_sign($script, $signature, $key, OPENSSL_ALGO_SHA1); openssl_sign($script, $signature, $key, OPENSSL_ALGO_SHA1);
return base64_encode($signature); return base64_encode($signature);
} }
}
// IF U WROTE THIS SHIT BELOW THEN KYS // IF U WROTE THIS SHIT BELOW THEN KYS // LOOOOOOOOL THIS COMMENT WAS WRITTEN A FEW MONTHS AGO AND IM DYING LOOOOL - Mario 2023
/* /*
$joinUser = [ $joinUser = [