{"id":7951,"date":"2019-09-13T19:47:58","date_gmt":"2019-09-13T10:47:58","guid":{"rendered":"https:\/\/itport.cloud\/?p=7951"},"modified":"2019-09-13T19:47:59","modified_gmt":"2019-09-13T10:47:59","slug":"post-7951","status":"publish","type":"post","link":"https:\/\/itport.cloud\/?p=7951","title":{"rendered":"(\u7b2c2\u56de)PHP\u3067SNS\u3092\u4f5c\u6210\u3057\u3066\u307f\u308b"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" id=\"e79baee6aca1-1\">\u76ee\u6b21<\/h2>\n\n\n\n<p><a href=\"#php2-1\">\u306f\u3058\u3081\u306b<\/a><br><a href=\"#php2-2\">\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u63a5\u7d9a<\/a><br><a href=\"#php2-3\">\u540d\u524d\u306e\u30c1\u30a7\u30c3\u30af<\/a><br><a href=\"#php2-4\">\u6295\u7a3f\u5185\u5bb9\u306e\u30c1\u30a7\u30c3\u30af<\/a><br><a href=\"#php2-5\">\u4fdd\u5b58\u51e6\u7406<\/a><br><a href=\"#php2-6\">\u4eca\u56de\u3064\u307e\u3065\u3044\u305f\u3068\u3053\u308d<\/a><br><a href=\"#php2-7\">\u6b21\u56de\u4e88\u544a<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"php2-1\">\u306f\u3058\u3081\u306b<\/h2>\n\n\n\n<p>\u524d\u56de\u306e\u8a18\u4e8b\u3067\u306f\u3001\u74b0\u5883\u306e\u8a2d\u5b9a\u304b\u3089\u753b\u9762\u30a4\u30e1\u30fc\u30b8\u306e\u4f5c\u6210\u307e\u3067\u884c\u3044\u307e\u3057\u305f\u3002<br>\u4eca\u56de\u306f\u3001\u5b9f\u969b\u306b\u5165\u529b\u3057\u305f\u5185\u5bb9\u304cDB\u306b\u4fdd\u5b58\u3055\u308c\u308b\u51e6\u7406\u3092\u7d39\u4ecb\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"php2-2\">\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u63a5\u7d9a<\/h2>\n\n\n\n<p>\u307e\u305a\u306f\u30c7\u30fc\u30bf\u9001\u4fe1\u306e\u53d7\u3051\u76bf\u3068\u306a\u308bDB\u3068\u306e\u63a5\u7d9a\u51e6\u7406\u3092\u66f8\u3044\u3066\u3044\u304d\u307e\u3059\u3002<br><\/p>\n\n\n\n<p>\u524d\u56de\u4f5c\u6210\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u306f\u30d5\u30a1\u30a4\u30eb\u5f62\u5f0f\u304chtml\u306b\u306a\u3063\u3066\u304a\u308a\u3001<br>\u3053\u306e\u307e\u307e\u3067\u306f\u9759\u7684\u30b5\u30a4\u30c8\uff08\u5e38\u306b\u540c\u3058\u5185\u5bb9\u304c\u8868\u793a\u3055\u308c\u308b\u30b5\u30a4\u30c8\uff09\u306b\u306a\u3063\u3066\u3057\u307e\u3046\u306e\u3067\u3001<br>\u52d5\u7684\u30b5\u30a4\u30c8\uff08\u30a2\u30af\u30bb\u30b9\u3084\u5165\u529b\u3057\u305f\u5185\u5bb9\u7b49\u306b\u3088\u3063\u3066\u7570\u306a\u308b\u8868\u793a\u304c\u3055\u308c\u308b\u30b5\u30a4\u30c8\uff09\u306b\u3059\u308b\u305f\u3081\u306bphp\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<br><br>\u203b\u52d5\u7684\u30b5\u30a4\u30c8\u3092\u4f5c\u308b\u306b\u306f\u3001php\u4ee5\u5916\u306b\u3082Ruby\u3084JavaScript\u306a\u3069\u3082\u8a00\u8a9e\u3068\u3057\u3066\u6d3b\u7528\u3055\u308c\u308b\u3053\u3068\u304c\u591a\u3044\u3067\u3059\u3002<br><br>\u524d\u56de\u306ehtml\u30d5\u30a1\u30a4\u30eb\u306e\u62e1\u5f35\u5b50\u3092.html\u304b\u3089.php\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/htdocs-2019_09_05-20_09_53-1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"555\" src=\"https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/htdocs-2019_09_05-20_09_53-1-1024x555.png\" alt=\"\" class=\"wp-image-7985\" srcset=\"https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/htdocs-2019_09_05-20_09_53-1-1024x555.png 1024w, https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/htdocs-2019_09_05-20_09_53-1-300x163.png 300w, https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/htdocs-2019_09_05-20_09_53-1-768x416.png 768w, https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/htdocs-2019_09_05-20_09_53-1-450x244.png 450w, https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/htdocs-2019_09_05-20_09_53-1-900x488.png 900w, https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/htdocs-2019_09_05-20_09_53-1.png 1920w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>php\u306e\u66f8\u304d\u65b9\u306b\u5165\u308b\u524d\u306b\u3001Apache\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u30eb\u30fc\u30c8\u306e\u8aac\u660e\u3092\u3057\u3066\u304a\u304d\u307e\u3059\u3002<br>\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u30eb\u30fc\u30c8\u3068\u306f\u3001Web\u30b5\u30fc\u30d0\u7b49\u304c\u5916\u90e8\u516c\u958b\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u304c\u7f6e\u304b\u308c\u305f\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3084\u30d5\u30a9\u30eb\u30c0\u3067\u3059\u3002<br>\u3053\u3061\u3089\u306e\u8a2d\u5b9a\u306f\u3001Apache24\u2192conf\u2192httpd.conf\u3067\u8a2d\u5b9a\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/conf-2019_09_13-17_24_13.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"555\" src=\"https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/conf-2019_09_13-17_24_13-1024x555.png\" alt=\"\" class=\"wp-image-8099\" srcset=\"https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/conf-2019_09_13-17_24_13-1024x555.png 1024w, https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/conf-2019_09_13-17_24_13-300x163.png 300w, https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/conf-2019_09_13-17_24_13-768x416.png 768w, https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/conf-2019_09_13-17_24_13-450x244.png 450w, https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/conf-2019_09_13-17_24_13-900x488.png 900w, https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/conf-2019_09_13-17_24_13.png 1920w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>httpd.conf\u3092\u958b\u3044\u3066\u3001\u307e\u305a\u8a2d\u5b9a\u3059\u308b\u306e\u304cSRVROOT\u3067\u3059\u3002<br>\u3053\u3061\u3089\u306e\u5024\u3092\u57fa\u306b\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u30eb\u30fc\u30c8\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u3001Apache\u30d5\u30a9\u30eb\u30c0\u306e\u914d\u7f6e\u5834\u6240\u3068\u7167\u3089\u3057\u5408\u308f\u305b\u306a\u304c\u3089<br>\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nDefine SRVROOT \"c:\/Apache24\"\n\nServerRoot \"${SRVROOT}\"\n<\/pre><\/div>\n\n\n<p>\u79c1\u306fC\u30c9\u30e9\u30a4\u30d6\u76f4\u4e0b\u306bApache\u306e\u30d5\u30a9\u30eb\u30c0\u3092\u7f6e\u3044\u3066\u3044\u308b\u305f\u3081\u3001\u4e0a\u8a18\u306e\u3088\u3046\u306b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u6b21\u306b\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u30eb\u30fc\u30c8\u3067\u3059\u304c\u3001\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u4e0a\u3067\u306f\u4e0b\u8a18\u306e\u3088\u3046\u306b\u8a18\u8f09\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nDocumentRoot \"${SRVROOT}\/htdocs\"\n<\/pre><\/div>\n\n\n<p>\u5148\u307b\u3069\u8a2d\u5b9a\u3057\u305f SRVROOT\u914d\u4e0b\u306ehtdocs\u3068\u3044\u3046\u30d5\u30a9\u30eb\u30c0\u306b\u5165\u3063\u3066\u3044\u308b\u30d5\u30a1\u30a4\u30eb\u304c\u5916\u90e8\u516c\u958b\u30d5\u30a1\u30a4\u30eb\u3068\u306a\u308a\u307e\u3059\u3002<br>\u3053\u308c\u3067\u8a2d\u5b9a\u306f\u5b8c\u4e86\u3068\u306a\u308a\u307e\u3059\u3002<br><br>\u30d6\u30e9\u30a6\u30b6\u4e0a\u3067\u8868\u793a\u3055\u308c\u308b\u304b\u306e\u78ba\u8a8d\u306f\u3001&#8221;localhost\/\u30d5\u30a1\u30a4\u30eb\u540d&#8221;\u3092\u30d6\u30e9\u30a6\u30b6\u306eURL\u306b\u5165\u308c\u308b\u3068\u8868\u793a\u3055\u308c\u307e\u3059\u3002<br>\u3053\u3053\u3067\u8868\u793a\u3055\u308c\u306a\u3044\u5834\u5408\u306b\u8003\u3048\u3089\u308c\u308b\u306e\u306f\u3001<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Apache \uff08\u3082\u3057\u304f\u306f\u4f7f\u7528\u3057\u3066\u3044\u308bWeb\u30b5\u30fc\u30d0\u30fc\uff09 \u304c\u8d77\u52d5\u3057\u3066\u3044\u306a\u3044<\/li><li>\u4ed6\u306b\u4f7f\u7528\u3057\u3066\u3044\u308bweb\u30b5\u30fc\u30d0\u30fc\u304clocalhost\u3067\u51fa\u3066\u304f\u308b<\/li><\/ul>\n\n\n\n<p>Apache\u306e\u8d77\u52d5\u306e\u78ba\u8a8d\u3092\u3059\u308b\u306e\u3068\u3001\u4ed6\u306eWeb\u30b5\u30fc\u30d0\u30fc\u304c\u512a\u5148\u3057\u3066\u3001localhost\u3067\u8868\u793a\u3055\u308c\u308b\u5834\u5408\u306f\u3001<br>&#8220;localhost:\u30dd\u30fc\u30c8\u756a\u53f7&#8221;\u3067\u660e\u793a\u3059\u308b\u3068\u3001\u6307\u5b9a\u3057\u305fWeb\u30b5\u30fc\u30d0\u306e\u30d5\u30a1\u30a4\u30eb\u304c\u30d6\u30e9\u30a6\u30b6\u306b\u8868\u793a\u3055\u308c\u307e\u3059\u3002<br><\/p>\n\n\n\n<p>\u8a2d\u5b9a\u78ba\u8a8d\u306f\u4ee5\u4e0a\u306b\u306a\u308a\u3001\u3044\u3088\u3044\u3088\u30b3\u30fc\u30c9\u3092\u66f8\u3044\u3066\u3044\u304d\u307e\u3059\u3002<br><br><\/p>\n\n\n\n<p>php\u306e\u66f8\u304d\u65b9\u3067\u3059\u304c\u3001php\u30b3\u30fc\u30c9\u306e\u5148\u982d\u306b&lt;?php \u3092\u66f8\u304d\u307e\u3059\u3002<br><br>\u66f8\u304d\u7d42\u308f\u308a\u306f?&gt;\u3067\u9589\u3058\u307e\u3059\u3002 <br><br>\u307e\u305a\u306f\u30b5\u30f3\u30d7\u30eb\u30d5\u30a1\u30a4\u30eb\u3067php\u304c\u52d5\u4f5c\u3059\u308b\u306e\u304b\u78ba\u8a8d\u3057\u3066\u307f\u307e\u3059\u3002<br><br>phpinfo.php\u3068\u3044\u3046\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3001\u4e0b\u8a18\u306e\u30b3\u30fc\u30c9\u3092\u66f8\u304d\u307e\u3059\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n<?php phpinfo(); ?>\n<\/pre><\/div>\n\n\n<p>\u3053\u306e\u30b3\u30fc\u30c9\u3067\u81ea\u5206\u306ePC\u306b\u5165\u3063\u3066\u3044\u308bphp\u306e\u60c5\u5831\u3092\u898b\u308b\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/phpinfo-Google-Chrome-2019_09_13-17_09_49.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"526\" src=\"https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/phpinfo-Google-Chrome-2019_09_13-17_09_49-1024x526.png\" alt=\"\" class=\"wp-image-8097\" srcset=\"https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/phpinfo-Google-Chrome-2019_09_13-17_09_49-1024x526.png 1024w, https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/phpinfo-Google-Chrome-2019_09_13-17_09_49-300x154.png 300w, https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/phpinfo-Google-Chrome-2019_09_13-17_09_49-768x395.png 768w, https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/phpinfo-Google-Chrome-2019_09_13-17_09_49-450x231.png 450w, https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/phpinfo-Google-Chrome-2019_09_13-17_09_49-900x463.png 900w, https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/phpinfo-Google-Chrome-2019_09_13-17_09_49.png 1916w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>\u4e0a\u8a18\u753b\u50cf\u306e\u3088\u3046\u306b\u3001php\u306e\u5404\u7a2e\u8a2d\u5b9a\u3084\u30d0\u30fc\u30b8\u30e7\u30f3\u7b49\u78ba\u8a8d\u3059\u308b\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3053\u306e\u3068\u304d\u753b\u50cf\u306e\u3088\u3046\u306a\u8868\u793a\u304c\u3055\u308c\u305a\u3001php\u306e\u30bd\u30fc\u30b9\u304c\u753b\u9762\u4e0a\u306b\u8868\u793a\u3055\u308c\u305f\u5834\u5408\u306f\u3001Apache\u306ehttpd.conf\u306bphp\u306e\u8a2d\u5b9a\u3092\u7d44\u307f\u8fbc\u3081\u3066\u3044\u306a\u3044\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002<br>\u4e0b\u8a18\u306e\u30b3\u30fc\u30c9\u3092\u3001httpd.conf\u306e\u4e00\u756a\u4e0b\u306b\u8a18\u8f09\u3057\u307e\u3059\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nLoadModule php7_module \"C:\/php\/php7apache2_4.dll\"\nAddHandler application\/x-httpd-php .php\n\n# configure the path to php.ini\nPHPIniDir \"C:\/php\"\n<\/pre><\/div>\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/phpinfo-Google-Chrome-2019_09_13-17_10_32.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"536\" src=\"https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/phpinfo-Google-Chrome-2019_09_13-17_10_32-1024x536.png\" alt=\"\" class=\"wp-image-8098\" srcset=\"https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/phpinfo-Google-Chrome-2019_09_13-17_10_32-1024x536.png 1024w, https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/phpinfo-Google-Chrome-2019_09_13-17_10_32-300x157.png 300w, https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/phpinfo-Google-Chrome-2019_09_13-17_10_32-768x402.png 768w, https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/phpinfo-Google-Chrome-2019_09_13-17_10_32-450x235.png 450w, https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/phpinfo-Google-Chrome-2019_09_13-17_10_32-900x471.png 900w, https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/phpinfo-Google-Chrome-2019_09_13-17_10_32.png 1916w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>\u307e\u305f\u3001\u5f8c\u7a0bphp\u306e\u30b3\u30fc\u30c9\u3067\u4f7f\u7528\u3059\u308b\u306e\u3067\u3059\u304c\u3001mysqli\u3068\u3044\u3046mysql\u3078\u306e\u30a2\u30af\u30bb\u30b9\u306b\u4f7f\u7528\u3059\u308b\u30e9\u30a4\u30d6\u30e9\u30ea\u304c\u4f7f\u7528\u3067\u304d\u308b\u72b6\u614b\u306b\u306a\u3063\u3066\u3044\u308b\u304b\u3082\u78ba\u8a8d\u3057\u3066\u304a\u304d\u307e\u3059\u3002<br>\u78ba\u8a8d\u3057\u305f\u3068\u3053\u308d\u554f\u984c\u306a\u3055\u305d\u3046\u3067\u3059\u306e\u3067\u3001\u307e\u305f\u5f8c\u7a0b\u30b3\u30fc\u30c9\u3092\u66f8\u3044\u3066\u307f\u3066\u3001\u30a8\u30e9\u30fc\u304c\u51fa\u306a\u3044\u304b\u78ba\u8a8d\u3057\u3066\u307f\u307e\u3059\u3002<br>\u3053\u308c\u3067php\u304c\u52d5\u4f5c\u3059\u308b\u3053\u3068\u3082\u78ba\u8a8d\u3067\u304d\u307e\u3057\u305f\u306e\u3067\u3001\u63b2\u793a\u677f\u6a5f\u80fd\u306e\u4f5c\u6210\u306b\u79fb\u3063\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n<!DOCTYPE html>\n<html lang=\"ja\">\n<head>\n    <meta charset=\"UTF-8\">\n    <title>BBS<\/title>\n<\/head>\n<body>\n    <h1 id=\"bbs-2\">BBS<\/h1>\n    <form action=\"bbs.php\" method=\"post\">\n        \u540d\u524d:\u3000<input type=\"text\" name=\"name\" \/><br>\n        \u5185\u5bb9:\u3000<input type=\"text\" name=\"comment\" size=\"60\" \/><br>\n        <input type=\"submit\" name=\"submit\" value=\"\u9001\u4fe1\" \/>\n    <\/form>\n<\/body>\n<?php\n\n?>\n<\/html>\n<\/pre><\/div>\n\n\n<p>\u307e\u305a\u306f\u3001MySQL\u3078\u306e\u63a5\u7d9a\u51e6\u7406\u3092\u66f8\u3044\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n<!DOCTYPE html>\n<html lang=\"ja\">\n    <head>\n        <meta charset=\"UTF-8\">\n        <title>BBS<\/title>\n    <\/head>\n    <body>\n        <h1 id=\"bbs-3\">BBS<\/h1>\n        <form action=\"bbs.php\" method=\"post\">\n            \u540d\u524d:\u3000<input type=\"text\" name=\"name\" \/><br>\n            \u5185\u5bb9:\u3000<input type=\"text\" name=\"comment\" size=\"60\" \/><br>\n            <input type=\"submit\" name=\"submit\" value=\"\u9001\u4fe1\" \/>\n        <\/form>\n    <\/body>\n    <?php\n       \u3000 \u3000\/\/DB\u306b\u63a5\u7d9a\n            $mysql = mysqli_connect('localhost', 'root', 'PASS', 'fp_bbs');\n            if (!$mysql) {\n                exit('DB\u63a5\u7d9a\u30a8\u30e9\u30fc');\n            } \n\u3000\u3000\u3000\u3000\u3000\u3000\u3000mysqli_set_charset($mysql, 'utf8');\n            \/\/DB\u306e\u9078\u629e\n            $result = mysqli_select_db($mysql, 'fp_bbs');\n            if (!$result) {\n                exit('DB\u9078\u629e\u30a8\u30e9\u30fc');\n            } \n            $errors = array();\n    ?>\n<\/html>\n<\/pre><\/div>\n\n\n<p>\u307e\u305a$\u3067\u5909\u6570\u3092\u5ba3\u8a00\u3057\u3001\u305d\u306e\u4e2d\u306bMySQL\u3078\u306e\u63a5\u7d9a\u60c5\u5831\u3092\u66f8\u304d\u8fbc\u307f\u307e\u3059\u3002<br>\u63a5\u7d9a\u60c5\u5831\u306f\uff08\u30db\u30b9\u30c8\u307e\u305f\u306fIP,\u3000\u30e6\u30fc\u30b6\u30fc\u540d,\u3000\u30d1\u30b9\u30ef\u30fc\u30c9,\u3000DB\u540d\uff09\u3002<br>\u63a5\u7d9a\u304c\u30a8\u30e9\u30fc\u306e\u5834\u5408\u306f\u3001exit()\u3067\u30d7\u30ed\u30b0\u30e9\u30e0\u304c\u7d42\u4e86\u3057\u3001\u753b\u9762\u306b\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u51fa\u308b\u3088\u3046\u306b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>MySQL\u3078\u306e\u63a5\u7d9a\u304c\u5b8c\u4e86\u3059\u308c\u3070\u3001\u6b21\u306f\u4f7f\u7528\u3059\u308bDB\u306e\u9078\u629e\u3092\u66f8\u304d\u307e\u3059\u3002<br>mysqli_select_db(\u63a5\u7d9a\u60c5\u5831, DB\u540d)<br>\u3053\u308c\u3067\u4f7f\u7528\u3059\u308bDB\u3078\u306e\u30a2\u30af\u30bb\u30b9\u304c\u5b8c\u4e86\u3068\u306a\u308a\u307e\u3059\u3002<br>\u307e\u305f\u3053\u3053\u3067\u4f7f\u7528\u3057\u305fmysqli\u304c\u5148\u307b\u3069\u78ba\u8a8d\u3057\u305f\u30e9\u30a4\u30d6\u30e9\u30ea\u6a5f\u80fd\u306b\u306a\u308a\u307e\u3059\u3002<br>\u63a5\u7d9a\u306e\u51e6\u7406\u3082\u554f\u984c\u306a\u304f\u3067\u304d\u305f\u306e\u3067\u3001php\u306e\u8a2d\u5b9a\u3082\u554f\u984c\u306a\u3055\u305d\u3046\u3067\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"php2-3\">\u540d\u524d\u306e\u30c1\u30a7\u30c3\u30af<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n\/\/\u540d\u524d\u306e\u30c1\u30a7\u30c3\u30af\n$name = null;\n\/\/\u540d\u524d\u304cnull\u3067\u306a\u3044\u3053\u3068\u3092\u30c1\u30a7\u30c3\u30af\nif(!isset($_POST&#x5B;'name']) || !strlen($_POST&#x5B;'name'])) {\n\u3000 $errors&#x5B;'name'] = '\u540d\u524d\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044';\n} else if (strlen($_POST&#x5B;'name']) > 40) {\n   $errors&#x5B;'name'] = '\u540d\u524d\u306f40\u6587\u5b57\u4ee5\u5185\u3067\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044';\n} else {\n   $name = $_POST&#x5B;'name'];\n}\n<\/pre><\/div>\n\n\n<p>\u540d\u524d\u306e\u30c6\u30ad\u30b9\u30c8\u30dc\u30c3\u30af\u30b9\u306b\u5165\u529b\u3057\u305f\u5024\u304c\u4e0a\u8a18\u306e\u30c1\u30a7\u30c3\u30af\u306b\u3072\u3063\u304b\u308b\u5834\u5408\u3001\u30a8\u30e9\u30fc\u306e\u914d\u5217\u306b\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u5165\u308c\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002<br>\u3053\u308c\u306f\u6b21\u56de\u8a18\u4e8b\u3067\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u8868\u793a\u306e\u969b\u306b\u4f7f\u3046\u60f3\u5b9a\u3067\u3059\u3002<br>\u30a8\u30e9\u30fc\u30c1\u30a7\u30c3\u30af\u306e\u5bfe\u8c61\u306f\u3001\u4e0b\u8a18\u306e\u70b9\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li> \u30c6\u30ad\u30b9\u30c8\u30dc\u30c3\u30af\u30b9\u304c\u7a7a\u767d\u3067\u306a\u3044<\/li><li>\u6587\u5b57\u304c40\u6587\u5b57\u3092\u8d85\u3048\u3066\u3044\u306a\u3044\u304b\uff08\u30c6\u30fc\u30d6\u30eb\u4f5c\u6210\u6642\u306bVARCHAR(40)\u3092\u8a2d\u5b9a\u3057\u3066\u3044\u308b\u305f\u3081\uff09 <\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"php2-4\">\u6295\u7a3f\u5185\u5bb9\u306e\u30c1\u30a7\u30c3\u30af<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n \/\/\u30b3\u30e1\u30f3\u30c8\u306e\u30c1\u30a7\u30c3\u30af\n$comment = null;\n\/\/\u540d\u524d\u304cnull\u3067\u306a\u3044\u3053\u3068\u3092\u30c1\u30a7\u30c3\u30af\nif(!isset($_POST&#x5B;'comment']) || !strlen($_POST&#x5B;'comment'])) {\n\u3000$errors&#x5B;'comment'] = '\u30b3\u30e1\u30f3\u30c8\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044';\n} else if (strlen($_POST&#x5B;'comment']) > 200) {\n  $errors&#x5B;'comment'] = '\u30b3\u30e1\u30f3\u30c8\u306f200\u6587\u5b57\u4ee5\u5185\u3067\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044';\n} else {\n  $comment = $_POST&#x5B;'comment'];\n}\n<\/pre><\/div>\n\n\n<p>\u5185\u5bb9\u306e\u30c1\u30a7\u30c3\u30af\u3082\u540d\u524d\u306e\u30c1\u30a7\u30c3\u30af\u3068\u307b\u307c\u540c\u3058\u3067\u3059\u304c\u3001\u30c6\u30ad\u30b9\u30c8\u30dc\u30c3\u30af\u30b9\u306e\u5165\u529b\u5024\u306b\u5bfe\u3057\u3066\u3001\u30c1\u30a7\u30c3\u30af\u3092\u5165\u308c\u307e\u3059\u3002<br>\u30c1\u30a7\u30c3\u30af\u7b87\u6240\u306f\u4e0b\u8a18\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u30c6\u30ad\u30b9\u30c8\u30dc\u30c3\u30af\u30b9\u304c\u7a7a\u767d\u3067\u306a\u3044<\/li><li>\u6587\u5b57\u304c200\u6587\u5b57\u3092\u8d85\u3048\u3066\u3044\u306a\u3044\u304b\uff08\u30c6\u30fc\u30d6\u30eb\u4f5c\u6210\u6642\u306bVARCHAR(200)\u3092\u8a2d\u5b9a\u3057\u3066\u3044\u308b\u305f\u3081\uff09<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"php2-5\">\u4fdd\u5b58\u51e6\u7406<\/h2>\n\n\n\n<p>\u4e0a\u8a18\u3067\u3001\u30c6\u30ad\u30b9\u30c8\u30dc\u30c3\u30af\u30b9\u306e\u5024\u306b\u3088\u3063\u3066\u3001\u30a8\u30e9\u30fc\u306e\u5224\u5b9a\u3092\u3057\u3066\u304d\u307e\u3057\u305f\u3002<br>\u3053\u3053\u304b\u3089DB\u3078\u306e\u4fdd\u5b58\u51e6\u7406\u306b\u79fb\u3063\u3066\u3044\u304d\u307e\u3059\u304c\u3001\u30a8\u30e9\u30fc\u304c\u3042\u308b\u72b6\u614b\u3067\u4fdd\u5b58\u51e6\u7406\u3092\u3057\u3066\u3057\u307e\u3046\u3068\u3001<br>\u30d7\u30ed\u30b0\u30e9\u30e0\u4e0a\u4e0d\u5177\u5408\u306e\u5143\u3068\u306a\u3063\u3066\u3057\u307e\u3046\u306e\u3067\u3001\u4fdd\u5b58\u306e\u6761\u4ef6\u3068\u3057\u3066\u3001\u30a8\u30e9\u30fc\u304c\u4e00\u3064\u3082\u306a\u3044\u3053\u3068\u3092\u6761\u4ef6\u3068\u3057\u307e\u3059\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n\/\/\u30a8\u30e9\u30fc\u304c\u306a\u3051\u308c\u3070\u4fdd\u5b58\nif (count($errors) === 0) {\n\u3000\/\/\u4fdd\u5b58\u3059\u308b\u305f\u3081\u306eSQL\u5206\u3092\u4f5c\u6210\n  $sql ='INSERT INTO post(Pname, comment, created_day)VALUES(\"'\n  \u3000.mysqli_real_escape_string($mysql, $name).'\",\"\n\u3000\u3000.mysqli_real_escape_string($mysql, $comment).'\",\\''\n    .date('Y-m-d H:i:s').'\\')';\n                  \n \/\/\u4fdd\u5b58\u3059\u308b\n mysqli_query($mysql, $sql);\n}\n<\/pre><\/div>\n\n\n<p>$errors\u306b\u306f\u30a8\u30e9\u30fc\u306b\u306a\u3063\u305f\u6570\u3060\u3051\u5024\u304c\u5165\u3063\u3066\u304d\u307e\u3059\u306e\u3067\u3001\u30a8\u30e9\u30fc\u304c\u306a\u3044\u6642\u3060\u3051\u3001\u4fdd\u5b58\u51e6\u7406\u304c\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002<br>$sql\u3067\u5024\u4fdd\u5b58\u306e\u305f\u3081\u306b\u6d41\u3059INSERT\u6587\u3092\u5b9a\u7fa9\u3057\u3066\u304a\u304d\u307e\u3059\u3002<br>mysqli_query\u3067SQL\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<br><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n<!DOCTYPE html>\n<html lang=\"ja\">\n    <head>\n        <meta charset=\"UTF-8\">\n        <title>BBS<\/title>\n    <\/head>\n    <body>\n        <h1 id=\"bbs-4\">BBS<\/h1>\n        <form action=\"bbs.php\" method=\"post\">\n            \u540d\u524d:\u3000<input type=\"text\" name=\"name\" \/><br>\n            \u5185\u5bb9:\u3000<input type=\"text\" name=\"comment\" size=\"60\" \/><br>\n            <input type=\"submit\" name=\"submit\" value=\"\u9001\u4fe1\" \/>\n        <\/form>\n        <?php\n            \/\/DB\u306b\u63a5\u7d9a\n            $mysql = mysqli_connect('localhost', 'root', 'AoFLS030cztQMGzd6i3e', 'fp_bbs');\n            mysqli_set_charset($mysql, 'utf8');\n            if (!$mysql) {\n                exit('DB\u63a5\u7d9a\u30a8\u30e9\u30fc');\n            } \n            \/\/DB\u306e\u9078\u629e\n            $result = mysqli_select_db($mysql, 'fp_bbs');\n            if (!$result) {\n                exit('DB\u9078\u629e\u30a8\u30e9\u30fc');\n            } \n            $errors = array();\n\n            \/\/POST\u306a\u3089\u4fdd\u5b58\u51e6\u7406\n            if($_SERVER&#x5B;'REQUEST_METHOD'] === 'POST') {\n                \/\/\u540d\u524d\u306e\u30c1\u30a7\u30c3\u30af\n                $name = null;\n                \/\/\u540d\u524d\u304cnull\u3067\u306a\u3044\u3053\u3068\u3092\u30c1\u30a7\u30c3\u30af\n                if(!isset($_POST&#x5B;'name']) || !strlen($_POST&#x5B;'name'])) {\n                    $errors&#x5B;'name'] = '\u540d\u524d\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044';\n                } else if (strlen($_POST&#x5B;'name']) > 40) {\n                    $errors&#x5B;'name'] = '\u540d\u524d\u306f40\u6587\u5b57\u4ee5\u5185\u3067\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044';\n                } else {\n                    $name = $_POST&#x5B;'name'];\n                }\n                 \/\/\u30b3\u30e1\u30f3\u30c8\u306e\u30c1\u30a7\u30c3\u30af\n                 $comment = null;\n                 \/\/\u540d\u524d\u304cnull\u3067\u306a\u3044\u3053\u3068\u3092\u30c1\u30a7\u30c3\u30af\n                 if(!isset($_POST&#x5B;'comment']) || !strlen($_POST&#x5B;'comment'])) {\n                     $errors&#x5B;'comment'] = '\u30b3\u30e1\u30f3\u30c8\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044';\n                 } else if (strlen($_POST&#x5B;'comment']) > 200) {\n                     $errors&#x5B;'comment'] = '\u30b3\u30e1\u30f3\u30c8\u306f200\u6587\u5b57\u4ee5\u5185\u3067\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044';\n                 } else {\n                     $comment = $_POST&#x5B;'comment'];\n                 }\n                \/\/\u30a8\u30e9\u30fc\u304c\u306a\u3051\u308c\u3070\u4fdd\u5b58\n                if (count($errors) === 0) {\n                    \/\/\u4fdd\u5b58\u3059\u308b\u305f\u3081\u306eSQL\u5206\u3092\u4f5c\u6210\n                    $sql ='INSERT INTO post(Pname, comment, created_day)VALUES(\"'\n                        .mysqli_real_escape_string($mysql, $name).'\",\"'\n                        .mysqli_real_escape_string($mysql, $comment).'\",\\''\n                        .date('Y-m-d H:i:s').'\\')';\n\n                    \/\/\u4fdd\u5b58\u3059\u308b\n                    mysqli_query($mysql, $sql);\n                }\n            }\u3000\n        ?>\n    <\/body>\n<\/html>\n<\/pre><\/div>\n\n\n<p>\u5168\u3066\u306e\u30b3\u30fc\u30c9\u306f\u4e0a\u8a18\u306b\u306a\u308a\u307e\u3059\u3002<br>\u4eca\u56de\u8ffd\u52a0\u3057\u305f\u30b3\u30fc\u30c9\u306e\u524d\u306b\u3001\u901a\u4fe1\u306e\u30e1\u30bd\u30c3\u30c9\u304c\u6307\u5b9a\u306e\u3082\u306e\u3067\u306a\u3051\u308c\u3070\u3001\u52d5\u4f5c\u3057\u306a\u3044\u3088\u3046\u306b\u30b3\u30fc\u30c9\u3092\u8ffd\u52a0\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/BBS-Google-Chrome-2019_09_06-20_42_56-2.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"508\" src=\"https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/BBS-Google-Chrome-2019_09_06-20_42_56-2-1024x508.png\" alt=\"\" class=\"wp-image-7983\" srcset=\"https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/BBS-Google-Chrome-2019_09_06-20_42_56-2-1024x508.png 1024w, https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/BBS-Google-Chrome-2019_09_06-20_42_56-2-300x149.png 300w, https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/BBS-Google-Chrome-2019_09_06-20_42_56-2-768x381.png 768w, https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/BBS-Google-Chrome-2019_09_06-20_42_56-2-450x223.png 450w, https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/BBS-Google-Chrome-2019_09_06-20_42_56-2-900x447.png 900w, https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/BBS-Google-Chrome-2019_09_06-20_42_56-2.png 1897w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>\u540d\u524d\u3068\u3072\u3068\u3053\u3068\u306e\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u5165\u308c\u3066\u307f\u307e\u3057\u305f\u3002\u3053\u306e\u5185\u5bb9\u3067\u9001\u4fe1\u30dc\u30bf\u30f3\u3092\u62bc\u4e0b\u3057\u305f\u3089\u3001\u5024\u304cDB\u306b\u4fdd\u5b58\u3055\u308c\u3066\u3044\u308b\u304b\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<br>\u78ba\u8a8d\u65b9\u6cd5\u306f\u3001\u30b3\u30de\u30f3\u30c9\u30d7\u30ed\u30f3\u30d7\u30c8\u3067\u78ba\u8a8d\u3059\u308b\u65b9\u6cd5\u3068GUI\u30c4\u30fc\u30eb\uff08MySQL\u306a\u3089WorkBench\u306a\u3069\uff09\u306e2\u7a2e\u985e\u3042\u308a\u307e\u3059\u304c\u3001\u4eca\u56de\u306f1\u4ef6\u3057\u304b\u4fdd\u5b58\u30c7\u30fc\u30bf\u304c\u306a\u3044\u306e\u3067\u3001\u30b3\u30de\u30f3\u30c9\u30d7\u30ed\u30f3\u30d7\u30c8\u3067\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nmysql> show databases;\n+--------------------+\n| Database           |\n+--------------------+\n| fp_bbs             |\n| information_schema |\n| mysql              |\n| performance_schema |\n| sakila             |\n| sys                |\n| world              |\n+--------------------+\n7 rows in set (0.00 sec)\n\nmysql> use fp_bbs;\nDatabase changed\n\nmysql> show tables;\n+------------------+\n| Tables_in_fp_bbs |\n+------------------+\n| post             |\n+------------------+\n1 row in set (0.00 sec)\nmysql> show fields from post;\n+-------------+--------------+------+-----+---------+----------------+\n| Field       | Type         | Null | Key | Default | Extra          |\n+-------------+--------------+------+-----+---------+----------------+\n| id          | int(11)      | NO   | PRI | NULL    | auto_increment |\n| Pname       | varchar(40)  | YES  |     | NULL    |                |\n| comment     | varchar(200) | YES  |     | NULL    |                |\n| created_day | datetime     | YES  |     | NULL    |                |\n+-------------+--------------+------+-----+---------+----------------+\n4 rows in set (0.00 sec)\n\nmysql> select * from post;\n+----+--------+--------------+---------------------+\n| id | Pname  | comment      | created_day         |\n+----+--------+--------------+---------------------+\n| 1  | Yusuke | \u306f\u3058\u3081\u307e\u3057\u3066  | 2019-09-06 13:55:28 |\n+----+--------+--------------+---------------------+\n1 row in set (0.00 sec)\n<\/pre><\/div>\n\n\n<p>DB\u306e\u9078\u629e\u304b\u3089\u3001\u30c6\u30fc\u30d6\u30eb\u304b\u3089\u30c7\u30fc\u30bf\u306e\u53d6\u308a\u51fa\u3057\u307e\u3067\u3092\u3001\u30b3\u30de\u30f3\u30c9\u30d7\u30ed\u30f3\u30d7\u30c8\u3067\u5b9f\u884c\u3057\u3066\u307f\u307e\u3057\u305f\u3002<br>\u5165\u529b\u3057\u305f\u5185\u5bb9\u304c\u3001\u60f3\u5b9a\u901a\u308aDB\u306b\u4fdd\u5b58\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059\u3002<br>\u3053\u308c\u3067\u6295\u7a3f\u3057\u305f\u5185\u5bb9\u304cDB\u306b\u4fdd\u5b58\u3055\u308c\u308b\u51e6\u7406\u306f\u5b8c\u6210\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u4eca\u56de\u753b\u9762\u3068\u51e6\u7406\u3092\u540c\u3058\u30d5\u30a1\u30a4\u30eb\u306b\u66f8\u304d\u8fbc\u3093\u3067\u304a\u308a\u3001\u51e6\u7406\u3054\u3068\u306b\u5206\u5272\u3057\u305f\u307b\u3046\u304c\u53ef\u8aad\u6027\u3082\u4e0a\u304c\u308b\u305f\u3081\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306b\u5f79\u5272\u6bce\u306b\u30d5\u30a1\u30a4\u30eb\u3092\u5206\u5272\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u5165\u529b\u753b\u9762\uff1abbs.php<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; highlight: [9]; title: ; notranslate\" title=\"\">\n<!DOCTYPE html>\n<html lang=\"ja\">\n    <head>\n        <meta charset=\"UTF-8\">\n        <title>BBS<\/title>\n    <\/head>\n    <body>\n        <h1 id=\"bbs-5\">BBS<\/h1>\n        <form action=\"connectbbs.php\" method=\"post\">\n            \u540d\u524d:\u3000<input type=\"text\" name=\"name\" \/><br>\n            \u5185\u5bb9:\u3000<input type=\"text\" name=\"comment\" size=\"60\" \/><br>\n            <input type=\"submit\" name=\"submit\" value=\"\u9001\u4fe1\" \/>\n        <\/form>\n    <\/body>\n<\/html>\n<\/pre><\/div>\n\n\n<p>DB\u3068\u306e\u63a5\u7d9a\u51e6\u7406\u90e8\u5206\uff1aconnectbbs.php<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; highlight: [51]; title: ; notranslate\" title=\"\">\n <?php\n    \/\/DB\u306b\u63a5\u7d9a\n    $mysql = mysqli_connect('localhost', 'root', 'AoFLS030cztQMGzd6i3e', 'fp_bbs');\n    if (!$mysql) {\n        exit('DB\u63a5\u7d9a\u30a8\u30e9\u30fc');\n    } \n    mysqli_set_charset($mysql, 'utf8');\n    \/\/DB\u306e\u9078\u629e\n    $result = mysqli_select_db($mysql, 'fp_bbs');\n    if (!$result) {\n        exit('DB\u9078\u629e\u30a8\u30e9\u30fc');\n    } \n    $errors = array();\n\n    \/\/POST\u306a\u3089\u4fdd\u5b58\u51e6\u7406\n    if($_SERVER&#x5B;'REQUEST_METHOD'] === 'POST') {\n        \/\/\u540d\u524d\u306e\u30c1\u30a7\u30c3\u30af\n        $name = null;\n        \/\/\u540d\u524d\u304cnull\u51fa\u306a\u3044\u3053\u3068\u3092\u30c1\u30a7\u30c3\u30af\n        if(!isset($_POST&#x5B;'name']) || !strlen($_POST&#x5B;'name'])) {\n            $errors&#x5B;'name'] = '\u540d\u524d\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044';\n        } else if (strlen($_POST&#x5B;'name']) > 40) {\n            $errors&#x5B;'name'] = '\u540d\u524d\u306f40\u6587\u5b57\u4ee5\u5185\u3067\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044';\n        } else {\n            $name = $_POST&#x5B;'name'];\n        }\n            \/\/\u30b3\u30e1\u30f3\u30c8\u306e\u30c1\u30a7\u30c3\u30af\n            $comment = null;\n            \/\/\u540d\u524d\u304cnull\u3067\u306a\u3044\u3053\u3068\u3092\u30c1\u30a7\u30c3\u30af\n            if(!isset($_POST&#x5B;'comment']) || !strlen($_POST&#x5B;'comment'])) {\n                $errors&#x5B;'comment'] = '\u30b3\u30e1\u30f3\u30c8\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044';\n            } else if (strlen($_POST&#x5B;'comment']) > 200) {\n                $errors&#x5B;'comment'] = '\u30b3\u30e1\u30f3\u30c8\u306f200\u6587\u5b57\u4ee5\u5185\u3067\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044';\n            } else {\n                $comment = $_POST&#x5B;'comment'];\n            }\n        \/\/\u30a8\u30e9\u30fc\u304c\u306a\u3051\u308c\u3070\u4fdd\u5b58\n        if (count($errors) === 0) {\n            \/\/\u4fdd\u5b58\u3059\u308b\u305f\u3081\u306eSQL\u6587\u3092\u4f5c\u6210\n            $sql ='INSERT INTO post(Pname, comment, created_day)VALUES(\"'\n                .mysqli_real_escape_string($mysql, $name).'\",\"'\n                .mysqli_real_escape_string($mysql, $comment).'\",\\''\n                .date('Y-m-d H:i:s').'\\')';\n\n            \/\/\u4fdd\u5b58\u3059\u308b\n            mysqli_query($mysql, $sql);\n        }else{\n            var_dump($errors);\n        }\n    }\n    include 'bbs.php';\n?>\n<\/pre><\/div>\n\n\n<p>php\u7d42\u4e86\u30bf\u30b0\u306e\u524d\u306b include &#8216;bbs.php&#8217; \u3092\u5165\u529b\u3059\u308b\u3053\u3068\u3067\u3001\u753b\u9762\u5074\u3078\u3068\u9077\u79fb\u3055\u305b\u3066\u3044\u307e\u3059\u3002<br>\u30a8\u30e9\u30fc\u8868\u793a\u306f\u3001\u6b21\u56de\u8ffd\u52a0\u3059\u308b\u3082\u306e\u306e\u3001\u30a8\u30e9\u30fc\u6642\u306e\u51e6\u7406\u304c\u6a5f\u80fd\u3057\u3066\u3044\u308b\u304b\u3092\u78ba\u8a8d\u3059\u308b\u305f\u3081\u3001<br>var_dump\u306e\u51e6\u7406\u3092\u5165\u308c\u3066\u3044\u307e\u3059\u3002\u5f15\u6570\u3092$errors\u306b\u3059\u308b\u3053\u3068\u3067\u3001\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u3059\u3079\u3066\u8868\u793a\u3059\u308b\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u3002<br>\u4e0b\u8a18\u306e\u753b\u50cf\u306f\u3001\u540d\u524d\u3068\u5185\u5bb9\u3092\u672a\u5165\u529b\u306e\u72b6\u614b\u3067\u9001\u4fe1\u3057\u305f\u969b\u306b\u3001\u8868\u793a\u3055\u308c\u305f\u30a8\u30e9\u30fc\u5185\u5bb9\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/BBS-Google-Chrome-2019_09_13-18_30_17-2.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"511\" src=\"https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/BBS-Google-Chrome-2019_09_13-18_30_17-2-1024x511.png\" alt=\"\" class=\"wp-image-8102\" srcset=\"https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/BBS-Google-Chrome-2019_09_13-18_30_17-2-1024x511.png 1024w, https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/BBS-Google-Chrome-2019_09_13-18_30_17-2-300x150.png 300w, https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/BBS-Google-Chrome-2019_09_13-18_30_17-2-768x383.png 768w, https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/BBS-Google-Chrome-2019_09_13-18_30_17-2-450x224.png 450w, https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/BBS-Google-Chrome-2019_09_13-18_30_17-2-900x449.png 900w, https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/BBS-Google-Chrome-2019_09_13-18_30_17-2.png 1915w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"php2-6\">\u4eca\u56de\u3064\u307e\u3065\u3044\u305f\u3068\u3053\u308d<\/h2>\n\n\n\n<p>\u4eca\u56de\u4e0b\u8a18\u306e\u70b9\u3067\u3001\u89e3\u6c7a\u306b\u5c11\u3057\u6642\u9593\u304c\u304b\u304b\u308a\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>mysqli\u95a2\u6570\u304c\u672a\u5b9a\u7fa9\u306e\u30a8\u30e9\u30fc<\/li><li>PHP\u304b\u3089MySQL\u3078\u306e\u63a5\u7d9a\u304c\u3067\u304d\u306a\u3044<\/li><\/ul>\n\n\n\n<p>\u307e\u305a1\u70b9\u76ee\u306b\u95a2\u3057\u3066\u306f\u3001\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3067\u3042\u308bphp.ini\u306emysqli\u306e\u62e1\u5f35\u6a5f\u80fd\u304c\u30b3\u30e1\u30f3\u30c8\u5316\u3055\u308c\u3066\u3044\u308b\u5834\u5408\u304c\u3042\u308b\u306e\u3067\u3001\u305d\u306e\u5834\u5408\u306f\u3001\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u3092\u5916\u3057\u3066\u6a5f\u80fd\u3092\u6709\u52b9\u5316\u3055\u305b\u307e\u3059\u3002<br><br> ;extension=mysqli \u2192 extension=mysqli<br><br>\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u6709\u52b9\u306b\u306a\u3063\u3066\u3044\u308b\u3082\u306e\u3060\u3068\u601d\u3044\u3001\u3053\u306e\u70b9\u306b\u6c17\u3065\u304f\u306e\u306b\u5c11\u3057\u6642\u9593\u304c\u304b\u304b\u3063\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u3002<br>\u3082\u3057mysqli\u95a2\u6570\u304c\u672a\u5b9a\u7fa9\u3067\u3059\u3068\u3044\u3046\u30a8\u30e9\u30fc\u304c\u51fa\u305f\u5834\u5408\u306f\u3001\u3053\u306e\u7b87\u6240\u3092\u4fee\u6b63\u3059\u308b\u3068\u89e3\u6c7a\u3059\u308b\u3068\u601d\u308f\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<p>2\u70b9\u76ee\u306b\u95a2\u3057\u3066\u306f\u3001PHP\u3067MySQL\u306b\u63a5\u7d9a\u304c\u3067\u304d\u306a\u3044\u6642\u306b\u78ba\u8a8d\u3057\u305f\u65b9\u304c\u826f\u3044\u70b9\u3067\u3059\u3002<br>\u305d\u3082\u305d\u3082DB\u63a5\u7d9a\u306e\u51e6\u7406\u304b\u3089\u4f55\u3082\u51e6\u7406\u304c\u6d41\u308c\u305a\u3001\u30a8\u30e9\u30fc\u3082\u51fa\u306a\u3044\u306a\u3069\u306e\u5834\u5408\u306f\u3053\u306e\u70b9\u304c\u3001\u3042\u3066\u306f\u307e\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<br><br>\u89e3\u6c7a\u6cd5\u3068\u3057\u3066\u306f\u3001\u30b3\u30de\u30f3\u30c9\u30d7\u30ed\u30f3\u30d7\u30c8\u306b\u3066\u30d7\u30e9\u30b0\u30a4\u30f3\u306e\u8a8d\u8a3c\u65b9\u6cd5\u3092\u5909\u66f4\u3059\u308b\u4f5c\u696d\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nmysql> select User, Plugin from mysql.user;\n+------------------+-----------------------+\n| User             | Plugin                |\n+------------------+-----------------------+\n| sample_user      | mysql_native_password |\n| mysql.infoschema | mysql_native_password |\n| mysql.session    | mysql_native_password |\n| mysql.sys        | mysql_native_password |\n| root             | caching_sha2_password |\n+------------------+-----------------------+\n5 rows in set (0.01 sec)\n<\/pre><\/div>\n\n\n<p>\u3053\u3061\u3089\u3067\u4f7f\u7528\u3059\u308b\u30e6\u30fc\u30b6\u30fc\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\u304c\u300cmysql_native_password\u300d\u306b\u306a\u3063\u3066\u3044\u306a\u3044\u5834\u5408\u306f\u5909\u66f4\u3057\u306a\u3044\u3068\u3001\u63a5\u7d9a\u30a8\u30e9\u30fc\u306b\u306a\u308a\u307e\u3059\uff08\u4eca\u56de\u306froot\u30e6\u30fc\u30b6\u30fc\uff09\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nALTER USER \u5909\u66f4\u3057\u305f\u3044\u30e6\u30fc\u30b6\u30fc\u540d@localhost IDENTIFIED mysql_native_password BY '\u8a2d\u5b9a\u3057\u3066\u3044\u308b\u30d1\u30b9\u30ef\u30fc\u30c9';\n<\/pre><\/div>\n\n\n<p>\u3053\u3061\u3089\u3067\u8a2d\u5b9a\u5909\u66f4\u304c\u3067\u304d\u3001\u63a5\u7d9a\u304c\u53ef\u80fd\u3068\u306a\u308b\u306f\u305a\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u30b3\u30fc\u30c9\u4ee5\u5916\u3067\u8a70\u307e\u3063\u305f\u3068\u3053\u308d\u304c\u3042\u3063\u305f\u306e\u3067\u3001\u7d39\u4ecb\u3057\u307e\u3057\u305f\u3002<br>\u30b3\u30fc\u30c9\u306e\u52d5\u4f5c\u4ee5\u5916\u3067\u8a70\u307e\u308b\u3068\u3053\u308d\u304c\u3042\u3063\u305f\u5834\u5408\u306f\u3001\u3053\u3061\u3089\u3082\u53c2\u8003\u306b\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"php2-7\">\u6b21\u56de\u4e88\u544a<\/h2>\n\n\n\n<p>\u6b21\u56de\u306f\u3001\u6295\u7a3f\u3057\u305f\u5185\u5bb9\u304c\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u306b\u8868\u793a\u3055\u308c\u3066\u3044\u304f\u6a5f\u80fd\u3092\u4f5c\u308b\u306e\u3068\u3001\u30a8\u30e9\u30fc\u304c\u51fa\u305f\u969b\u306b\u3001\u8a72\u5f53\u3059\u308b\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u8868\u793a\u3059\u308b\u6a5f\u80fd\u3092\u4f5c\u6210\u3057\u3001\u4e00\u65e6\u7c21\u6613\u63b2\u793a\u677f\u6a5f\u80fd\u306f\u5b8c\u6210\u3068\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u76ee\u6b21 \u306f\u3058\u3081\u306b\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u63a5\u7d9a\u540d\u524d\u306e\u30c1\u30a7\u30c3\u30af\u6295\u7a3f\u5185\u5bb9\u306e\u30c1\u30a7\u30c3\u30af\u4fdd\u5b58\u51e6\u7406\u4eca\u56de\u3064\u307e\u3065\u3044\u305f\u3068\u3053\u308d\u6b21\u56de\u4e88\u544a \u306f\u3058\u3081\u306b \u524d\u56de\u306e\u8a18\u4e8b\u3067\u306f\u3001\u74b0\u5883\u306e\u8a2d\u5b9a\u304b\u3089\u753b\u9762\u30a4\u30e1\u30fc\u30b8\u306e\u4f5c\u6210\u307e\u3067\u884c\u3044\u307e\u3057\u305f\u3002\u4eca\u56de\u306f\u3001\u5b9f\u969b\u306b\u5165\u529b\u3057\u305f\u5185\u5bb9\u304cDB\u306b\u4fdd\u5b58\u3055\u308c\u308b\u51e6\u7406\u3092\u7d39\u4ecb\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002 \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u63a5\u7d9a \u307e\u305a\u306f\u30c7\u30fc\u30bf\u9001\u4fe1\u306e\u53d7\u3051\u76bf\u3068\u306a\u308bDB\u3068\u306e\u63a5\u7d9a\u51e6\u7406\u3092\u66f8\u3044\u3066\u3044\u304d\u307e\u3059\u3002 \u524d\u56de\u4f5c\u6210\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u306f\u30d5\u30a1\u30a4\u30eb\u5f62\u5f0f\u304chtml\u306b\u306a\u3063\u3066\u304a\u308a\u3001\u3053\u306e\u307e\u307e\u3067\u306f\u9759\u7684\u30b5\u30a4\u30c8\uff08\u5e38\u306b\u540c\u3058\u5185\u5bb9\u304c\u8868\u793a\u3055\u308c\u308b\u30b5\u30a4\u30c8\uff09\u306b\u306a\u3063\u3066\u3057\u307e\u3046\u306e\u3067\u3001\u52d5\u7684\u30b5\u30a4\u30c8\uff08\u30a2\u30af\u30bb\u30b9\u3084\u5165\u529b\u3057\u305f\u5185\u5bb9\u7b49\u306b\u3088\u3063\u3066\u7570\u306a\u308b\u8868\u793a\u304c\u3055\u308c\u308b\u30b5\u30a4\u30c8\uff09\u306b\u3059\u308b\u305f\u3081\u306bphp\u306b\u5909\u66f4\u3057\u307e\u3059\u3002\u203b\u52d5\u7684\u30b5\u30a4\u30c8\u3092\u4f5c\u308b\u306b\u306f\u3001php\u4ee5\u5916\u306b\u3082Ruby\u3084JavaScript&hellip;","protected":false},"author":13,"featured_media":8082,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[60],"tags":[61],"class_list":{"0":"post-7951","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-php","8":"tag-season19"},"_links":{"self":[{"href":"https:\/\/itport.cloud\/index.php?rest_route=\/wp\/v2\/posts\/7951","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itport.cloud\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itport.cloud\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itport.cloud\/index.php?rest_route=\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/itport.cloud\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7951"}],"version-history":[{"count":34,"href":"https:\/\/itport.cloud\/index.php?rest_route=\/wp\/v2\/posts\/7951\/revisions"}],"predecessor-version":[{"id":8111,"href":"https:\/\/itport.cloud\/index.php?rest_route=\/wp\/v2\/posts\/7951\/revisions\/8111"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/itport.cloud\/index.php?rest_route=\/wp\/v2\/media\/8082"}],"wp:attachment":[{"href":"https:\/\/itport.cloud\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7951"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itport.cloud\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7951"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itport.cloud\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7951"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}