Fixed som stuff

This commit is contained in:
neerholt
2021-03-08 14:52:34 +01:00
parent b242918038
commit ea3bc7d104
4 changed files with 10 additions and 7 deletions
@@ -0,0 +1 @@
<?php
@@ -1,5 +1,5 @@
<?php
require_once "../../bootstrap.php";
require_once "../../../bootstrap.php";
use Backend\Models\GameData;
@@ -8,7 +8,7 @@ if(isset($_POST['submitUpload'])){
$gameFile = $_FILES['gameFile'];
$desc = $_POST['description'];
$title = $_POST['gameTitle'];
$isWebBased = $_POST['isWebBased'];
$isWebBased = isset( $_POST['isWebBased']);
//Handle data for game files
@@ -28,16 +28,18 @@ if(isset($_POST['submitUpload'])){
if($gameFileError === 0){
$gameFileNewName = uniqid("", true). "." . $fileActualExt;
if(empty($gameFileName)){
header("location: ./index.php?error=emptyFile");
header("location: ../../../Frontend/index.php?error=emptyFile");
exit();
}else{
$gameData = new GameData();
$gameData->game_name = $title;
$gameData->game_link = $gameFileNewName;
$gameData->description = $desc;
$gameData->is_web_Based = $isWebBased;
$gameData->save();
rename($gameFileTmp,"../Games/".$gameFileNewName);
rename($gameFileTmp,"../../Games/".$gameFileNewName);
}
}else{
echo "Der var en fejl med at uploade din file";