Update getauthtoken.php

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

View File

@ -1,22 +1,21 @@
<?php
require_once 'core/classes.php';
require_once 'core/classes/user.php';
header('content-Type: text/plain');
header('content-Type: text/plain'); // set the content type to text plain
ob_start();
session_start();
if($maintenance && $pagename !== "Maintenance") {
header("Location: /maintenance"
header("Location: /maintenance" // is maintenance enabled??
);
}
$user = new User($con, $_SESSION['user'] ?? 0);
if(!$user->isLoggedIn()) {
header('location: /login');
header('location: /login'); // alr hes not signed in so get him out of here
exit;
}
$placeid = $_GET['placeid'];
if (!isset($placeid)) {
echo "No placeid";
exit;
die("No placeid"); // placeid was not found AND FUTURE MARIO HERE USE GOD DAMN DIE()
}
$username = $user->getUsername();
$id = $user->getID($con, $user->getUsername());
@ -29,7 +28,7 @@ function generateRandomString($length = 25) {
}
return $randomString;
} // pls don't hurt me
$checkifuser = $con->prepare('SELECT COUNT(*) FROM games WHERE id=:placeid');
$checkifuser = $con->prepare('SELECT COUNT(*) FROM games WHERE id=:placeid'); // check if the game even exists
$checkifuser->bindParam(':placeid', $placeid);
$checkifuser->execute();
$momentoftruth = $checkifuser->fetchColumn();
@ -49,18 +48,17 @@ if ($momentoftruth == 1) {
$fbi2->execute();
$china3 = $fbi2->fetch(PDO::FETCH_BOTH);
$token = $china3['token'];
die($token);
die($token); // DIE!
} elseif ($getintforchecktoken == '0') {
$token = generateRandomString(500);
$fbi = $con->prepare('INSERT INTO tokens (token, placeid, userid) VALUES (:token, :placeid, :userid)');
$fbi = $con->prepare('INSERT INTO tokens (token, placeid, userid) VALUES (:token, :placeid, :userid)'); // make the token valid
$fbi->bindParam(':token', $token);
$fbi->bindParam(':placeid', $placeid);
$fbi->bindParam(':userid', $id);
$fbi->execute();
die($token);
die($token); // HE FINALLY USED DIE
}
} else {
echo 'No placeId found';
exit;
die('No PlaceId found'); // reminder to use die
}
?>