Added http response code
This commit is contained in:
@@ -15,13 +15,14 @@ function ZipFileHandler(string $gameFileName, string $gameFileTmp){
|
||||
if(in_array($headerType,$headerTypeMatch)){
|
||||
$gameFileNewName = uniqid("", true). "." . $fileActualExtGame;
|
||||
if(empty($gameFileName)){
|
||||
header("location: ../../../Frontend/index.html?error=emptyFile");
|
||||
http_response_code(400);
|
||||
exit();
|
||||
}
|
||||
rename($gameFileTmp,"../../Games/".$gameFileNewName);
|
||||
return $gameFileNewName;
|
||||
}else{
|
||||
header("location: location: ../../../Frontend/index.html?error=Wrong%20File%20Type");
|
||||
echo "Wrong file type";
|
||||
http_response_code(400);
|
||||
exit();
|
||||
}
|
||||
return NULL;
|
||||
@@ -42,13 +43,14 @@ function imagesFileHandler(string $thumbnailFileName, string $thumbnailFileTmp){
|
||||
if(in_array($headerType,$headerTypeMatch)){
|
||||
$thumbnailFileNewName = uniqid("", true). "." . $fileActualExtThumb;
|
||||
if(empty($thumbnailFileName)){
|
||||
header("location: ../../../Frontend/index.html?error=emptyFile");
|
||||
http_response_code(400);
|
||||
exit();
|
||||
}
|
||||
rename($thumbnailFileTmp,"../../../Frontend/images/".$thumbnailFileNewName);
|
||||
return $thumbnailFileNewName;
|
||||
}else{
|
||||
header("location: location: ../../../Frontend/index.html?error=Wrong%20File%20Type");
|
||||
echo "Wrong file type";
|
||||
http_response_code(400);
|
||||
exit();
|
||||
}
|
||||
return NULL;
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
<?php
|
||||
@@ -36,14 +36,15 @@ if(isLogin()){
|
||||
$gameData->img = imagesFileHandler($thumbnailFileName,$thumbnailFileTmp);
|
||||
}
|
||||
$gameData->is_web_Based = $isWebBased;
|
||||
$gameData->save();
|
||||
header("location: ../../../Frontend/index.html?success=UpdatedFiles");
|
||||
exit();
|
||||
if(!$gameData->save()){
|
||||
http_response_code(500);
|
||||
}else{
|
||||
http_response_code(201);
|
||||
}
|
||||
|
||||
}else{
|
||||
header("location: ../../../Frontend/index.html?error=FailedUpload");
|
||||
exit();
|
||||
http_response_code(400);
|
||||
}
|
||||
}else{
|
||||
header("location: ../../../Frontend/index.html?error=NoLogin");
|
||||
exit();
|
||||
http_response_code(401);
|
||||
}
|
||||
@@ -52,23 +52,24 @@ if(isLogin()){
|
||||
$gameData->is_web_Based = $isWebBased;
|
||||
$gameData->save();
|
||||
$group->gameData()->associate($gameData);
|
||||
$group->save();
|
||||
header("location: ../../../Frontend/index.html?success=UploadedFile");
|
||||
exit();
|
||||
if(! $group->save()){
|
||||
http_response_code(500);
|
||||
}else{
|
||||
http_response_code(201);
|
||||
}
|
||||
|
||||
}
|
||||
}else{
|
||||
header("location: ../../../Frontend/group.php?error=UploadFail");
|
||||
exit();
|
||||
http_response_code(400);
|
||||
}
|
||||
}else{
|
||||
header("location: ../../../Frontend/group.php?error=TooManyUploads");
|
||||
exit();
|
||||
echo "Can only upload one file";
|
||||
http_response_code(400);
|
||||
}
|
||||
}else{
|
||||
header("location: ../../../Frontend/group.php?error=GameJamHasNotBegun");
|
||||
exit();
|
||||
echo "Can only upload when the game jam has started";
|
||||
http_response_code(400);
|
||||
}
|
||||
}else{
|
||||
header("location: ../../../Main.php?error=NoLogin");
|
||||
exit();
|
||||
http_response_code(401);
|
||||
}
|
||||
Reference in New Issue
Block a user