{"id":2339,"date":"2023-12-24T12:36:31","date_gmt":"2023-12-24T03:36:31","guid":{"rendered":"https:\/\/www.dogrow.net\/hp\/?p=2339"},"modified":"2024-01-07T08:24:07","modified_gmt":"2024-01-06T23:24:07","slug":"blog148","status":"publish","type":"post","link":"https:\/\/www.dogrow.net\/hp\/blog148\/","title":{"rendered":"(148) \u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u306e\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u51e6\u7406\u306e\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u5bfe\u7b56"},"content":{"rendered":"<h1 class=\"my_h\">1. \u3084\u308a\u305f\u3044\u3053\u3068<\/h1>\n<p>\u5171\u7528\u30ec\u30f3\u30bf\u30eb\u30b5\u30fc\u30d0\u30fc\u3067\u904b\u7528\u4e2d\u306e\u81ea\u4f5c\u30db\u30fc\u30e0\u30da\u30fc\u30b8\u304c\u3042\u308b\u3002<br \/>\n\u3053\u3053\u306b\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u306e\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u6a5f\u80fd\u3092\u5b9f\u88c5\u3057\u305f\u3044\u3002<\/p>\n<p>\u3053\u306e\u6642\u3001\u4ee5\u4e0b\u306e\u61f8\u5ff5\u70b9\u304c\u3042\u308b\u3002<\/p>\n<p>\u61f8\u5ff5\u70b91\uff1a \u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u4ee5\u5916\u306e\u30d5\u30a1\u30a4\u30eb\u304c\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3055\u308c\u3066\u3057\u307e\u308f\u306a\u3044\u304b\uff1f<br \/>\n\u3000\u3000<span class=\"my_fc_redB\">\u2192 CGI\u30b9\u30af\u30ea\u30d7\u30c8\u30d5\u30a1\u30a4\u30eb\u306a\u3069\u304c\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3055\u308c\u308c\u3070\u3001\u597d\u304d\u653e\u984c\u306b\u8352\u3089\u3055\u308c\u3066\u3057\u307e\u3046&#8230;<\/span><\/p>\n<p>\u61f8\u5ff5\u70b92\uff1a \u8d85\u5de8\u5927\u306a\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u304c\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3055\u308c\u306a\u3044\u304b\uff1f<br \/>\n\u3000\u3000<span class=\"my_fc_redB\">\u2192 \u30b5\u30fc\u30d0\u30fc\u8ca0\u8377\u5897\u5927\u3067\u30a2\u30ab\u30a6\u30f3\u30c8\u3092 BAN\u3055\u308c\u3066\u3057\u307e\u3046\u304b\u3082&#8230;<\/span><\/p>\n<p><span class=\"my_fc_blueBBig\">\u3053\u308c\u3089\u306e\u61f8\u5ff5\u70b9\u3092\u6255\u3057\u3087\u304f\u3059\u308b\u305f\u3081\u306e\u5b9f\u88c5\u53ca\u3073\u74b0\u5883\u8a2d\u5b9a\u3092\u3057\u3066\u304a\u304d\u305f\u3044\u3002<\/span><\/p>\n<h1 class=\"my_h\">2. \u3084\u3063\u3066\u307f\u308b<\/h1>\n<h2 class=\"my_h\">\u61f8\u5ff5\u70b91\uff1a\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u4ee5\u5916\u306e\u30d5\u30a1\u30a4\u30eb\u304c\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3055\u308c\u3066\u3057\u307e\u308f\u306a\u3044\u304b\uff1f<\/h2>\n<h3 class=\"my_h\">\u5bfe\u7b561\uff1a\u753b\u50cf\u53d7\u4fe1\u30d7\u30ed\u30b0\u30e9\u30e0\u5074\u3067\u3001\u62e1\u5f35\u5b50\u3001MIME\u30bf\u30a4\u30d7\u3001\u753b\u50cf\u60c5\u5831\u3092\u691c\u67fb\u3059\u308b\u3002<\/h3>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n\/\/ \u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u304c\u3001\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u3067\u3042\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3059\u308b\u3002\r\n\/\/ $sgv_file : $_FILES{'xxxxx'] \u3092\u5165\u529b\u3059\u308b\u3002\r\nfunction isValidImageFile( $sgv_file ){\r\n  $ret = false;\r\n  $allowedExts = &#x5B;'jpg', 'jpeg', 'png', 'gif', 'tiff', 'tif'];\r\n  $allowedMimeTypes = &#x5B;'image\/jpeg', 'image\/png', 'image\/gif', 'image\/tiff'];\r\n\r\n  \/\/ check 1 : \u62e1\u5f35\u5b50\u3092\u691c\u67fb\r\n  $ext = pathinfo($sgv_file&#x5B;'name'], PATHINFO_EXTENSION);   \/\/ \u30d5\u30a1\u30a4\u30eb\u540d\u6587\u5b57\u5217\u304b\u3089\u62e1\u5f35\u5b50\u3092\u53d6\u5f97\r\n  if(false === in_array(strtolower($ext), $allowedExts)){   \/\/ \u53d7\u3051\u5165\u308c\u53ef\u80fd\u306a\u62e1\u5f35\u5b50\uff1f\r\n    goto tagEND;\r\n  }\r\n\r\n  \/\/ check 2 : MIME\u30bf\u30a4\u30d7\u3092\u691c\u67fb\r\n  $fileMimeType = mime_content_type($sgv_file&#x5B;'tmp_name']); \/\/ Upload\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u306eMIME\u30bf\u30a4\u30d7\u3092\u53d6\u5f97\r\n  if(false === in_array($fileMimeType, $allowedMimeTypes)){ \/\/ \u53d7\u3051\u5165\u308c\u53ef\u80fd\u306aMIME\u30bf\u30a4\u30d7\uff1f\r\n    goto tagEND;\r\n  }\r\n\r\n  \/\/ check 3 : \u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u30d8\u30c3\u30c0\u3092\u691c\u67fb\r\n  if (false === getimagesize($sgv_file&#x5B;'tmp_name'])) {\r\n    goto tagEND;\r\n  }\r\n\r\n  \/\/ \u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u3067\u3042\u308b\u3068\u78ba\u8a8d\u3057\u305f\u3002\r\n  $ret = true;\r\n\r\ntagEND:\r\n  return $ret;\r\n}\r\n<\/pre>\n<h3 class=\"my_h\">\u5bfe\u7b562\uff1a\u753b\u50cf\u4fdd\u5b58\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3067\u306fCGI\u5b9f\u884c\u3092\u7981\u6b62\u3059\u308b\u3002<\/h3>\n<p>Web\u30b5\u30fc\u30d0\uff08\u3053\u3053\u3067\u306f <span class=\"my_fc_deeppinkB\">Apache2.4<\/span>\uff09\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u306b\u3001CGI\u30d5\u30a1\u30a4\u30eb\u3078\u30a2\u30af\u30bb\u30b9\u7981\u6b62\u3092\u8a2d\u5b9a\u3057\u3066\u304a\u304f\u3002<br \/>\n\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u753b\u50cf\u4fdd\u5b58\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u8a2d\u7f6e\u3059\u308b\u3002<\/p>\n<p><span class=\"my_fc_blueBBig\">.htaccess<\/span><\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n&lt;FilesMatch &quot;\\.(php|cgi|py|pl)$&quot;&gt;\r\n    Require all denied\r\n&lt;\/FilesMatch&gt;\r\n<\/pre>\n<p>Apache\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u77e5\u308a\u305f\u3051\u308c\u3070\u3001\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067\u78ba\u8a8d\u3067\u304d\u308b\u3002<\/p>\n<pre class=\"my_pre_bgBlack\">\r\n$ apache2 -v\r\n<\/pre>\n<pre class=\"my_pre_bgBlack\">\r\n$ httpd -v\r\n<\/pre>\n<h2 class=\"my_h\">\u61f8\u5ff5\u70b92\uff1a\u8d85\u5de8\u5927\u306a\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u304c\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3055\u308c\u306a\u3044\u304b\uff1f<\/h2>\n<p>PHP\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u306b\u4ee5\u4e0b\u3092\u8a2d\u5b9a\u3057\u3066\u304a\u304f\u3002<br \/>\n<span class=\"my_fc_deeppinkB\">upload_max_filesize<\/span> : \u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u53ef\u80fd\u306a\u30d5\u30a1\u30a4\u30eb\u30b5\u30a4\u30ba\u306e\u4e0a\u9650<br \/>\n<span class=\"my_fc_deeppinkB\">post_max_size<\/span> : POST\u30e1\u30c3\u30bb\u30fc\u30b8\u3067\u9001\u4fe1\u53ef\u80fd\u306a\u30c7\u30fc\u30bf\u30b5\u30a4\u30ba\u306e\u4e0a\u9650<\/p>\n<p>\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u81ea\u4f5c\u30db\u30fc\u30e0\u30da\u30fc\u30b8\u306eTop\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u8a2d\u7f6e\u3059\u308b\u3002<\/p>\n<p><span class=\"my_fc_blueBBig\">.user.ini<\/span><\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nupload_max_filesize = 2M\r\npost_max_size = 8M\r\n<\/pre>\n<hr class=\"my_hr_bottom\">\n","protected":false},"excerpt":{"rendered":"<p>1. \u3084\u308a\u305f\u3044\u3053\u3068 \u5171\u7528\u30ec\u30f3\u30bf\u30eb\u30b5\u30fc\u30d0\u30fc\u3067\u904b\u7528\u4e2d\u306e\u81ea\u4f5c\u30db\u30fc\u30e0\u30da\u30fc\u30b8\u304c\u3042\u308b\u3002 \u3053\u3053\u306b\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u306e\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u6a5f\u80fd\u3092\u5b9f\u88c5\u3057\u305f\u3044\u3002 \u3053\u306e\u6642\u3001\u4ee5\u4e0b\u306e\u61f8\u5ff5\u70b9\u304c\u3042\u308b\u3002 \u61f8\u5ff5\u70b91\uff1a \u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u4ee5\u5916\u306e\u30d5\u30a1\u30a4\u30eb\u304c\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3055\u308c\u3066\u3057\u307e\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.dogrow.net\/hp\/blog148\/\">\u7d9a\u304d\u3092\u8aad\u3080 &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13,45,2],"tags":[],"class_list":["post-2339","post","type-post","status-publish","format-standard","hentry","category-apache","category-cgi","category-2"],"views":724,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.dogrow.net\/hp\/wp-json\/wp\/v2\/posts\/2339","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dogrow.net\/hp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dogrow.net\/hp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dogrow.net\/hp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dogrow.net\/hp\/wp-json\/wp\/v2\/comments?post=2339"}],"version-history":[{"count":9,"href":"https:\/\/www.dogrow.net\/hp\/wp-json\/wp\/v2\/posts\/2339\/revisions"}],"predecessor-version":[{"id":2365,"href":"https:\/\/www.dogrow.net\/hp\/wp-json\/wp\/v2\/posts\/2339\/revisions\/2365"}],"wp:attachment":[{"href":"https:\/\/www.dogrow.net\/hp\/wp-json\/wp\/v2\/media?parent=2339"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dogrow.net\/hp\/wp-json\/wp\/v2\/categories?post=2339"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dogrow.net\/hp\/wp-json\/wp\/v2\/tags?post=2339"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}