{"id":505,"date":"2014-05-22T12:57:20","date_gmt":"2014-05-22T03:57:20","guid":{"rendered":"http:\/\/backup.me.ne.kr\/?p=505"},"modified":"2014-05-22T12:57:20","modified_gmt":"2014-05-22T03:57:20","slug":"phpjquery-euc-kr%ec%9d%b8%ec%bd%94%eb%94%a9%ec%97%90%ec%84%9c-ajax-%ec%82%ac%ec%9a%a9%ec%8b%9c-%ed%95%9c%ea%b8%80-%ea%b9%a8%ec%a7%90-%ed%98%84%ec%83%81-%eb%ac%b8%ec%a0%9c-%ed%95%b4%ea%b2%b0","status":"publish","type":"post","link":"http:\/\/jhp.io\/?p=505","title":{"rendered":"[PHP\/jQuery] euc-kr\uc778\ucf54\ub529\uc5d0\uc11c Ajax \uc0ac\uc6a9\uc2dc \ud55c\uae00 \uae68\uc9d0 \ud604\uc0c1 \ubb38\uc81c \ud574\uacb0"},"content":{"rendered":"<p>\ud574\uacb0 \ubc29\ubc95 : euc-kr \ub300\uc2e0 utf-8\uc744 \uc4f8 \uac83.<\/p>\n<p>&#8230; \uc740 \ub18d\ub2f4. \ud558\uc9c0\ub9cc \ubd88\uac00\ud53c\ud55c \uc0c1\ud669 \uc544\ub2c8\uba74 \uac1c\ubc1c \ucd08\uae30\uc5d0 utf-8\uc744 \uc774\uc6a9\ud574\uc11c \uac1c\ubc1c\ud558\ub294 \uac83\uc774 \uc81c\uc77c \uc88b\ub2e4. euc-kr\uc740 \uc57d\uac04 \ubb38\uc81c\uac00 \uc788\ub294 \uc778\ucf54\ub529\uc778\uc9c0\ub77c \uc808\ub300 \ucd94\ucc9c\ud560 \uc218 \uc5c6\ub2e4.<\/p>\n<p>\uc5ec\ud2bc jQuery\uc5d0\uc11c ajax\ub97c \uc0ac\uc6a9\ud558\uba74 utf-8\uc758 \uacbd\uc6b0\ub294 \uc804\ud600 \ubb38\uc81c\uac00 \uc5c6\ub294 \ubc18\uba74 euc-kr\uc758 \uacbd\uc6b0 \uc804\ub2ec\ud558\ub294 \ub370\uc774\ud130\uc5d0 \ud55c\uae00\uc774 \ud3ec\ud568\ub418\uc5b4 \uc788\uc73c\uba74 \uae00\uc790\uac00 \uae68\uc9c0\uac70\ub098 \uc544\uc608 \ub0b4\uc6a9\uc774 \uc0ac\ub77c\uc9c0\ub294 \ud604\uc0c1\uc774 \ubc1c\uc0dd\ud55c\ub2e4. \uc774\ub97c \ud574\uacb0\ud558\uae30 \uc704\ud574\uc120 \ub2e4\uc74c\uacfc \uac19\uc774 \ud574\uc8fc\uc790.<\/p>\n<p>\uc608\ub97c \ub4e4\uc5b4 \ud638\ucd9c \ubd80\ubd84\uc774 \ub2e4\uc74c\uacfc \uac19\uc774 \uc788\ub2e4\uace0 \uac00\uc815\ud558\uc790.<\/p>\n<p><strong><span style=\"color: #3a32c3;\">var<\/span><\/strong>toFindPerson = $(<span style=\"color: #3a32c3;\">&#8216;#keyword&#8217;<\/span>).val();<\/p>\n<p>$.ajax({<br \/>\n<!-- Not Allowed Attribute Filtered ( href='\"\/programme\/person_finder.php') --><a class=\"con_link\" target=\"_blank\" rel=\"noopener\">url:<span style=\"color: #3a32c3;\">&#8220;\/programme\/person_finder.php<\/span><\/a><span style=\"color: #3a32c3;\">&#8220;<\/span>,<br \/>\ndata:{<br \/>\nmode : &#8220;person&#8221;,<br \/>\nname : toFindPerson<br \/>\n},<br \/>\ntype:<span style=\"color: #3a32c3;\">&#8220;GET&#8221;<\/span>,<br \/>\n&#8230; \uadf8\uc678 \uac16\uac00\uc9c0 &#8230;<br \/>\n});<\/p>\n<p>\uc5ec\uae30\uc11c \ud55c\uae00\ub85c \ub370\uc774\ud130\ub97c \uc804\ub2ec\ud558\ub294 \ubd80\ubd84\uc744 \ub2e4\uc74c\ucc98\ub7fc encodeURIComponent \ud568\uc218\ub97c \uac70\uce58\ub3c4\ub85d \ud574\uc900\ub2e4.<\/p>\n<p><strong><span style=\"color: #3a32c3;\">var<\/span><\/strong>toFindPerson = $(<span style=\"color: #3a32c3;\">&#8216;#keyword&#8217;<\/span>).val();<\/p>\n<p>$.ajax({<br \/>\n<!-- Not Allowed Attribute Filtered ( href='\"\/programme\/person_finder.php') --><a class=\"con_link\" target=\"_blank\" rel=\"noopener\">url:<span style=\"color: #3a32c3;\">&#8220;\/programme\/person_finder.php<\/span><\/a><span style=\"color: #3a32c3;\">&#8220;<\/span>,<br \/>\ndata:{<br \/>\nmode : <span style=\"color: #3a32c3;\">&#8220;person&#8221;<\/span>,<br \/>\nname : <strong><span style=\"color: #53aea8;\">encodeURIComponent<\/span><\/strong>(toFindPerson)<br \/>\n},<br \/>\ntype:<span style=\"color: #3a32c3;\">&#8220;GET&#8221;<\/span>,<br \/>\n&#8230; \uadf8\uc678 \uac16\uac00\uc9c0 &#8230;<br \/>\n});<\/p>\n<p>encodeURIComponent\ub294 \uc54c\uaca0\uc9c0\ub9cc URL \ud615\uc2dd\uc73c\ub85c \ub370\uc774\ud130\ub97c \ub123\uc744 \uc218 \uc788\ub3c4\ub85d \ubb38\uc790\uc5f4\uc744 \uc778\ucf54\ub4dc\ud55c\ub2e4. \uacb0\uacfc\uc801\uc73c\ub85c name\uc5d0\ub294 %ED%97%90%EB%AD%90%EC%95%BC \ubb50 \uc774\ub7f0\uc2dd\uc73c\ub85c \ub370\uc774\ud130\uac00 \uc800\uc7a5\ub41c\ub2e4. \uacbd\uc6b0\uc5d0 \ub530\ub77c\uc120 \uc790\ub3d9\uc73c\ub85c \ubcc0\ud658\ud574\uc8fc\ub098 \ube0c\ub77c\uc6b0\uc800 \ud638\ud658\uc131\uc744 \uc704\ud574 \uac15\uc81c\ub85c \ubcc0\ud658\ud558\uac8c \ud558\uc790.<\/p>\n<p>\uc6b0\uc120 \ud638\ucd9c \ubd80\ubd84\uc5d0\uc11c\ub294 \ud55c\uae00\ub85c \uc804\ub2ec\ub418\ub294 \ub370\uc774\ud130\ub9cc \uc800\ub807\uac8c \ucc98\ub9ac\ud574\uc8fc\uace0, \ucc98\ub9ac \ud398\uc774\uc9c0(\uc5ec\uae30\uc120 \uc55e\uc5d0 \ud638\ucd9c \ubd80\ubd84\uc5d0\uc11c url\uc5d0 \uba85\uc2dc\ub41c \/programme\/person_finder.php)\uc5d0\uc11c\ub294 \ub2e4\uc74c \ud568\uc218\ub4e4\uc744 \uac70\uce58\ub3c4\ub85d \ud55c\ub2e4.<\/p>\n<p><strong><span style=\"color: #ff0000;\">&lt;?php<\/span><\/strong><\/p>\n<p>$name = <span style=\"color: #518fbb;\">$_GET<\/span>[<span style=\"color: #951015;\">&#8216;name&#8217;<\/span>];<br \/>\n<span style=\"color: #009e25;\">\/\/ 1. \uc124\uba85\uc774 \ud544\uc694\ud55c\uac00? \uc804\ub2ec\ub418\ub294 \ubc29\ubc95(method)\uc774 \ub2e4\ub974\uba74 \ub2f9\uc5f0\ud788 \uac70\uae30\uc5d0 \ub9de\uac8c \ubcc0\uacbd\ud574\uc900\ub2e4.<\/span><\/p>\n<p>$name = <span style=\"color: #3a32c3;\">urldecode<\/span>($name);<br \/>\n<span style=\"color: #009e25;\">\/\/ 2. %ED%97&#8230; \uc2dd\uc73c\ub85c \ubcc0\ud658\ub41c \ubb38\uc790\uc5f4\uc744 \ubcf8\ub798 \ud615\ud0dc\uc758 \ubb38\uc790\uc5f4\ub85c \ubcc0\ud658\ud55c\ub2e4. \uc774 \ubc18\ub300 \uc5ed\ud560\uc758 \ud568\uc218\ub294 \ub2f9\uc5f0\ud788 urlencode.<\/span><\/p>\n<p>$name = <span style=\"color: #3a32c3;\">iconv<\/span>(<span style=\"color: #951015;\">&#8220;utf-8&#8221;<\/span>,<span style=\"color: #951015;\">&#8220;euc-kr&#8221;<\/span>,$name);<br \/>\n<span style=\"color: #009e25;\">\/\/ 3. \ubcc0\ud658 \uc774\ud6c4\uc5d0\ub294 utf-8\ub85c \ub370\uc774\ud130\uac00 \ub0a8\uc544\uc11c \uc774\uac78\ub85c \uc9c0\uc9c0\uace0 \ubcf6\uc744 \uc21c \uc5c6\ub2e4. euc-kr\ub85c \ubcc0\ud658 \ud6c4 \ubcf6\uc544\uc900\ub2e4.<\/span><\/p>\n<p>$name = <span style=\"color: #3a32c3;\">mb_convert_encoding<\/span>($name,<span style=\"color: #951015;\">&#8220;euc-kr&#8221;<\/span>,<span style=\"color: #951015;\">&#8220;utf-8&#8221;<\/span>);<br \/>\n<span style=\"color: #009e25;\">\/\/ 4. \uc77c\ubd80 \uc11c\ubc84\uc5d0\uc11c\ub294 iconv \ud568\uc218\ub97c \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uacbd\uc6b0\ub3c4 \uac04\ud639 \uc788\ub2e4. \uadf8\ub7f4 \uacbd\uc6b0 mb_string \uacc4\uc5f4 \ud568\uc218\ub97c \ud1b5\ud574 \ubcc0\ud658\uc744 \ud574\uc900\ub2e4.<\/span><\/p>\n<p><span style=\"color: #009e25;\">\/\/ 5. \ud544\uc694\ud558\uba74 \ucd94\uac00\uc801\uc778 \ubcf4\uc548\uc870\uce58(SQL Injection, XSS \ud544\ud130\ub4f1)\ub97c \ud574\uc900\ub2e4.<\/span><\/p>\n<p><span style=\"color: #009e25;\"><span style=\"text-decoration: line-through;\">\/\/ 6. ????<\/span><\/span><\/p>\n<p><span style=\"color: #009e25;\"><span style=\"text-decoration: line-through;\">\/\/ 7. PROFIT!<\/span><\/span><\/p>\n<p><strong><span style=\"color: #ff0000;\">?&gt;<\/span><span style=\"color: #ff0000;\">\u00a0<\/span><\/strong><\/p>\n<p><span style=\"color: #acacac;\">PS. \uce74\ud14c\uace0\ub9ac \uad6c\ubd84\uc774 \uc560\ub9e4\ud558\ub124&#8230;<\/span><span style=\"color: #acacac;\">\u00a0<\/span><\/p>\n<div class=\"autosourcing-stub-extra\"><\/div>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\ud574\uacb0 \ubc29\ubc95 : euc-kr \ub300\uc2e0 utf-8\uc744 \uc4f8 \uac83. &#8230; \uc740 \ub18d\ub2f4. \ud558\uc9c0\ub9cc \ubd88\uac00\ud53c\ud55c \uc0c1\ud669 \uc544\ub2c8\uba74 \uac1c\ubc1c \ucd08\uae30\uc5d0 utf-8\uc744 \uc774\uc6a9\ud574\uc11c \uac1c\ubc1c\ud558\ub294 \uac83\uc774 \uc81c\uc77c \uc88b\ub2e4. euc-kr\uc740 \uc57d\uac04 \ubb38\uc81c\uac00 \uc788\ub294 \uc778\ucf54\ub529\uc778\uc9c0\ub77c \uc808\ub300 \ucd94\ucc9c\ud560 \uc218 \uc5c6\ub2e4. \uc5ec\ud2bc jQuery\uc5d0\uc11c ajax\ub97c \uc0ac\uc6a9\ud558\uba74 utf-8\uc758 \uacbd\uc6b0\ub294 \uc804\ud600 \ubb38\uc81c\uac00 \uc5c6\ub294 \ubc18\uba74 euc-kr\uc758 \uacbd\uc6b0 \uc804\ub2ec\ud558\ub294 \ub370\uc774\ud130\uc5d0 \ud55c\uae00\uc774 \ud3ec\ud568\ub418\uc5b4 \uc788\uc73c\uba74 \uae00\uc790\uac00 \uae68\uc9c0\uac70\ub098 \uc544\uc608 \ub0b4\uc6a9\uc774 \uc0ac\ub77c\uc9c0\ub294 \ud604\uc0c1\uc774 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19,16],"tags":[],"class_list":["post-505","post","type-post","status-publish","format-standard","hentry","category-php-mysql","category-programming"],"_links":{"self":[{"href":"http:\/\/jhp.io\/index.php?rest_route=\/wp\/v2\/posts\/505","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/jhp.io\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/jhp.io\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/jhp.io\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/jhp.io\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=505"}],"version-history":[{"count":0,"href":"http:\/\/jhp.io\/index.php?rest_route=\/wp\/v2\/posts\/505\/revisions"}],"wp:attachment":[{"href":"http:\/\/jhp.io\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=505"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/jhp.io\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=505"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/jhp.io\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=505"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}