{"id":2347,"date":"2014-10-06T21:14:21","date_gmt":"2014-10-06T12:14:21","guid":{"rendered":"http:\/\/www.happyfam.or.kr\/ysoh\/?p=2347"},"modified":"2016-06-13T10:14:42","modified_gmt":"2016-06-13T01:14:42","slug":"webdbii-%ec%8b%a4%ec%8a%b5%ec%98%88%ec%a0%9c-%ec%86%8c%ec%8a%a4-7","status":"publish","type":"post","link":"https:\/\/www.happyfam.or.kr\/ysoh\/webdbii-%ec%8b%a4%ec%8a%b5%ec%98%88%ec%a0%9c-%ec%86%8c%ec%8a%a4-7\/","title":{"rendered":"WebDB(II) \uc2e4\uc2b5\uc608\uc81c \uc18c\uc2a4 #7"},"content":{"rendered":"<pre class=\"wrap:true lang:default decode:true\" title=\"examSQL-18.php\">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n    &lt;head&gt;\r\n        &lt;meta charset=\"UTF-8\"&gt;\r\n        &lt;title&gt;examSQL-18.php&lt;\/title&gt;\r\n        &lt;style&gt;\r\n            .field-name {float:left; width:100px;text-align:right;}\r\n            .field-input input {margin-left: 10px;}\r\n        &lt;\/style&gt;\r\n    &lt;\/head&gt;\r\n    &lt;body&gt;\r\n        &lt;h1&gt;\ub85c\uadf8\uc778&lt;\/h1&gt;\r\n        &lt;form method=\"post\" action=\"examSQL-19.php\"&gt;\r\n            &lt;div class=\"field-name\"&gt;\uc544\uc774\ub514 : &lt;\/div&gt;\r\n            &lt;div class=\"field-input\"&gt;&lt;input type=\"text\" name=\"a\" \/&gt;&lt;\/div&gt;\r\n            &lt;div class=\"field-name\"&gt;\ube44\ubc00\ubc88\ud638 : &lt;\/div&gt;\r\n            &lt;div class=\"field-input\"&gt;&lt;input type=\"password\" name=\"b\" \/&gt;&lt;\/div&gt;\r\n            &lt;div class=\"field-name\"&gt;&amp;nbsp;&lt;\/div&gt;\r\n            &lt;div class=\"field-input\"&gt;&lt;input type=\"submit\" value=\"\ub85c\uadf8\uc778\" \/&gt;&lt;\/div&gt;\r\n        &lt;\/form&gt;\r\n    &lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<pre class=\"wrap:true lang:php decode:true \" title=\"examSQL-19.php\">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n    &lt;head&gt;\r\n        &lt;meta charset=\"UTF-8\"&gt;\r\n        &lt;title&gt;examSQL-19.php&lt;\/title&gt;\r\n    &lt;\/head&gt;\r\n    &lt;body&gt;\r\n        &lt;?php\r\n        require '.\/dbConn.php';\r\n\r\n        $link = mysqli_connect($dbHost, $dbUser, $dbPass); \/\/ MySQL \uc11c\ubc84 \uc5f0\uacb0\r\n        if (!$link) { \/\/ DB\uc5f0\uacb0\uc5d0 \uc2e4\ud328\ud55c \uacbd\uc6b0 ($!link, $link!=true, $link==false \ubaa8\ub450 \ub3d9\uc77c)\r\n            echo \"DB \uc5f0\uacb0\uc5d0 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4.\";\r\n            exit();   \/\/ \ud504\ub85c\uadf8\ub7a8 \uc885\ub8cc\r\n        }\r\n\r\n        $db = mysqli_select_db($link, $dbName); \/\/ Database \uc120\ud0dd\r\n        if (!$db) {  \/\/ DB\uc120\ud0dd\uc5d0 \uc2e4\ud328\ud55c \uacbd\uc6b0 ($!$db, $db!=true, $db==false \ubaa8\ub450 \ub3d9\uc77c)\r\n            echo \"{$dbName} \uc774\ub984\uc758 DB\ub97c \ucc3e\uc744 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4.\";\r\n            exit();  \/\/ \ud504\ub85c\uadf8\ub7a8 \uc885\ub8cc\r\n        }\r\n\r\n        $char = mysqli_set_charset($link, \"utf8\"); \/\/ DB \ubb38\uc790\uc14b \uc124\uc815\r\n        if (!$char) { \/\/ \ubb38\uc790\uc14b \uc124\uc815\uc5d0 \uc2e4\ud328\ud55c \uacbd\uc6b0 ($!$char, $char!=true, $char==false \ubaa8\ub450 \ub3d9\uc77c)\r\n            echo \"UTF-8 \ubb38\uc790\uc14b\uc744 \uc124\uc815\ud558\uc9c0 \ubabb\ud588\uc2b5\ub2c8\ub2e4.\";\r\n            exit();   \/\/ \ud504\ub85c\uadf8\ub7a8 \uc885\ub8cc\r\n        }\r\n\r\n        $sql = \"SELECT `userid` FROM `user` WHERE `userid` = '{$_POST[\"a\"]}' AND `passwd` = '{$_POST[\"b\"]}'\";\r\n        echo $sql;\r\n\r\n        $result = mysqli_query($link, $sql); \/\/ SQL \uc2e4\ud589\r\n        if (!$result) { \/\/ SQL\uc5d0 \uc624\ub958\uac00 \uc788\ub294 \uacbd\uc6b0\r\n            echo \"SQL\uc5d0 \uc624\ub958\uac00 \uc788\uc2b5\ub2c8\ub2e4.\";\r\n            exit();     \/\/ \ud504\ub85c\uadf8\ub7a8 \uc885\ub8cc\r\n        }\r\n\r\n        $num = mysqli_num_rows($result);\r\n        if ($num != 0) {\r\n            echo \"\uc778\uc99d\ub418\uc5c8\uc2b5\ub2c8\ub2e4.\";\r\n        } else {\r\n            echo \"\uc778\uc99d\uc5d0 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4.\";\r\n        }\r\n\r\n        mysqli_close($link); \/\/ MySQL \uc5f0\uacb0 \uc885\ub8cc\r\n        ?&gt;\r\n        &lt;a href=\".\/examSQL-13.php\"&gt;\ubaa9\ub85d\uc73c\ub85c&lt;\/a&gt;\r\n    &lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;meta charset=&#8221;UTF-8&#8243;&gt; &lt;title&gt;examSQL-18.php&lt;\/title&gt; &lt;style&gt; .field-name {float:left; width:100px;text-align:right;} .field-input input {margin-left: 10px;} &lt;\/style&gt; &lt;\/head&gt; &lt;body&gt; &lt;h1&gt;\ub85c\uadf8\uc778&lt;\/h1&gt; &lt;form method=&#8221;post&#8221; action=&#8221;examSQL-19.php&#8221;&gt; &lt;div class=&#8221;field-name&#8221;&gt;\uc544\uc774\ub514 : &lt;\/div&gt; &lt;div class=&#8221;field-input&#8221;&gt;&lt;input type=&#8221;text&#8221; name=&#8221;a&#8221; \/&gt;&lt;\/div&gt; &lt;div class=&#8221;field-name&#8221;&gt;\ube44\ubc00\ubc88\ud638 : &lt;\/div&gt; &lt;div class=&#8221;field-input&#8221;&gt;&lt;input type=&#8221;password&#8221; name=&#8221;b&#8221; \/&gt;&lt;\/div&gt; &lt;div class=&#8221;field-name&#8221;&gt;&amp;nbsp;&lt;\/div&gt; &lt;div class=&#8221;field-input&#8221;&gt;&lt;input type=&#8221;submit&#8221; value=&#8221;\ub85c\uadf8\uc778&#8221; \/&gt;&lt;\/div&gt; &lt;\/form&gt; &lt;\/body&gt; &lt;\/html&gt; &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;meta\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.happyfam.or.kr\/ysoh\/webdbii-%ec%8b%a4%ec%8a%b5%ec%98%88%ec%a0%9c-%ec%86%8c%ec%8a%a4-7\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[134,2],"tags":[233,21,34,40,53],"class_list":["post-2347","post","type-post","status-publish","format-standard","hentry","category-webdbii","category-2","tag-database","tag-html","tag-mysql","tag-php","tag-webdb"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p776QY-BR","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/www.happyfam.or.kr\/ysoh\/wp-json\/wp\/v2\/posts\/2347","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.happyfam.or.kr\/ysoh\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.happyfam.or.kr\/ysoh\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.happyfam.or.kr\/ysoh\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.happyfam.or.kr\/ysoh\/wp-json\/wp\/v2\/comments?post=2347"}],"version-history":[{"count":0,"href":"https:\/\/www.happyfam.or.kr\/ysoh\/wp-json\/wp\/v2\/posts\/2347\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.happyfam.or.kr\/ysoh\/wp-json\/wp\/v2\/media?parent=2347"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.happyfam.or.kr\/ysoh\/wp-json\/wp\/v2\/categories?post=2347"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.happyfam.or.kr\/ysoh\/wp-json\/wp\/v2\/tags?post=2347"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}