Merge branch 'main' of https://github.com/grublox/grublox-site
This commit is contained in:
commit
9ead5c3543
|
|
@ -21,10 +21,10 @@ if($devmode) {
|
||||||
// if ur gonna use the availablegameservers array please pick a random gameserver from the array or else we would put all stress on 1 gameserver
|
// if ur gonna use the availablegameservers array please pick a random gameserver from the array or else we would put all stress on 1 gameserver
|
||||||
|
|
||||||
$AvailableGameservers = [
|
$AvailableGameservers = [
|
||||||
"ip goes here",
|
"1" => "127.0.0.1"
|
||||||
"ahh help!!"
|
|
||||||
];
|
];
|
||||||
// No ports? NO BITCHES
|
// No ports? NO BITCHES
|
||||||
|
// default is 64989 NOOB
|
||||||
|
|
||||||
$gameSettings = [
|
$gameSettings = [
|
||||||
"privatekey" => "-----BEGIN RSA PRIVATE KEY-----
|
"privatekey" => "-----BEGIN RSA PRIVATE KEY-----
|
||||||
|
|
|
||||||
144
game/Join.php
144
game/Join.php
|
|
@ -4,68 +4,70 @@ session_start();
|
||||||
require_once '../core/config.php';
|
require_once '../core/config.php';
|
||||||
require_once '../core/classes/user.php';
|
require_once '../core/classes/user.php';
|
||||||
|
|
||||||
|
$privatekey = $gameSettings["privatekey"];
|
||||||
|
|
||||||
header('content-type:application/json');
|
header('content-type:application/json');
|
||||||
$user = new User($con, $_SESSION['user'] ?? 0);
|
function authticket($id, $name, $charapp, $jobid, $privatekey) {
|
||||||
function sign($script, $key) {
|
$ticket = $id . "\n" . $jobid . "\n" . date('n\/j\/Y\ g\:i\:s\ A');
|
||||||
$signature = "";
|
openssl_sign($ticket, $sig, $privatekey, OPENSSL_ALGO_SHA1);
|
||||||
openssl_sign($script, $signature, $key, OPENSSL_ALGO_SHA1);
|
$sig = base64_encode($sig);
|
||||||
return base64_encode($signature);
|
$ticket2 = $id . "\n" . $name . "\n" . $charapp . "\n". $jobid . "\n" . date('n\/j\/Y\ g\:i\:s\ A');
|
||||||
|
openssl_sign($ticket2, $sig2, $privatekey, OPENSSL_ALGO_SHA1);
|
||||||
|
$sig2 = base64_encode($sig2);
|
||||||
|
$final = date('n\/j\/Y\ g\:i\:s\ A') . ";" . $sig2 . ";" . $sig;
|
||||||
|
return($final);
|
||||||
}
|
}
|
||||||
|
$token = $_GET["token"];
|
||||||
/*
|
$jobid = $_GET["jobid"];
|
||||||
$joinUser = [
|
$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
|
||||||
"id" => $_SESSION['user'],
|
$checkjob->bindParam(':jobid', $jobid);
|
||||||
"username" => $user->getUsername(),
|
$checkjob->execute();
|
||||||
"mship" => "None"
|
$anothermomentoftruth = $checkjob->fetchColumn();
|
||||||
];*/
|
$checkuser = $con->prepare('SELECT COUNT(*) FROM users WHERE token=:token'); // another temp workaround im gonna do token system and stuff whenever i feel like it
|
||||||
|
$checkuser->bindParam(':token', $token);
|
||||||
$joinUser = [
|
$checkuser->execute();
|
||||||
"id" => rand(1,5),
|
$anotheranothermomentoftruth = $checkuser->fetchColumn();
|
||||||
"username" => "Grubloxxer-".getrandmax(),
|
if ($anothermomentoftruth == 1 && $anotheranothermomentoftruth == 1) {
|
||||||
"mship" => "None"
|
$getstuff = $con->prepare('SELECT id,username FROM users WHERE token=:token');
|
||||||
];
|
$getstuff->bindParam(':token', $token);
|
||||||
|
$getstuff->execute();
|
||||||
$place = [
|
$china = $getstuff->fetch(PDO::FETCH_BOTH);
|
||||||
"id" => $_GET["gameid"]
|
$id = $china['id'];
|
||||||
];
|
$username = $china['username'];
|
||||||
|
$jobstuff = $con->prepare('SELECT jobid,placeid,port FROM jobs WHERE jobid=:jobid');
|
||||||
$placeCreator = [
|
$jobstuff->bindParam(':jobid', $jobid);
|
||||||
"id" => 6945435215,
|
$jobstuff->execute();
|
||||||
"username" => "PlaceCreator",
|
$actualthing = $jobstuff->fetch(PDO::FETCH_BOTH);
|
||||||
];
|
$jobid = $actualthing['jobid'];
|
||||||
|
$placeid = $actualthing['placeid'];
|
||||||
$charapp = $site["url"]."/v1.1/avatar-fetch?userId=".$joinUser["id"]."&placeId=".$place["id"];
|
$port = $actualthing['port'];
|
||||||
|
// still need to add charapp and membership
|
||||||
$server = [
|
$authticket = authticket($id, $username, "", $jobid, $gameSettings["privatekey"]);
|
||||||
"ip" => $_GET["ip"],
|
$joinscript = [
|
||||||
"port" => $_GET["port"]
|
|
||||||
];
|
|
||||||
|
|
||||||
$joinscript = [
|
|
||||||
"ClientPort" => 0,
|
"ClientPort" => 0,
|
||||||
"MachineAddress" => $server["ip"],
|
"MachineAddress" => $AvailableGameservers["1"],
|
||||||
"ServerPort" => $server["port"],
|
"ServerPort" => $port,
|
||||||
"PingUrl" => "",
|
"PingUrl" => "",
|
||||||
"PingInterval" => 20,
|
"PingInterval" => 20,
|
||||||
"UserName" => $joinUser["username"],
|
"UserName" => $username,
|
||||||
"SeleniumTestMode" => false,
|
"SeleniumTestMode" => false,
|
||||||
"UserId" => $joinUser["id"],
|
"UserId" => $id,
|
||||||
"SuperSafeChat" => false,
|
"SuperSafeChat" => false,
|
||||||
"CharacterAppearance" => $charapp,
|
"CharacterAppearance" => "",
|
||||||
"ClientTicket" => "",
|
"ClientTicket" => $authticket,
|
||||||
"GameId" => $place["id"],
|
"GameId" => $placeid,
|
||||||
"PlaceId" => $place["id"],
|
"PlaceId" => $placeid,
|
||||||
"MeasurementUrl" => "",
|
"MeasurementUrl" => "",
|
||||||
"WaitingForCharacterGuid" => "26eb3e21-aa80-475b-a777-b43c3ea5f7d2",
|
"WaitingForCharacterGuid" => "26eb3e21-aa80-475b-a777-b43c3ea5f7d2",
|
||||||
"BaseUrl" => $site["url"]."/",
|
"BaseUrl" => "http://" . $soapcfg['url'] . "/",
|
||||||
"ChatStyle" => "ClassicAndBubble",
|
"ChatStyle" => "ClassicAndBubble",
|
||||||
"VendorId" => "0",
|
"VendorId" => "0",
|
||||||
"ScreenShotInfo" => "",
|
"ScreenShotInfo" => "",
|
||||||
"VideoInfo" => "",
|
"VideoInfo" => "",
|
||||||
"CreatorId" => $placeCreator["id"],
|
"CreatorId" => "",
|
||||||
"CreatorTypeEnum" => "User",
|
"CreatorTypeEnum" => "User",
|
||||||
"MembershipType" => $joinUser["mship"],
|
"MembershipType" => "None",
|
||||||
"AccountAge" => 3000000,
|
"AccountAge" => 365,
|
||||||
"CookieStoreFirstTimePlayKey" => "rbx_evt_ftp",
|
"CookieStoreFirstTimePlayKey" => "rbx_evt_ftp",
|
||||||
"CookieStoreFiveMinutePlayKey" => "rbx_evt_fmp",
|
"CookieStoreFiveMinutePlayKey" => "rbx_evt_fmp",
|
||||||
"CookieStoreEnabled" => true,
|
"CookieStoreEnabled" => true,
|
||||||
|
|
@ -78,10 +80,50 @@ $joinscript = [
|
||||||
"BrowserTrackerId" => 0,
|
"BrowserTrackerId" => 0,
|
||||||
"UsePortraitMode" => false,
|
"UsePortraitMode" => false,
|
||||||
"FollowUserId" => 0,
|
"FollowUserId" => 0,
|
||||||
"characterAppearanceId" => $joinUser["id"]
|
"characterAppearanceId" => $id
|
||||||
];
|
];
|
||||||
|
} else {
|
||||||
|
header("Location: /");
|
||||||
|
}
|
||||||
|
$user = new User($con, $_SESSION['user'] ?? 0);
|
||||||
|
function sign($script, $key) {
|
||||||
|
$signature = "";
|
||||||
|
openssl_sign($script, $signature, $key, OPENSSL_ALGO_SHA1);
|
||||||
|
return base64_encode($signature);
|
||||||
|
}
|
||||||
|
|
||||||
|
// IF U WROTE THIS SHIT BELOW THEN KYS
|
||||||
|
|
||||||
|
/*
|
||||||
|
$joinUser = [
|
||||||
|
"id" => $_SESSION['user'],
|
||||||
|
"username" => $user->getUsername(),
|
||||||
|
"mship" => "None"
|
||||||
|
];*/
|
||||||
|
|
||||||
|
//$joinUser = [
|
||||||
|
// "id" => rand(1,5),
|
||||||
|
// "username" => "Grubloxxer-".getrandmax(),
|
||||||
|
// "mship" => "None"
|
||||||
|
//];
|
||||||
|
|
||||||
|
//$place = [
|
||||||
|
// "id" => $_GET["gameid"]
|
||||||
|
//];
|
||||||
|
|
||||||
|
//$placeCreator = [
|
||||||
|
// "id" => 6945435215,
|
||||||
|
// "username" => "PlaceCreator",
|
||||||
|
//];
|
||||||
|
|
||||||
|
//$charapp = $site["url"]."/v1.1/avatar-fetch?userId=".$joinUser["id"]."&placeId=".$place["id"];
|
||||||
|
|
||||||
|
//$server = [
|
||||||
|
// "ip" => $_GET["ip"],
|
||||||
|
// "port" => $_GET["port"]
|
||||||
|
//];
|
||||||
|
|
||||||
$data = json_encode($joinscript, JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK);
|
$data = json_encode($joinscript, JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK);
|
||||||
$signature = sign("\r\n" . $data, $gameSettings["privatekey"]);
|
$signature = sign("\r\n" . $data, $gameSettings["privatekey"]);
|
||||||
exit("--rbxsig%". $signature . "%\r\n" . $data);
|
exit("--rbxsig%". $signature . "%\r\n" . $data);
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -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: /");
|
||||||
|
}
|
||||||
|
|
|
||||||
35
grublox.sql
35
grublox.sql
|
|
@ -2,10 +2,10 @@
|
||||||
-- version 5.2.0
|
-- version 5.2.0
|
||||||
-- https://www.phpmyadmin.net/
|
-- https://www.phpmyadmin.net/
|
||||||
--
|
--
|
||||||
-- Host: localhost
|
-- Host: 127.0.0.1
|
||||||
-- Generation Time: Feb 12, 2023 at 08:53 PM
|
-- Generation Time: Feb 12, 2023 at 11:26 PM
|
||||||
-- Server version: 10.4.21-MariaDB-log
|
-- Server version: 10.4.25-MariaDB
|
||||||
-- PHP Version: 8.0.27
|
-- PHP Version: 8.1.10
|
||||||
|
|
||||||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
||||||
START TRANSACTION;
|
START TRANSACTION;
|
||||||
|
|
@ -104,6 +104,19 @@ CREATE TABLE `games` (
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Table structure for table `jobs`
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE TABLE `jobs` (
|
||||||
|
`id` int(11) NOT NULL,
|
||||||
|
`jobid` varchar(50) NOT NULL,
|
||||||
|
`placeid` int(11) NOT NULL,
|
||||||
|
`port` int(11) NOT NULL
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Table structure for table `users`
|
-- Table structure for table `users`
|
||||||
--
|
--
|
||||||
|
|
@ -125,7 +138,7 @@ CREATE TABLE `users` (
|
||||||
--
|
--
|
||||||
|
|
||||||
INSERT INTO `users` (`id`, `username`, `password`, `date`, `token`, `description`, `money`, `lastPaid`, `admin`) VALUES
|
INSERT INTO `users` (`id`, `username`, `password`, `date`, `token`, `description`, `money`, `lastPaid`, `admin`) VALUES
|
||||||
(1, 'qzip', '$2y$10$AS751CiLVhlbLKo.T9CSVuc81sk8OxC2aWCJzhXac/m8m.J3.pezi', '2023-02-05 18:52:48', NULL, NULL, 2460, '1676646382', 1);
|
(1, 'qzip', '$2y$10$AS751CiLVhlbLKo.T9CSVuc81sk8OxC2aWCJzhXac/m8m.J3.pezi', '2023-02-05 18:52:48', '1', NULL, 2460, '1676646382', 1);
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Indexes for dumped tables
|
-- Indexes for dumped tables
|
||||||
|
|
@ -155,6 +168,12 @@ ALTER TABLE `friends`
|
||||||
ALTER TABLE `games`
|
ALTER TABLE `games`
|
||||||
ADD PRIMARY KEY (`id`);
|
ADD PRIMARY KEY (`id`);
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Indexes for table `jobs`
|
||||||
|
--
|
||||||
|
ALTER TABLE `jobs`
|
||||||
|
ADD PRIMARY KEY (`id`);
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Indexes for table `users`
|
-- Indexes for table `users`
|
||||||
--
|
--
|
||||||
|
|
@ -189,6 +208,12 @@ ALTER TABLE `friends`
|
||||||
ALTER TABLE `games`
|
ALTER TABLE `games`
|
||||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- AUTO_INCREMENT for table `jobs`
|
||||||
|
--
|
||||||
|
ALTER TABLE `jobs`
|
||||||
|
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
||||||
|
|
||||||
--
|
--
|
||||||
-- AUTO_INCREMENT for table `users`
|
-- AUTO_INCREMENT for table `users`
|
||||||
--
|
--
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue