{"id":954,"date":"2011-04-04T00:44:33","date_gmt":"2011-04-03T15:44:33","guid":{"rendered":"http:\/\/www.webcyou.com\/?p=954"},"modified":"2013-01-28T02:07:18","modified_gmt":"2013-01-27T17:07:18","slug":"php-%e4%bc%9a%e5%93%a1%e7%99%bb%e9%8c%b2%e3%83%95%e3%82%a9%e3%83%bc%e3%83%a0-%e3%82%a8%e3%83%a9%e3%83%bc%e3%83%a1%e3%83%83%e3%82%bb%e3%83%bc%e3%82%b8%e8%a1%a8%e7%a4%ba","status":"publish","type":"post","link":"https:\/\/www.webcyou.com\/?p=954","title":{"rendered":"PHP \u4f1a\u54e1\u767b\u9332\u30d5\u30a9\u30fc\u30e0 \u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u8868\u793a"},"content":{"rendered":"<p>\u4f1a\u54e1\u767b\u9332\u30d5\u30a9\u30fc\u30e0\u3067\u3088\u304f\u3042\u308b\u3001\u300c\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u300d\u8868\u793a\u306b\u3064\u3044\u3066\u3067\u3059\u3002<\/p>\n<p style=\"margin-top: 1em;\">\u30a8\u30e9\u30fc\u304c\u306a\u3051\u308c\u3070\u3001\u767b\u9332\u5185\u5bb9\u78ba\u8a8d\u306e\u753b\u9762\u3078\u3068\u9077\u79fb\u3055\u305b\u307e\u3059\u3002<\/p>\n<p style=\"margin-top: 1em;\">\u767b\u9332\u5185\u5bb9\u304c\u300c\u30cb\u30c3\u30af\u30cd\u30fc\u30e0\u300d\u300c\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u300d\u300c\u30d1\u30b9\u30ef\u30fc\u30c9\u300d\u304c\u3042\u3063\u305f\u5834\u5408\u3001<\/p>\n<p style=\"margin-top: 1em;\"><strong>HTML<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n&lt;form action=&quot;&quot; method=&quot;post&quot; enctype=&quot;multipart\/form-data&quot;&gt;\r\n  &lt;dl&gt;\r\n    &lt;dt&gt;\u30cb\u30c3\u30af\u30cd\u30fc\u30e0&lt;span&gt;\u5fc5\u9808&lt;\/span&gt;&lt;\/dt&gt;\r\n    &lt;dd&gt;&lt;input type=&quot;text&quot; name=&quot;name&quot; size=&quot;35&quot; maxlength=&quot;255&quot; \/&gt; &lt;\/dd&gt;\r\n    &lt;dt&gt;\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9&lt;\/dt&gt;\r\n    &lt;dd&gt;&lt;input type=&quot;text&quot; name=&quot;email&quot; size=&quot;35&quot; maxlength=&quot;255&quot; \/&gt;&lt;\/dd&gt;\r\n    &lt;dt&gt;\u30d1\u30b9\u30ef\u30fc\u30c9&lt;\/dt&gt;\r\n    &lt;dd&gt;&lt;input type=&quot;password&quot; name=&quot;password&quot; size=&quot;10&quot; maxlength=&quot;20&quot;  \/&gt;&lt;\/dd&gt;\r\n  &lt;\/dl&gt;\r\n  &lt;div&gt;&lt;input type=&quot;submit&quot; value=&quot;\u5165\u529b\u5185\u5bb9\u3092\u78ba\u8a8d\u3059\u308b&quot; \/&gt;&lt;\/div&gt;\r\n&lt;\/form&gt;\r\n<\/pre>\n<p style=\"margin-top: 2em;\">index.php\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3002<\/p>\n<p style=\"margin-top: 2em;\">Form\u3092\u7528\u610f\u3057\u307e\u3059\u3002\uff08form action=&#8221;&#8221; \u306f \u540c\u30d5\u30a1\u30a4\u30eb\u306e\u30d1\u30b9(index.php)\u3068\u540c\u69d8\u3067\u3059\u3002\uff09<\/p>\n<p style=\"margin-top: 1em;\"><strong>PHP<\/strong><\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&lt;?php\r\nsession_start();\r\nif(!empty($_POST)){\r\n  \/\/\u30a8\u30e9\u30fc\u9805\u76ee\u306e\u78ba\u8a8d\r\n  \/\/\u30cb\u30c3\u30af\u30cd\u30fc\u30e0\u304c\u7a7a\u306e\u5834\u5408\r\n  if($_POST&#x5B;'name'] == '') {\r\n    $error&#x5B;'name'] = 'blank';\r\n  }\r\n\r\n  \/\/\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u304c\u7a7a\u306e\u5834\u5408\r\n  if($_POST&#x5B;'email'] == '') {\r\n    $error&#x5B;'email'] = 'blank';\r\n  }\r\n\r\n  \/\/\u30d1\u30b9\u30ef\u30fc\u30c9\u304c6\u6587\u5b57\u4ee5\u4e0b\u306e\u5834\u5408\r\n  if(strlen($_POST&#x5B;'password']) &lt; 6) {\r\n    $error&#x5B;'password'] = 'length';\r\n  }\r\n\r\n  \/\/\u30d1\u30b9\u30ef\u30fc\u30c9\u304c\u7a7a\u306e\u5834\u5408\r\n  if($_POST&#x5B;'password'] == '') {\r\n    $error&#x5B;'password'] = 'blank';\r\n  }\r\n\r\n  \/\/\u30a8\u30e9\u30fc\u304c\u306a\u3044\u5834\u5408\u306f\u78ba\u8a8d\u30da\u30fc\u30b8\u3078\u30da\u30fc\u30b8\u9077\u79fb\r\n  if(empty($error)){\r\n    $_SESSION&#x5B;'join'] = $_POST;\r\n    header('Location: check.php');\r\n  }\r\n}\r\n?&gt;\r\n<\/pre>\n<p style=\"margin-top: 1em;\">\u540cHTML\u30d5\u30a1\u30a4\u30eb\u306e\u5192\u982d\u306b\u8a18\u8ff0\u3057\u307e\u3059\u3002<\/p>\n<p style=\"margin-top: 1em;\">\u305d\u308c\u305e\u308c\u306e\u5024\u304c\u7a7a\u306e\u5834\u5408\u306f&#8217;blank&#8217;\u3068\u3044\u3046\u5024\u3092\u4ee3\u5165\uff08\u4f55\u3067\u3082\u826f\u3044\uff09<\/p>\n<p style=\"margin-top: 1em;\">\u307e\u305f\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u304c6\u6587\u5b57\u4ee5\u4e0b\u306e\u5834\u5408\u306f&#8217;length&#8217;\u3068\u3044\u3046\u5024\u3092\u4ee3\u5165\uff08\u3053\u308c\u307e\u305f\u4f55\u3067\u3082\u826f\u3044\uff09<\/p>\n<p style=\"margin-top: 1em;\">\u305d\u308c\u3067\u306f\u3001\u8868\u793a\u3055\u305b\u305f\u3044\u7b87\u6240\u306b<\/p>\n<p style=\"margin-top: 1em;\"><strong>PHP<\/strong><\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&lt;?php if($error&#x5B;'name'] == 'blank'): ?&gt;\r\n  &lt;p class=&quot;error&quot;&gt;\u203b\u5fc5\u9808 \u30cb\u30c3\u30af\u30cd\u30fc\u30e0\u3092\u5165\u529b\u3057\u3066\u4e0b\u3055\u3044\u3002&lt;\/p&gt;\r\n&lt;?php endif; ?&gt;\r\n<\/pre>\n<p style=\"margin-top: 1em;\">\u3053\u306e\u3088\u3046\u306bif\u6587\u3067\u8868\u793a\u3055\u305b\u307e\u3059\u3002<\/p>\n<p style=\"margin-top: 1em;\">\u5404\u30d5\u30a9\u30fc\u30e0\u306e\u4e0b\u306b\u8868\u793a\u3055\u305b\u305f\u3044\u3068\u304d\u306f<\/p>\n<p style=\"margin-top: 1em;\"><strong>HTML<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n&lt;dt&gt;\u30cb\u30c3\u30af\u30cd\u30fc\u30e0&lt;span&gt;\u5fc5\u9808&lt;\/span&gt;&lt;\/dt&gt;\r\n&lt;dd&gt;&lt;input type=&quot;text&quot; name=&quot;name&quot; size=&quot;35&quot; maxlength=&quot;255&quot; \/&gt;\r\n&lt;?php if($error&#x5B;'name'] == 'blank'): ?&gt;\r\n  &lt;p class=&quot;error&quot;&gt;\u203b\u5fc5\u9808 \u30cb\u30c3\u30af\u30cd\u30fc\u30e0\u3092\u5165\u529b\u3057\u3066\u4e0b\u3055\u3044\u3002&lt;\/p&gt;\r\n&lt;?php endif; ?&gt;\r\n&lt;\/dd&gt;\r\n<\/pre>\n<p style=\"margin-top: 1em;\">\u3053\u306e\u3088\u3046\u306b\u8a18\u8ff0\u3057\u307e\u3059\u3002<\/p>\n<p style=\"margin-top: 1em;\">\u540c\u69d8\u306b\u3001<span style=\"font-family: Consolas, Monaco, 'Courier New', Courier, monospace; line-height: 18px; font-size: 12px; white-space: pre;\">if($error[&#8216;name&#8217;]<\/span><\/p>\n<p style=\"margin-top: 1em;\">\u306e\u90e8\u5206 &#8216;name&#8217;\u306e\u5024\u3092&#8217;email&#8217;,&#8217;password&#8217;\u306b\u5909\u66f4\u3057<\/p>\n<p style=\"margin-top: 1em;\">\u5404\u30d5\u30a9\u30fc\u30e0\u306e\u4e0b\u306b\u3067\u3082\u8a18\u8ff0\u3059\u308c\u3070\u3001<\/p>\n<p style=\"margin-top: 1em;\">\u5404\u30d5\u30a9\u30fc\u30e0\u306e\u5024\u304c\u7a7a\u306e\u307e\u307e\u78ba\u8a8d\u30dc\u30bf\u30f3\u3092\u62bc\u3057\u305f\u5834\u5408\u300c\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u300d\u8868\u793a\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p style=\"margin-top: 1em;\">\u307e\u305f\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u304c6\u6587\u5b57\u4ee5\u4e0b\u306e\u5834\u5408\u306ePHP\u6587\u306f<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&lt;?php if($error&#x5B;'password'] == 'length'): ?&gt;\r\n&lt;p class=&quot;error&quot;&gt;\u203b\u30d1\u30b9\u30ef\u30fc\u30c9\u30926\u6587\u5b57\u4ee5\u4e0a\u3067\u5165\u529b\u3057\u3066\u4e0b\u3055\u3044\u3002&lt;\/p&gt;\r\n&lt;?php endif; ?&gt;<\/pre>\n<p style=\"margin-top: 1em;\">\u3067\u3059\u3002<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&lt;?php if($error&#x5B;'password'] == 'blank'): ?&gt;\r\n  &lt;p&gt;\u203b\u5fc5\u9808 \u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u5165\u529b\u3057\u3066\u4e0b\u3055\u3044\u3002&lt;\/p&gt;\r\n&lt;?php1 endif; ?&gt;\r\n&lt;?php if($error&#x5B;'password'] == 'length'): ?&gt;\r\n  &lt;p class=&quot;error&quot;&gt;\u203b\u30d1\u30b9\u30ef\u30fc\u30c9\u30926\u6587\u5b57\u4ee5\u4e0a\u3067\u5165\u529b\u3057\u3066\u4e0b\u3055\u3044\u3002&lt;\/p&gt;\r\n&lt;?php endif; ?&gt;\r\n<\/pre>\n<p style=\"margin-top: 1em;\">\u30d1\u30b9\u30ef\u30fc\u30c9\u306e\u5024\u304c\u7a7a\u306e\u5834\u5408\u306e\u8a18\u8ff0\u306e\u5f8c\u306b\u8a18\u8ff0\u3059\u308b\u3068\u3044\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\n<p style=\"margin-top: 1em;\">\u307e\u305f\u3001\u3053\u306e\u307e\u307e\u3060\u3068\u3001<\/p>\n<p style=\"margin-top: 1em;\">\u30e6\u30fc\u30b6\u30fc\u304c\u5148\u307b\u3069\u5165\u529b\u3057\u305f\u60c5\u5831\u304c\u78ba\u8a8d\u30dc\u30bf\u30f3\u3092\u62bc\u3059\u4e8b\u306b\u3088\u3063\u3066<\/p>\n<p style=\"margin-top: 1em;\">\u6d88\u3048\u3066\u3057\u307e\u3046\u306e\u3067\u3001\u5404input\u306b<\/p>\n<p><pre class=\"brush: plain; title: ; notranslate\" title=\"\"> value=&quot;&lt;?php echo htmlspecialchars($_POST&#x5B;'name'], ENT_QUOTES,'UTF-8'); ?&gt;<\/pre>\n<\/p>\n<p>\u3068\u3001value\u306e\u5024\u3092\u4ed8\u4e0e\u3059\u308b\u4e8b\u306b\u3088\u3063\u3066\u3001\u5165\u529b\u3055\u308c\u305f\u60c5\u5831\u3092\u6d88\u3055\u305a\u306b\u4fdd\u3064\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u3002<\/p>\n<p>\uff08$_POST[&#8216;name&#8217;]\u306f\u305d\u308c\u305e\u308c\u306e\u5024\uff08&#8217;email&#8217;,&#8217;password&#8217;\uff09\u306b\u5909\u66f4\u3057\u307e\u3059\u3002\uff09<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f1a\u54e1\u767b\u9332\u30d5\u30a9\u30fc\u30e0\u3067\u3088\u304f\u3042\u308b\u3001\u300c\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u300d\u8868\u793a\u306b\u3064\u3044\u3066\u3067\u3059\u3002 \u30a8\u30e9\u30fc\u304c\u306a\u3051\u308c\u3070\u3001\u767b\u9332\u5185\u5bb9\u78ba\u8a8d\u306e\u753b\u9762\u3078\u3068\u9077\u79fb\u3055\u305b\u307e\u3059\u3002 \u767b\u9332\u5185\u5bb9\u304c\u300c\u30cb\u30c3\u30af\u30cd\u30fc\u30e0\u300d\u300c\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u300d\u300c\u30d1\u30b9\u30ef\u30fc\u30c9\u300d\u304c\u3042\u3063\u305f\u5834\u5408\u3001 HTML &lt;fo [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[173],"class_list":["post-954","post","type-post","status-publish","format-standard","hentry","category-php","tag-php"],"_links":{"self":[{"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/posts\/954","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=954"}],"version-history":[{"count":8,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/posts\/954\/revisions"}],"predecessor-version":[{"id":4232,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/posts\/954\/revisions\/4232"}],"wp:attachment":[{"href":"https:\/\/www.webcyou.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=954"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=954"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=954"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}