made some token work

This commit is contained in:
neerholt
2021-03-09 13:54:20 +01:00
parent ac6b5a6bd9
commit ff749d80d4
2 changed files with 61 additions and 52 deletions
+12 -3
View File
@@ -1,6 +1,8 @@
<?php
require_once "../../../bootstrap.php";
use Backend\Models\GameData;
use function Backend\Controllers\groupViaToken;
use Backend\Models\Group;
$isImages = false;
@@ -8,7 +10,10 @@ session_start();
if(isset($_SESSION['token'])){
if(isset($_POST['submitUpload'])){
$group = groupViaToken($_SESSION['token']);
if(!isset($group->game_data_id)){
if(isset($_POST['submitUpload'])){
//Get the data from the user form
$gameFile = $_FILES['gameFile'];
$desc = $_POST['description'];
@@ -58,6 +63,10 @@ if(isset($_POST['submitUpload'])){
$gameData->is_web_Based = $isWebBased;
$gameData->save();
$group->gameData()->associate($gameData);
$group->save();
rename($gameFileTmp,"../../Games/".$gameFileNewName);
if($isImages){
rename($thumbnailFileTmp,"../../../Frontend/images/".$thumbnailFileNewName);
@@ -71,6 +80,6 @@ if(isset($_POST['submitUpload'])){
echo "Wrong file type";
}
}
}
}
}
+2 -2
View File
@@ -17,7 +17,7 @@ $gameJam = GameJam::firstOrCreate([
<title>HTML Tutorial</title>
<body>
<form action="Controllers/User/SigningUp.php" method="POST">
<form action="Controllers/Group/SigningUp.php" method="POST">
<input type="text" name="groupName" placeholder="Group name">
<input type="number" name="groupAmount" placeholder="Group Amount">
<input type="number" name="gameJamId" placeholder="Game Jam id">
@@ -26,7 +26,7 @@ $gameJam = GameJam::firstOrCreate([
</form>
<form action="Controllers/User/Login.php" method="POST">
<form action="Controllers/Group/Login.php" method="POST">
<input type="text" name="groupName" placeholder="Group name">
<input type="password" name="password" placeholder="password">
<input type="submit" name="login" value="login">