bedder feedback on http response
This commit is contained in:
@@ -15,14 +15,14 @@ function ZipFileHandler(string $gameFileName, string $gameFileTmp){
|
||||
if(in_array($headerType,$headerTypeMatch)){
|
||||
$gameFileNewName = uniqid("", true). "." . $fileActualExtGame;
|
||||
if(empty($gameFileName)){
|
||||
echo http_response_code(400);
|
||||
http_response_code(400);
|
||||
exit();
|
||||
}
|
||||
rename($gameFileTmp,"../../Games/".$gameFileNewName);
|
||||
return $gameFileNewName;
|
||||
}else{
|
||||
echo "Wrong file type";
|
||||
echo http_response_code(400);
|
||||
http_response_code(400);
|
||||
echo json_encode(["message" => "Wrong file type gameFile"]);
|
||||
exit();
|
||||
}
|
||||
return NULL;
|
||||
@@ -43,14 +43,14 @@ function imagesFileHandler(string $thumbnailFileName, string $thumbnailFileTmp){
|
||||
if(in_array($headerType,$headerTypeMatch)){
|
||||
$thumbnailFileNewName = uniqid("", true). "." . $fileActualExtThumb;
|
||||
if(empty($thumbnailFileName)){
|
||||
echo http_response_code(400);
|
||||
http_response_code(400);
|
||||
exit();
|
||||
}
|
||||
rename($thumbnailFileTmp,"../../../Frontend/images/".$thumbnailFileNewName);
|
||||
return $thumbnailFileNewName;
|
||||
}else{
|
||||
echo "Wrong file type";
|
||||
echo http_response_code(400);
|
||||
http_response_code(400);
|
||||
echo json_encode(["message" => "Wrong file type thumbnailFile"]);
|
||||
exit();
|
||||
}
|
||||
return NULL;
|
||||
|
||||
@@ -37,14 +37,15 @@ if(isLogin()){
|
||||
}
|
||||
$gameData->is_web_Based = $isWebBased;
|
||||
if(!$gameData->save()){
|
||||
echo http_response_code(500);
|
||||
http_response_code(500);
|
||||
}else{
|
||||
echo http_response_code(201);
|
||||
http_response_code(201);
|
||||
}
|
||||
|
||||
}else{
|
||||
echo http_response_code(400);
|
||||
http_response_code(400);
|
||||
}
|
||||
}else{
|
||||
echo http_response_code(401);
|
||||
http_response_code(401);
|
||||
echo json_encode(["message" => "is not login"]);
|
||||
}
|
||||
@@ -53,23 +53,26 @@ if(isLogin()){
|
||||
$gameData->save();
|
||||
$group->gameData()->associate($gameData);
|
||||
if(! $group->save()){
|
||||
echo http_response_code(500);
|
||||
http_response_code(500);
|
||||
}else{
|
||||
echo http_response_code(201);
|
||||
http_response_code(201);
|
||||
}
|
||||
|
||||
}else{
|
||||
http_response_code(500);
|
||||
}
|
||||
}else{
|
||||
echo http_response_code(400);
|
||||
http_response_code(400);
|
||||
}
|
||||
}else{
|
||||
echo "Can only upload one file";
|
||||
echo http_response_code(400);
|
||||
http_response_code(400);
|
||||
echo json_encode(["message" => "Can only upload one file"]);
|
||||
}
|
||||
}else{
|
||||
echo "Can only upload when the game jam has started";
|
||||
echo http_response_code(400);
|
||||
http_response_code(400);
|
||||
echo json_encode(["message" => "Can only upload when the game jam has started"]);
|
||||
}
|
||||
}else{
|
||||
echo http_response_code(401);
|
||||
http_response_code(401);
|
||||
echo json_encode(["message" => "is not login"]);
|
||||
}
|
||||
Reference in New Issue
Block a user