Added http response code

This commit is contained in:
neerholt
2021-03-19 13:25:27 +01:00
parent 409556ca2e
commit 171e0a3765
18 changed files with 103 additions and 112 deletions
@@ -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;