diff --git a/game/Join.php b/game/Join.php index f8325cb..dd965b0 100644 --- a/game/Join.php +++ b/game/Join.php @@ -23,17 +23,35 @@ $checkjob = $con->prepare('SELECT COUNT(*) FROM jobs WHERE jobid=:jobid'); // br $checkjob->bindParam(':jobid', $jobid); $checkjob->execute(); $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 = $con->prepare('SELECT COUNT(*) FROM tokens WHERE token=:token'); // another temp workaround im gonna do token system and stuff whenever i feel like it $checkuser->bindParam(':token', $token); $checkuser->execute(); $anotheranothermomentoftruth = $checkuser->fetchColumn(); if ($anothermomentoftruth == 1 && $anotheranothermomentoftruth == 1) { - $getstuff = $con->prepare('SELECT id,username FROM users WHERE token=:token'); + $okbruh = "1"; + $haha = $con->prepare('SELECT COUNT(*) FROM tokens WHERE token=:token AND passedjoinscript=:passed'); + $haha->bindParam(':token', $token); + $haha->bindParam(':passed', $okbruh); + $haha->execute(); + $moretrolling = $haha->fetchColumn(); + if ($moretrolling == 1) { + header("Location: /"); + } else if ($moretrolling == 0) { + $hahatroll = $con->prepare('UPDATE tokens SET passedjoinscript = 1 WHERE token=:token'); + $hahatroll->bindParam(':token', $token); + $hahatroll->execute(); + $getstuff = $con->prepare('SELECT placeid,userid FROM tokens WHERE token=:token'); $getstuff->bindParam(':token', $token); $getstuff->execute(); $china = $getstuff->fetch(PDO::FETCH_BOTH); - $id = $china['id']; - $username = $china['username']; + $placeid = $china['placeid']; + $id = $china['userid']; + $getusername = $con->prepare('SELECT username FROM users WHERE id=:id'); + $getusername->bindParam(':id', $id); + $getusername->execute(); + $ok = $getusername->fetch(PDO::FETCH_BOTH); + $username = $ok['username']; + $china = $getstuff->fetch(PDO::FETCH_BOTH); $jobstuff = $con->prepare('SELECT jobid,placeid,port FROM jobs WHERE jobid=:jobid'); $jobstuff->bindParam(':jobid', $jobid); $jobstuff->execute(); @@ -82,6 +100,9 @@ if ($anothermomentoftruth == 1 && $anotheranothermomentoftruth == 1) { "FollowUserId" => 0, "characterAppearanceId" => $id ]; + } else { + header("Location: /"); + } } else { header("Location: /"); }