From 00c7c8787b308f4050226275a8d5bb288de569ca Mon Sep 17 00:00:00 2001 From: Last2014 Date: Fri, 5 Sep 2025 18:37:48 +0900 Subject: [PATCH] =?UTF-8?q?=E8=AA=A4=E3=81=A3=E3=81=9F=E3=83=AC=E3=82=B9?= =?UTF-8?q?=E3=83=9D=E3=83=B3=E3=82=B9=E3=82=B3=E3=83=BC=E3=83=89=E3=82=92?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3&=E8=BF=BD=E5=8A=A0=E3=83=BB=E3=82=B5?= =?UTF-8?q?=E3=83=BC=E3=83=90=E3=83=BC=E5=81=9C=E6=AD=A2=E6=99=82=E3=81=AB?= =?UTF-8?q?API=E3=81=A7=E3=81=AF=E5=B0=82=E7=94=A8=E3=81=AEJSON=E3=82=92?= =?UTF-8?q?=E8=BF=94=E7=AD=94=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .htaccess | 1 + api/me/index.php | 4 +++- api/token/get.php | 2 +- api/users/index.php | 4 +++- errorpage/serverstop.json | 4 ++++ settings_admin/maintenance_admin.php | 8 ++++++-- 6 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 errorpage/serverstop.json diff --git a/.htaccess b/.htaccess index 2604d7a..5c2cb49 100644 --- a/.htaccess +++ b/.htaccess @@ -26,6 +26,7 @@ ErrorDocument 403 /errorpage/httperror.php ErrorDocument 404 /errorpage/httperror.php ErrorDocument 413 /errorpage/httperror.php ErrorDocument 500 /errorpage/httperror.php +ErrorDocument 502 /errorpage/httperror.php ErrorDocument 503 /errorpage/httperror.php # --- セキュリティヘッダ --- diff --git a/api/me/index.php b/api/me/index.php index 33abb73..c6aad0a 100644 --- a/api/me/index.php +++ b/api/me/index.php @@ -58,7 +58,9 @@ if(isset($_GET['token']) || (!(empty($Get_Post_Json)))) { $response = array( 'error_code' => "critical_error_userdata_not_found", ); + http_response_code(500); }else{ + http_response_code(200); $roles = explode(',', $userdata["role"]); if(!(empty($roles))){ foreach ($roles as $roleId) { @@ -87,7 +89,7 @@ if(isset($_GET['token']) || (!(empty($Get_Post_Json)))) { $role[] = $roleinfo; } }else{ - $role[] = ""; + $role = []; } if(!(empty($userdata["sacinfo"]))){ diff --git a/api/token/get.php b/api/token/get.php index 007209a..c73d2e1 100644 --- a/api/token/get.php +++ b/api/token/get.php @@ -98,7 +98,7 @@ if(isset($_GET['session']) || (!(empty($Get_Post_Json)))) { 'error_code' => $err, 'success' => false ); - http_response_code(401); + http_response_code(400); echo json_encode($response, JSON_UNESCAPED_UNICODE); } ?> diff --git a/api/users/index.php b/api/users/index.php index 59bbba7..6f658d2 100644 --- a/api/users/index.php +++ b/api/users/index.php @@ -74,7 +74,9 @@ if(isset($_GET['token']) || (!(empty($Get_Post_Json)))) { $response = array( 'error_code' => "critical_error_userdata_not_found", ); + http_response_code(400); }else{ + http_response_code(200); $roles = explode(',', $userdata["role"]); if(!(empty($roles))){ foreach ($roles as $roleId) { @@ -103,7 +105,7 @@ if(isset($_GET['token']) || (!(empty($Get_Post_Json)))) { $role[] = $roleinfo; } }else{ - $role[] = ""; + $role = []; } if(!(empty($userdata["sacinfo"]))){ diff --git a/errorpage/serverstop.json b/errorpage/serverstop.json new file mode 100644 index 0000000..c6f15cf --- /dev/null +++ b/errorpage/serverstop.json @@ -0,0 +1,4 @@ +{ + "success": false, + "error_code": "server_down" +} diff --git a/settings_admin/maintenance_admin.php b/settings_admin/maintenance_admin.php index bda0a32..9901130 100644 --- a/settings_admin/maintenance_admin.php +++ b/settings_admin/maintenance_admin.php @@ -143,8 +143,12 @@ if( !empty($_POST['serverstop_btn_submit']) ) { // htaccess用意 $htaccess = " -ErrorDocument 403 /errorpage/serverstop.php RewriteEngine On + +RewriteCond %{REQUEST_URI} ^/api/.*$ +RewriteRule ^.*$ /errorpage/serverstop.json [R=500,L] + +ErrorDocument 403 /errorpage/serverstop.php RewriteCond %{REQUEST_URI} !=/function/function.php RewriteCond %{REQUEST_URI} !=/errorpage/serverstop.php RewriteCond %{REQUEST_URI} !=/css/home.css @@ -244,4 +248,4 @@ require('../logout/logout.php'); } }); }); - \ No newline at end of file +