{"id":4491,"date":"2013-03-31T03:07:10","date_gmt":"2013-03-30T18:07:10","guid":{"rendered":"http:\/\/www.webcyou.com\/?p=4491"},"modified":"2020-03-20T18:03:21","modified_gmt":"2020-03-20T09:03:21","slug":"php-%e4%bc%9a%e5%93%a1%e5%88%b6%e3%82%b5%e3%82%a4%e3%83%88%e3%81%ae%e5%88%b6%e4%bd%9c%e6%96%b9%e6%b3%95-%e3%81%9d%e3%81%ae2","status":"publish","type":"post","link":"https:\/\/www.webcyou.com\/?p=4491","title":{"rendered":"PHP \u4f1a\u54e1\u5236\u30b5\u30a4\u30c8\u306e\u5236\u4f5c\u65b9\u6cd5 \u305d\u306e2"},"content":{"rendered":"<p>\u524d\u56de\u306e<\/p>\n<h3><a href=\"https:\/\/www.webcyou.com\/?p=4455\">PHP \u4f1a\u54e1\u5236\u30b5\u30a4\u30c8\u306e\u5236\u4f5c\u65b9\u6cd5<\/a><\/h3>\n<p>\u306e\u7d9a\u304d\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u6e96\u5099\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u3068\u3057\u3066\u3001<\/p>\n<p><strong>db.php \uff1a\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u63a5\u7d9a\u8a2d\u5b9a<\/strong><\/p>\n<p><strong>email_form.php\uff1aemail\u767b\u9332\u7528\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8<\/strong><\/p>\n<p><strong>email_regist.php\uff1a\u30e6\u30fc\u30b6\u306e\u4eee\u767b\u9332\u3068\u767b\u9332\u30da\u30fc\u30b8URL\u306e\u9001\u4fe1\u7528\u30d5\u30a1\u30a4\u30eb<\/strong><\/p>\n<p><strong>regist_form.php\uff1a\u4eee\u767b\u9332\u306e\u30c1\u30a7\u30c3\u30af\u3068\u4f1a\u54e1\u767b\u9332\u30d5\u30a9\u30fc\u30e0\u30d5\u30a1\u30a4\u30eb<\/strong><\/p>\n<p><strong>regist_confirm.php\uff1a\u4f1a\u54e1\u767b\u9332\u5185\u5bb9\u78ba\u8a8d\u753b\u9762\u30d5\u30a1\u30a4\u30eb<\/strong><\/p>\n<p><strong>user_regist.php\uff1a\u4f1a\u54e1\u767b\u9332\u3068\u767b\u9332\u5185\u5bb9\u9001\u4fe1\u30d5\u30a1\u30a4\u30eb<\/strong><\/p>\n<p><strong>index.php\uff1a\u30e6\u30fc\u30b6\u30fc\u767b\u9332\u51e6\u7406\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u30da\u30fc\u30b8<\/strong><\/p>\n<p>\u3068\u30ea\u30b9\u30c8\u30a2\u30c3\u30d7\u3057\u305f\u306e\u3067\u3059\u304c\u3001\u524d\u56de\u3067<\/p>\n<p><strong>db.php \uff1a\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u63a5\u7d9a\u8a2d\u5b9a<\/strong><\/p>\n<p><strong>email_form.php\uff1aemail\u767b\u9332\u7528\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8<\/strong><\/p>\n<p><strong>email_regist.php\uff1a\u30e6\u30fc\u30b6\u306e\u4eee\u767b\u9332\u3068\u767b\u9332\u30da\u30fc\u30b8URL\u306e\u9001\u4fe1\u7528\u30d5\u30a1\u30a4\u30eb<\/strong><\/p>\n<p>\u307e\u3067\u4f5c\u6210\u81f4\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u4eca\u56de\u306f\u00a0<strong>regist_form.php\uff1a\u4eee\u767b\u9332\u306e\u30c1\u30a7\u30c3\u30af\u3068\u4f1a\u54e1\u767b\u9332\u30d5\u30a9\u30fc\u30e0\u30d5\u30a1\u30a4\u30eb<\/strong>\u304b\u3089\u7d9a\u3051\u3066\u5236\u4f5c\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<h4>regist_form.php\uff1a\u4eee\u767b\u9332\u306e\u30c1\u30a7\u30c3\u30af\u3068\u4f1a\u54e1\u767b\u9332\u30d5\u30a9\u30fc\u30e0\u30d5\u30a1\u30a4\u30eb<\/h4>\n<p>\u3053\u3053\u3067\u884c\u3046\u51e6\u7406\u306f\u3001\u30e6\u30fc\u30b6\u30fc\u304c\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3092\u767b\u9332\u3057\u4eeeID\u3092\u767a\u884c\u3057\u30e1\u30fc\u30eb\u3092\u914d\u4fe1\u3001\u30e1\u30fc\u30eb\u306b\u8a18\u8f09\u3055\u308c\u305fURL\u3092\u958b\u3044\u305f\u3068\u304d\u306e\u51e6\u7406\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">?pre_userid=570515712c7447b2<\/pre>\n<p>\u3053\u306e\u3088\u3046\u306b\u3001\u30e6\u30fc\u30b6\u30fc\u306furl\u306bpre_userid\u306e\u5024\u304c\u4ed8\u4e0e\u3055\u308c\u305furl\u3092\u958b\u304f\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u5024\u3092\u3082\u3068\u306b\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u683c\u7d0d\u3055\u308c\u3066\u3044\u308bpre_userid\u306e\u5024\u3068\u7167\u3089\u3057\u5408\u308f\u305b\u3001\u30da\u30fc\u30b8\u3092\u8868\u793a\u3055\u305b\u307e\u3059\u3002<\/p>\n<p>\u30da\u30fc\u30b8\u306e\u30a4\u30e1\u30fc\u30b8\u3068\u3057\u3066\u306f\u3053\u306e\u3088\u3046\u306a\u611f\u3058\u3067\u3059\u3002<\/p>\n<p><a href=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/mailform.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-4493\" title=\"mailform\" src=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/mailform.jpg\" width=\"577\" height=\"223\" srcset=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/mailform.jpg 641w, https:\/\/www.webcyou.com\/wp-content\/uploads\/mailform-300x116.jpg 300w\" sizes=\"auto, (max-width: 577px) 100vw, 577px\" \/><\/a><\/p>\n<p>\u305d\u308c\u3067\u306f\u3001\u65e9\u901f\u30d5\u30a1\u30a4\u30eb\u306e\u30bd\u30fc\u30b9\u3092<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">&lt;?php\r\n\/*pre_userid\u306e\u5024\u3092\u53d6\u5f97*\/\r\nif($mode == &quot;regist_form&quot;) {\r\n  $pre_userid = $_GET&amp;#91;'pre_userid'&amp;#93;;\r\n}\r\n\r\n\/* pre_userid \u6709\u52b9\u30c1\u30a7\u30c3\u30af *\/\r\n$errorFlag = true;\r\n\r\n\/* \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u63a5\u7d9a\u8a2d\u5b9a *\/\r\nrequire_once(&quot;db.php&quot;);\r\n\r\n\/* \u53d6\u5f97\u3057\u305f\u30e6\u30cb\u30fc\u30afID\u3092\u30ad\u30fc\u306b\u767b\u9332\u3055\u308c\u305f\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3092\u53d6\u5f97 *\/\r\n$query = &quot;select email from members where pre_userid = '$pre_userid'&quot;;\r\n$result = mysql_query($query);\r\n\r\n\/*\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3088\u308a\u53d6\u5f97\u3057\u305f\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3092\u8868\u793a*\/\r\nif(mysql_num_rows($result) &gt; 0) { \/\/\u53d6\u5f97\u3057\u305f\u7d50\u679c\u306e\u30c7\u30fc\u30bf\u306e\u6570\u304c0\u4ee5\u4e0a\u306a\u3089 \u2192 \u30c7\u30fc\u30bf\u304c\u53d6\u5f97\u3067\u304d\u305f\r\n  \/\/\u30c7\u30fc\u30bf\u304c\u6b63\u5e38\u306b\u53d6\u5f97\u3067\u304d\u305f\r\n  $errorFlag = false;\r\n  $data = mysql_fetch_array($result); \r\n  $email = $data&#x5B;'email'];\r\n}\r\n\r\nif($errorFlag) {  \/\/ pre_userid\u304c\u7121\u52b9\r\n?&gt;\r\n&lt;table&gt;\r\n  &lt;caption&gt;\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u767b\u9332\u30a8\u30e9\u30fc&lt;\/caption&gt;\r\n  &lt;tr&gt;\r\n    &lt;td class=&quot;item&quot;&gt;Error\uff1a&lt;\/td&gt;\r\n    &lt;td&gt;\u3053\u306eURL\u306f\u5229\u7528\u3067\u304d\u307e\u305b\u3093\u3002&lt;br&gt;\u3082\u3046\u4e00\u5ea6\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u306e\u767b\u9332\u304b\u3089\u304a\u9858\u3044\u3057\u307e\u3059\u3002&lt;br&gt; &lt;a href=&quot;index.php&quot;&gt;\u4f1a\u54e1\u767b\u9332\u30da\u30fc\u30b8&lt;\/a&gt;&lt;\/td&gt;\r\n  &lt;\/tr&gt;\r\n&lt;\/table&gt;\r\n&lt;?php\r\n} else { \/\/ pre_userid\u304c\u6709\u52b9\r\n\t\/\/ regist_confirm\u3067\u306e\u30a8\u30e9\u30fc\u8868\u793a\r\n  if(count($error) &gt; 0) {\r\n    foreach($error as $value) {\r\n\t  print $value.&quot;&lt;br&gt;&quot;;\r\n    }\r\n  }\r\n?&gt;\r\n&lt;form method=&quot;post&quot; action=&quot;index.php&quot;&gt;\r\n  &lt;input type=&quot;hidden&quot; name=&quot;mode&quot; value=&quot;regist_confirm&quot;&gt;\r\n  &lt;input type=&quot;hidden&quot; name=&quot;pre_userid&quot; value=&quot;&lt;?php print $pre_userid; ?&gt;&quot;&gt;\r\n  &lt;table&gt;\r\n    &lt;caption&gt;\u4f1a\u54e1\u60c5\u5831\u767b\u9332\u30d5\u30a9\u30fc\u30e0&lt;\/caption&gt;\r\n    &lt;tr&gt;\r\n      &lt;td class=&quot;item&quot;&gt;\u30e6\u30fc\u30b6\u30fc\u540d\uff1a&lt;\/td&gt;\r\n      &lt;td&gt;&lt;input type=&quot;text&quot; size=&quot;30&quot; name=&quot;input_userid&quot; value=&quot;&lt;?php print $input_userid; ?&gt;&quot;&gt;&lt;\/td&gt;\r\n    &lt;\/tr&gt;\r\n    &lt;tr&gt;\r\n      &lt;td class=&quot;item&quot;&gt;\u30d1\u30b9\u30ef\u30fc\u30c9\uff1a&lt;\/td&gt;\r\n      &lt;td&gt;&lt;input type=&quot;text&quot; size=&quot;30&quot; name=&quot;input_password&quot; value=&quot;&lt;?php print $input_password; ?&gt;&quot;&gt;&amp;nbsp;&amp;nbsp;\u203b 6\u6587\u5b57\u4ee5\u4e0a16\u6587\u5b57\u4ee5\u4e0b&lt;\/td&gt;\r\n    &lt;\/tr&gt;\r\n    &lt;tr&gt;\r\n      &lt;td class=&quot;item&quot;&gt;\u540d\u524d\uff1a&lt;\/td&gt;\r\n      &lt;td&gt;&lt;input type=&quot;text&quot; size=&quot;30&quot; name=&quot;input_name&quot; value=&quot;&lt;?php print $input_name; ?&gt;&quot;&gt;&lt;\/td&gt;\r\n    &lt;\/tr&gt;\r\n    &lt;tr&gt;\r\n      &lt;td class=&quot;item&quot;&gt;E-mail\uff1a&lt;\/td&gt;\r\n      &lt;td&gt;&lt;?php print $email; ?&gt;&lt;input type=&quot;hidden&quot; name=&quot;input_email&quot; value=&quot;&lt;?php print $email; ?&gt;&quot;&gt;&lt;\/td&gt;\r\n    &lt;\/tr&gt;\r\n  &lt;\/table&gt;\r\n  &lt;div&gt;&lt;input type=&quot;submit&quot; value=&quot; \u9001 \u4fe1 &quot;&gt;&lt;\/div&gt;\r\n&lt;\/form&gt;\r\n&lt;?php\r\n}\r\n?&gt;<\/pre>\n<p>\u3068\u306a\u3063\u3066\u304a\u308a\u307e\u3059\u3002<\/p>\n<p>\u305d\u308c\u3067\u306f\u89e3\u8aac\u3092\u3001\u307e\u305a\u00a0if($mode == &#8220;regist_form&#8221;) { \u3053\u3061\u3089\u3067\u3059\u304c\u3001index.php\u306b\u3066\u3001pre_userid\u306e\u5024\u304c\u53d6\u5f97\u3067\u304d\u308c\u3070\u3001$mode\u306fregist_form\u306b\u5207\u308a\u66ff\u3048\u51e6\u7406\u3092\u884c\u3046\u4e88\u5b9a\u3067\u3059\u306e\u3067\u3001mode\u306fregist_form\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$pre_userid = $_GET&#x5B;'pre_userid'];<\/pre>\n<p>url\u304b\u3089pre_userid\u3092GET\u3067\u53d7\u3051\u53d6\u308a\u3001\u5909\u6570$pre_userid\u306b\u4ee3\u5165\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$errorFlag = true;<\/pre>\n<p>\u4e00\u65e6\u306f\u30a8\u30e9\u30fc\u306e\u30d5\u30e9\u30b0\u3092true\u306b\u8a2d\u5b9a\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$query = \"select email from members where pre_userid = '$pre_userid'\";\r\n$result = mysql_query($query);<\/pre>\n<p>query\u6587\u306e\u767a\u884c\u3092\u884c\u3044\u307e\u3059\u3002select\u6587\u3067members\u306e\u30ab\u30e9\u30e0\u304b\u3089\u5148\u307b\u3069\u53d7\u3051\u53d6\u3063\u305fpre_userid\u306e\u5024\u3092\u6761\u4ef6\u306b\u691c\u7d22\u3057\u3001email\u306e\u5024\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">if(mysql_num_rows($result) &gt; 0) {\u00a0\r\n  $errorFlag = false;\r\n  $data = mysql_fetch_array($result);\r\n  $email = $data&#x5B;'email'];\r\n}<\/pre>\n<p>\u53d6\u5f97\u3057\u305f\u30c7\u30fc\u30bf\u304c0\u4ee5\u4e0a\u3042\u308b\u5834\u5408\u6210\u529f\u3068\u306a\u308a\u307e\u3059\u306e\u3067\u3001\u305d\u306e\u5f8c\u306e\u51e6\u7406\u3092\u3002<\/p>\n<p>$errorFlag = false; \u30a8\u30e9\u30fc\u30d5\u30e9\u30b0\u3092false\u306b\u3057\u3001mysql_fetch_array\u3067\u9023\u60f3\u914d\u5217\u3068\u3057\u3066email\u306e\u5024\u3092\u53d6\u5f97\u3057\u3001\u5909\u6570$email\u306bemail\u306e\u5024\u3092\u4ee3\u5165\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">if($errorFlag) { <\/pre>\n<p>\u3053\u3053\u304b\u3089\u306f\u30a8\u30e9\u30fc\u304c\u5b58\u5728\u3059\u308b\u5834\u5408\u3001\uff08errorFlag\u304ctrue\u306e\u5834\u5408\uff09\u306e\u51e6\u7406\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u30a8\u30e9\u30fc\u3092\u4fc3\u3059\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u8868\u793a\u3055\u305b\u308bhtml\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>pre_userid\u304c\u7121\u52b9\u306e\u5834\u5408\u306f\u3001\u305d\u308c\u3092\u4fc3\u3059\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u306e\u8868\u793a\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n<p>\u30a4\u30e1\u30fc\u30b8\u3068\u3057\u3066\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u611f\u3058\u3067\u3059\u3002<\/p>\n<p><a href=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/4c55f00582d5ae25a0ec6f0b213e9590.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-4494\" title=\"\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8 2013-03-31 1.35.54\" src=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/4c55f00582d5ae25a0ec6f0b213e9590.png\" width=\"567\" height=\"125\" srcset=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/4c55f00582d5ae25a0ec6f0b213e9590.png 630w, https:\/\/www.webcyou.com\/wp-content\/uploads\/4c55f00582d5ae25a0ec6f0b213e9590-300x66.png 300w\" sizes=\"auto, (max-width: 567px) 100vw, 567px\" \/><\/a><\/p>\n<p>\u305d\u308c\u4ee5\u4e0b\u306e\u89e3\u8aac\u3092\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n} else {\u00a0\r\n if(count($error) &gt; 0) {\r\n   foreach($error as $value) {\r\n   print $value.&quot;&lt;br&gt;&quot;;\r\n }\r\n}<\/pre>\n<p>\u3053\u306e\u90e8\u5206\u306f\u3001regist_confirm.php\u3067form\u306e\u5165\u529b\u306b\u95a2\u3059\u308b\u30d0\u30ea\u30c7\u30fc\u30c8\u3092\u8efd\u304f\u884c\u3046\u4e88\u5b9a\u3067\u3059\u306e\u3067\u3001\u305d\u306e\u969b\u306ecount\u95a2\u6570\u306b\u3066\u30a8\u30e9\u30fc\u3092\u6570\u3092\u30ab\u30a6\u30f3\u30c8\u3057\u3001\u30a8\u30e9\u30fc\u5185\u5bb9\u3092\u8868\u793a\u3055\u305b\u307e\u3059\u3002<\/p>\n<p>\u30a4\u30e1\u30fc\u30b8\u3068\u3057\u3066\u306f\u4ee5\u4e0b\u306e\u69d8\u306a\u611f\u3058\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/mailform002.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-4495\" title=\"mailform002\" src=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/mailform002.jpg\" width=\"576\" height=\"272\" srcset=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/mailform002.jpg 640w, https:\/\/www.webcyou.com\/wp-content\/uploads\/mailform002-300x141.jpg 300w\" sizes=\"auto, (max-width: 576px) 100vw, 576px\" \/><\/a><\/p>\n<p>\u305d\u308c\u4ee5\u4e0b\u306ehtml\u306f\u6210\u529f\u3057\u305f\u5834\u5408\u306b\u8868\u793a\u3055\u305b\u308b\u5165\u529b\u9805\u76ee\u3068\u306a\u3063\u3066\u304a\u308a\u307e\u3059\u3002<\/p>\n<p>\u30e6\u30fc\u30b6\u30fc\u540d\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u3001\u540d\u524d\u3001E-mail\u3068\u306a\u3063\u3066\u304a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">&lt;input type=&quot;hidden&quot; name=&quot;mode&quot; value=&quot;regist_confirm&quot;&gt;\r\n&lt;input type=&quot;hidden&quot; name=&quot;pre_userid&quot; value=&quot;&lt;?php print $pre_userid; ?&gt;&quot;&gt;<\/pre>\n<p>\u3053\u306einput\u306fsubmit\u3055\u308c\u305f\u969b\u3001mode\u3092regist_confirm\u3001pre_userid\u3092\u53d7\u3051\u53d6\u3063\u305f$pre_userid;\u306e\u5024\u3092\u9001\u308b\u305f\u3081\u306einput\u3067\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">&lt;td&gt;&lt;input type=&quot;text&quot; size=&quot;30&quot; name=&quot;input_userid&quot; value=&quot;&lt;?php print $input_userid; ?&gt;&quot;&gt;&lt;\/td&gt;<\/pre>\n<p>\u305d\u308c\u305e\u308c\u306einput\u8981\u7d20\u306evalue\u306b\u306f\u5404\u5024\u306e\u5909\u6570\u3092print\u3059\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u304a\u308a\u307e\u3059\u304c\u3001\u3053\u308c\u306f\u3001regist_form\u2192 regist_confirm<\/p>\n<p>regist_confirm\u00a0\u2192 regist_form\u3068\u51e6\u7406\u3092\u3084\u308a\u53d6\u308a\u3059\u308b\u969b\u306b\u5165\u529b\u3055\u308c\u305f\u6642\u306e\u6587\u5b57\u3092\u6b8b\u3057\u3066\u304a\u304f\u305f\u3081\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<h4>regist_confirm.php\uff1a\u4f1a\u54e1\u767b\u9332\u5185\u5bb9\u78ba\u8a8d\u753b\u9762\u30d5\u30a1\u30a4\u30eb<\/h4>\n<p>\u3053\u3053\u307e\u3067\u306e\u6d41\u308c\u3068\u3057\u3066\u3001<\/p>\n<p><strong>\uff11\uff0e\u30e6\u30fc\u30b6\u30fc\u304c\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3092\u767b\u9332\u3002<\/strong><\/p>\n<p><strong>\uff12\uff0e\u4eee\u30e6\u30fc\u30b6\u30fc\uff29\uff24\u767a\u884c\u767b\u9332\u5148\u306e\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u306b\u9001\u4fe1\u3002<\/strong><\/p>\n<p><strong>\uff13\uff0e\u30e1\u30fc\u30eb\u306eURL\u3092\u8868\u793a\u3001\u672c\u767b\u9332\u306eform\u306e\u30da\u30fc\u30b8\u8868\u793a\u3002<\/strong><\/p>\n<p><strong>\uff14\uff0e\u672c\u767b\u9332\u7528\u306e\u60c5\u5831\u5165\u529b\u5b8c\u4e86\u3002<\/strong><\/p>\n<p>\u306e\u5f8c\u306e\u51e6\u7406\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>regist_confirm\u3067\u306f\u3001regist_form\u3067\u5165\u529b\u3055\u308c\u305f\u60c5\u5831\u3092\u5143\u306b\u51e6\u7406\u3092\u884c\u3063\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u65e9\u901f\u30bd\u30fc\u30b9\u306e\u65b9\u3092<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">&lt;?php\r\n\/* \u5165\u529b\u30d5\u30a9\u30fc\u30e0\u304b\u3089\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u53d6\u5f97 *\/\r\n$formList = array('mode','pre_userid','input_userid','input_password','input_name','input_email');\r\n\r\n\/* \u5fc5\u9808\u9805\u76ee *\/\r\n$requireList = array('mode','input_userid','input_password','input_name');\r\n\r\n\/* \u30dd\u30b9\u30c8\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3057\u30d1\u30e9\u30e1\u30fc\u30bf\u3068\u540c\u540d\u306e\u5909\u6570\u306b\u683c\u7d0d *\/\r\nforeach($formList as $value) {\r\n  $$value = $_POST&amp;#91;$value&amp;#93;;\r\n}\r\n\r\n\/* \u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u306e\u521d\u671f\u5316 *\/\r\n$error = array();\r\n\r\n\/* \u5fc5\u9808\u9805\u76ee\u5165\u529b\u30c1\u30a7\u30c3\u30af *\/\r\nforeach($requireList as $value) {\r\n  if($$value == &quot;&quot;) {\r\n    array_push($error,&quot;\u5165\u529b\u3055\u308c\u3066\u3044\u306a\u3044\u9805\u76ee\u304c\u3042\u308a\u307e\u3059\u3002&quot;);\r\n    break;\r\n  }\r\n}\r\n\r\n\/* \u30d1\u30b9\u30ef\u30fc\u30c9\u30c1\u30a7\u30c3\u30af *\/\r\nif(strlen($input_password) &lt; 6 || strlen($input_password) &gt; 16) {\r\n  array_push($error,&quot;\u30d1\u30b9\u30ef\u30fc\u30c9\u306f6\u6587\u5b57\u4ee5\u4e0a16\u6587\u5b57\u4ee5\u5185\u3067\u304a\u9858\u3044\u3057\u307e\u3059\u3002&quot;);\r\n}\r\n?&gt;\r\n&lt;div class=&quot;error-msg&quot;&gt;\r\n&lt;?php\r\n\/* \u30a8\u30e9\u30fc \u5165\u529b\u30d5\u30a9\u30fc\u30e0\u8868\u793a $error *\/\r\nif(count($error) &gt; 0) {\r\n  require_once(&quot;regist_form.php&quot;);\r\n?&gt;\t\r\n&lt;\/div&gt;\r\n&lt;?php\r\n} else {\r\n?&gt;\r\n&lt;form method=&quot;post&quot; action=&quot;index.php&quot;&gt;\r\n  &lt;input type=&quot;hidden&quot; name=&quot;mode&quot; value=&quot;user_regist&quot;&gt;\r\n  &lt;table&gt;\r\n    &lt;caption&gt;\u5165\u529b\u60c5\u5831\u78ba\u8a8d\u30da\u30fc\u30b8&lt;\/caption&gt;\r\n    &lt;tr&gt;\r\n      &lt;td class=&quot;item&quot;&gt;\u30e6\u30fc\u30b6\u30fc\u540d\uff1a&lt;\/td&gt;\r\n      &lt;td&gt;&lt;?php print $input_userid;?&gt;&lt;input type=&quot;hidden&quot; name=&quot;input_userid&quot; value=&quot;&lt;?php print $input_userid;?&gt;&quot;&gt;&lt;\/td&gt;\r\n    &lt;\/tr&gt;\r\n    &lt;tr&gt;\r\n      &lt;td class=&quot;item&quot;&gt;\u30d1\u30b9\u30ef\u30fc\u30c9\uff1a&lt;\/td&gt;\r\n      &lt;td&gt;&lt;?php print $input_password;?&gt;&lt;input type=&quot;hidden&quot; name=&quot;input_password&quot; value=&quot;&lt;?php print $input_password;?&gt;&quot;&gt;&lt;\/td&gt;\r\n    &lt;\/tr&gt;\r\n    &lt;tr&gt;\r\n      &lt;td class=&quot;item&quot;&gt;\u540d\u524d\uff1a&lt;\/td&gt;\r\n      &lt;td&gt;&lt;?php print $input_name;?&gt;&lt;input type=&quot;hidden&quot; name=&quot;input_name&quot; value=&quot;&lt;?php print $input_name;?&gt;&quot;&gt;&lt;\/td&gt;\r\n    &lt;\/tr&gt;\r\n    &lt;tr&gt;\r\n      &lt;td class=&quot;item&quot;&gt;\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\uff1a&lt;\/td&gt;\r\n      &lt;td&gt;&lt;?php print $input_email;?&gt;&lt;input type=&quot;hidden&quot; name=&quot;input_email&quot; value=&quot;&lt;?php print $input_email;?&gt;&quot;&gt;&lt;\/td&gt;\r\n    &lt;\/tr&gt;\r\n  &lt;\/table&gt;\r\n  &lt;div&gt;&lt;input type=&quot;submit&quot; value=&quot; \u767b \u9332 &quot;&gt;&lt;\/div&gt;\r\n&lt;\/form&gt;\r\n&lt;?php\r\n}\r\n?&gt;<\/pre>\n<p>\u305d\u308c\u3067\u306f\u9806\u3092\u8ffd\u3063\u3066\u89e3\u8aac\u3092\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$formList = array('mode','pre_userid','input_userid','input_password','input_name','input_email');<\/pre>\n<p>regist_form\u3067\u5165\u529b\u3055\u308c\u305f\u60c5\u5831\u3092\u5909\u6570$formList\u306b\u683c\u7d0d\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$requireList = array('mode','input_userid','input_password','input_name');<\/pre>\n<p>\u3053\u3061\u3089\u306f\u5fc5\u9808\u9805\u76ee\u3068\u3057\u3066\u5909\u6570 $requireList \u306b\u8a72\u5f53\u9805\u76ee\u3092\u914d\u5217\u3067\u4ee3\u5165\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">foreach($formList as $value) {\r\n  $$value = $_POST&#x5B;$value];\r\n}<\/pre>\n<p>\u3053\u3053\u306a\u3093\u3067\u3059\u304c\u3001$$\u3068\u7d9a\u304d\u3001\u5165\u529b\u30df\u30b9\u307d\u3044\u306e\u3067\u3059\u304c\u3001regist_form\u304b\u3089POST\u3067\u53d7\u3051\u53d6\u3063\u305f\u305d\u308c\u305e\u308c\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\uff08$formList as $value\uff09\u3068\u540c\u540d\u306e\u5909\u6570\u3092\u4f5c\u6210\u3057\u3001\u305d\u308c\u305e\u308c\u4ee3\u5165\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$error = array();<\/pre>\n<p>\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u306e\u521d\u671f\u5316<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">foreach($requireList as $value) {\r\n  if($$value == \"\") {\r\n    array_push($error,\"\u5165\u529b\u3055\u308c\u3066\u3044\u306a\u3044\u9805\u76ee\u304c\u3042\u308a\u307e\u3059\u3002\");\r\n    break;\r\n  }\r\n}<\/pre>\n<p>\u3053\u3053\u306f\u5fc5\u9808\u9805\u76ee\u3068\u3057\u3066 $requireList\u306b\u8a2d\u5b9a\u3057\u305f\u6570\u3060\u3051foreach\u3067\u30eb\u30fc\u30d7\u3055\u305b\u3001$$value\u3067\u5404\u30d1\u30e9\u30e1\u30fc\u30bf\u540c\u69d8\u306e\u5909\u6570\u306e\u5024\u304c\u7a7a\u3067\u306f\u306a\u3044\u304b\u3092\u8abf\u3079\u3001\u7a7a\u306e\u5834\u5408\u306f $error\u306b\u4ee3\u5165\u3057\u3066\u304a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">if(strlen($input_password) &lt; 6 || strlen($input_password) &gt; 16) {\r\n  array_push($error,&quot;\u30d1\u30b9\u30ef\u30fc\u30c9\u306f6\u6587\u5b57\u4ee5\u4e0a16\u6587\u5b57\u4ee5\u5185\u3067\u304a\u9858\u3044\u3057\u307e\u3059\u3002&quot;);\r\n}<\/pre>\n<p>strlen\u95a2\u6570\u3067\u6587\u5b57\u5217\u306e\u9577\u3055\u3092\u8abf\u3079\u3066\u304a\u308a\u307e\u3059\u30026\u6587\u5b57\u4ee5\u4e0a16\u6587\u5b57\u4ee5\u5185\u306b\u53ce\u307e\u3089\u306a\u3044\u5834\u5408\u306f\u5909\u6570$error\u306b\u4ee3\u5165\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">&lt;div class=&quot;error-msg&quot;&gt;\r\n&lt;?php\r\nif(count($error) &gt; 0) {\r\n  require_once(&quot;regist_form.php&quot;);\r\n?&gt;\t\r\n&lt;\/div&gt;<\/pre>\n<p>\u3053\u3053\u3067\u30a8\u30e9\u30fc\u304c\u5b58\u5728\u3059\u308b\u5834\u5408\u306f\u3001regist_form.php\u3092\u547c\u3073\u51fa\u3057\u307e\u3059\u3002<\/p>\n<p>\u30a8\u30e9\u30fc\u5185\u5bb9\u304c\u8868\u793a\u3057\u3001regist_form.php\u306e\u30d5\u30a9\u30fc\u30e0\u304c\u8868\u793a\u3057\u307e\u3059\u3002<\/p>\n<p>regist_form\u306einput\u00a0value\u306b\u5404\u5024\u306e\u5909\u6570\u3092print\u3059\u308b\u3088\u3046\u306b\u8a2d\u5b9a\u3057\u3066\u3044\u307e\u3057\u305f\u306e\u3067\u3001\u5165\u529b\u306e\u3042\u308b\u30d5\u30a9\u30fc\u30e0\u306b\u95a2\u3057\u3066\u306f\u305d\u306e\u307e\u307e\u8868\u793a\u3057\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/mailform002.jpg\"><img loading=\"lazy\" decoding=\"async\" title=\"mailform002\" src=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/mailform002.jpg\" width=\"576\" height=\"272\" \/><\/a><\/p>\n<p>\u305d\u308c\u3088\u308a\u4ee5\u4e0b\u306f\u554f\u984c\u306e\u306a\u3044\u5834\u5408\u306b\u8868\u793a\u3059\u308b\u78ba\u8a8d\u7528\u306eform\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">&lt;td&gt;&lt;?php print $input_userid;?&gt;&lt;input type=&quot;hidden&quot; name=&quot;input_userid&quot; value=&quot;&lt;?php print $input_userid;?&gt;&quot;&gt;&lt;\/td&gt;<\/pre>\n<p>\u9001\u4fe1\u30dc\u30bf\u30f3\u3092\u304a\u3055\u308c\u305f\u969b\u3001input type=&#8221;hidden&#8221;\u306e\u5404\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u9001\u4fe1\u3059\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">&lt;input type=&quot;hidden&quot; name=&quot;mode&quot; value=&quot;user_regist&quot;&gt;<\/pre>\n<p>mode\u306f\u6b21\u306e\u30d5\u30a7\u30fc\u30ba\u306euser_regist\u3068\u306a\u308b\u70ba\u3001\u5207\u308a\u66ff\u3048\u7528\u306einput\u3082\u7528\u610f\u3057\u307e\u3059\u3002<\/p>\n<p>\u3068\u3001\u3053\u3053\u307e\u3067\u304c<\/p>\n<p><strong>regist_form.php\uff1a\u4eee\u767b\u9332\u306e\u30c1\u30a7\u30c3\u30af\u3068\u4f1a\u54e1\u767b\u9332\u30d5\u30a9\u30fc\u30e0\u30d5\u30a1\u30a4\u30eb<\/strong><\/p>\n<p><strong>regist_confirm.php\uff1a\u4f1a\u54e1\u767b\u9332\u5185\u5bb9\u78ba\u8a8d\u753b\u9762\u30d5\u30a1\u30a4\u30eb<\/strong><\/p>\n<p>\u306e\u6d41\u308c\u3067\u3057\u305f\u3002<\/p>\n<p>\u6b21\u56de\u306f\u3001<\/p>\n<p><strong>user_regist.php\uff1a\u4f1a\u54e1\u767b\u9332\u3068\u767b\u9332\u5185\u5bb9\u9001\u4fe1\u30d5\u30a1\u30a4\u30eb<\/strong><\/p>\n<p><strong>index.php\uff1a\u30e6\u30fc\u30b6\u30fc\u767b\u9332\u51e6\u7406\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u30da\u30fc\u30b8<\/strong><\/p>\n<p>\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306f\u3053\u3053\u307e\u3067\u3002\u7d9a\u304d\u306f\u4ee5\u4e0b\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/www.webcyou.com\/?p=4501\">PHP \u4f1a\u54e1\u5236\u30b5\u30a4\u30c8\u306e\u5236\u4f5c\u65b9\u6cd5 \u305d\u306e3<\/a><\/p>\n<p>\u3067\u306f\u3067\u306f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u56de\u306e PHP \u4f1a\u54e1\u5236\u30b5\u30a4\u30c8\u306e\u5236\u4f5c\u65b9\u6cd5 \u306e\u7d9a\u304d\u3068\u306a\u308a\u307e\u3059\u3002 \u6e96\u5099\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u3068\u3057\u3066\u3001 db.php \uff1a\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u63a5\u7d9a\u8a2d\u5b9a email_form.php\uff1aemail\u767b\u9332\u7528\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8 email_regist.php\uff1a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[107,180,173,44,45],"class_list":["post-4491","post","type-post","status-publish","format-standard","hentry","category-php","tag-mamp","tag-mysql","tag-php","tag-web"],"_links":{"self":[{"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/posts\/4491","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=4491"}],"version-history":[{"count":6,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/posts\/4491\/revisions"}],"predecessor-version":[{"id":10177,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/posts\/4491\/revisions\/10177"}],"wp:attachment":[{"href":"https:\/\/www.webcyou.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4491"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4491"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4491"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}