{"id":681,"date":"2002-11-25T01:06:25","date_gmt":"2002-11-25T01:06:25","guid":{"rendered":"http:\/\/dev.jblove.net\/?p=681"},"modified":"2002-11-25T01:06:25","modified_gmt":"2002-11-25T01:06:25","slug":"php%ec%8a%a4%ec%bf%a8-%ea%b2%8c%ec%8b%9c%ed%8c%90%eb%82%b4%ec%9a%a9%ec%9d%84-db%eb%a1%9c-%ea%b0%80%ec%a0%b8%ec%98%a4%ea%b8%b0-%ec%98%88%ec%a0%9c","status":"publish","type":"post","link":"https:\/\/jblove.net\/?p=681","title":{"rendered":"PHP\uc2a4\ucfe8 \uac8c\uc2dc\ud310\ub0b4\uc6a9\uc744 DB\ub85c \uac00\uc838\uc624\uae30 \uc608\uc81c"},"content":{"rendered":"<p>\uae40\uc131\ub300<br \/>\nhttp:\/\/xhost.co.kr<\/p>\n<p>* \uc774 \ub0b4\uc6a9\uc740 PHPSCHOOL\uc5d0 \uad00\ub9ac\uc790\uc758 \ud310\ub2e8\uc5d0 \ub530\ub77c \uc0ad\uc81c\ub420\ud558\uc5ec\ub3c4 \ub429\ub2c8\ub2e4.<br \/>\n* \uc0ac\uc6a9\ubaa9\uc801\uc740 PHP\uc2a4\ucfe8\uc911\uc5d0 \uc788\ub294 \uc77c\ubd80 \uac8c\uc2dc\ud310\uc744 \uc790\uc2e0\uc758 \uac8c\uc2dc\ud310\uc5d0 \ub9c1\ud06c\ub610\ub294 \ubcf5\uc0ac\ud558\uc5ec \uc27d\uac8c \uc815\ub9ac\ud558\uc5ec \ucc3e\uae30\uc704\ud55c \ubaa9\uc801\uc73c\ub85c \uac1c\uc778\uc801\uc778 \ubaa9\uc801\uc73c\ub85c \uc0ac\uc6a9\ud558\uae30 \uc704\ud568\uc785\ub2c8\ub2e4. \uc800\uc791\uad8c\uc758 \ubb38\uc81c\uac00 \ubc1c\uc0dd\ub420\uc218 \uc788\uc73c\uba70 \uadf8\uc5d0 \ub300\ud55c \ucc45\uc784\uc740 \uc9c0\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4.<br \/>\n* \uc218\uc815,\ud3b8\uc9d1\uc740 \uc790\uc720\uc774\ub098, \uc18c\uc2a4\ub97c \uace0\ucce4\uc73c\uba74 \uc774 \uac8c\uc2dc\ud310\uc5d0 \ub9ac\ud50c\ub85c \uc62c\ub824\uc8fc\uc2dc\uba74 \ub3c4\uc6c0\uc774 \ub418\uaca0\uc2b5\ub2c8\ub2e4.<br \/>\n* \uac04\ub2e8\ud788 \ub9cc\ub4e0\uac83\uc774\ub77c \uc635\ud2f0\ub9c8\uc774\uc9d5\uc774 \uc548\ub418\uc5b4 \uc788\uc73c\ub2c8 \uc88b\uc740\ub8e8\ud2f4\uc73c\ub85c \uac1c\uc120\ubd80\ud0c1\ud569\ub2c8\ub2e4.<\/p>\n<p>\n&#8212;- \uc544\ub798 \uc18c\uc2a4\uc785\ub2c8\ub2e4.<\/p>\n<p>\n<?\n\n\n        \/\/\uac00\uc9c0\uace0 \uc62c \uacc4\uc2dc\ud310 \ub9c1\ud06c \uc8fc\uc18c<br \/>\n        $get_url=&#8221;http:\/\/www.phpschool.com\/bbs2\/inc_view.html?id=7090&#038;code=tnt2&#038;start=0&#038;mode=search&#038;s_que=&#038;field=body&#038;operator=and&#038;period=all&#038;category_id=&#8221;;<br \/>\n        $str=join(&#8220;&#8221;, file($get_url));<\/p>\n<p>        \/\/ID\ucd94\ucd9c<br \/>\n        $write_id=str_ext2($str,&#8221;<\/p>\n<td bgcolor=#5485B6 align=left>\uae00\uc4f4\uc774:&#8221;,&#8221;\n<\/td>\n<p>&#8220;);<\/p>\n<p>        \/\/\uc81c\ubaa9\ucd94\ucd9c:<br \/>\n        $subject=str_ext2($str,&#8221;<\/p>\n<td bgcolor=#5485B6 align=center ><b>&#8220;,&#8221;<\/b><\/td>\n<p>&#8220;);<\/p>\n<p>        \/\/\ub0b4\uc6a9\ucd94\ucd9c<br \/>\n        $ex_key1=&#8221;<\/p>\n<table width=100% cellspacing=1 cellpadding=0 border=0><\/p>\n<td ><\/p>\n<table width=100% cellspacing=1 cellpadding=1 border=0>&#8220;;<br \/>\n        $ex_key2=&#8221;<\/p>\n<td height=1 width=10% background=.\/img\/list_back.gif><\/td>\n<p>\n<\/tr>\n<p>\n<script language='JavaScript'> \";<br \/>\n        $body=str_ext2($str,$ex_key1,$ex_key2);<\/p>\n<p>        \/\/\ud14c\uc774\ube14\uc644\uc131\ud558\uae30 \uc704\ud574 \ucd94\uac00\ud568.<br \/>\n        $body=$ex_key1.$body.\"<\/tr>\n<\/table>\n<\/td>\n<\/tr>\n<\/table>\n<p>\";<br \/>\n        $body=\"<a href=\"http:\/\/www.phpschool.com\" target=\"_new\" rel=\"noopener noreferrer\">\ucd9c\ucc98: PHPSCHOOL<\/a><br \/>\n<BR><a href=\"$get_url\" target=\"_new\" rel=\"noopener noreferrer\">URL: $get_url<\/a><br \/>\n\".$body;<\/p>\n<p>        \/\/\ub0b4\uc6a9\uc911 \uadf8\ub9bc\ub9c1\ud06c\ub97c \uc644\uc131\ud568<br \/>\n        $arr1=array(\"<img src=.\/img\/comment_del.gif\",\" background=.\/img\/list_back.gif>\",\"<img src=.\/img\/cface\/\",\"<img src='.\/img\/linktip.gif' \",\"<img src='.\/img\/mail.gif' border=o>\",\"<img src='.\/img\/home.gif' border=o>\");<br \/>\n        for ($i=0;$i<sizeof($arr1);$i++) {<br \/>\n                $body=str_replace($arr1[$i],str_replace(\".\/img\/\",\"http:\/\/www.phpschool.com\/bbs2\/img\/\",$arr1[$i]),$body);<\/p>\n<p>        }<\/p>\n<p>        \/\/\uae00\uc4f4\uc2dc\uac04<br \/>\n        $write_date=str_ext2($str,\"<\/p>\n<td bgcolor=#5485B6 align=right>\uae00\uc4f4\uc2dc\uac04 : \",\" <\/td>\n<p>\");<br \/>\n        $write_date=\"20$write_date:00\";<\/p>\n<p>\/*<br \/>\necho \"get_url:$get_url<BR>\";<br \/>\necho \"subject:$subject<BR>\";<br \/>\necho \"write_id:$write_id<BR>\";<br \/>\necho \"write_date:$write_date<BR>\";<br \/>\necho \"body:$body<BR>\";<br \/>\n*\/<\/p>\n<p>\nfunction str_ext2($str,$start=\"\",$end=\"\"){ <br \/>\n        \/\/\ubb38\uc790(*)\uac00 \uc788\ub294 \uc704\uce58\ub97c \uc54c\uc544\ub0b8\ub2e4 <br \/>\n        if (!$str) return $str;<br \/>\n        if (!$start&&!$end) return $str;<\/p>\n<p>        $po = strpos($str, $start); <br \/>\n        if (!$po||$po<0) $po=0;<br \/>\n        if (!$end) return substr($str,$po);<br \/>\n        \/\/echo \"S:$start,E:$end,P:$po,<BR>\";<\/p>\n<p>        $len=strlen($str);<br \/>\n        $len2=strlen($end);<br \/>\n        \/\/\uccab\ubc88\uc9f8 \ubb38\uc790(*) \ub2e4\uc74c\ubd80\ud130 \ucd94\ucd9c\ud558\uae30 \uc704\ud574 $po\ub97c 1\uc99d\uac00 <br \/>\n        if ($po>0) $po += strlen($start); <br \/>\n        \/\/\ub9c8\uc9c0\ub9c9 \ubb38\uc790(*) \ub97c \ub9cc\ub098\uba74 while \uad6c\ubb38\uc744 \ub05d\ub0b8\ub2e4 <br \/>\n        $buff=substr($str,$po);<br \/>\n        if ($end) {<br \/>\n                $po2= strpos($buff,$end); <br \/>\n                $buff=substr($buff,0,$po2);<br \/>\n                \/\/echo \"$po , $po2<BR>\";<br \/>\n        }<br \/>\n        return $buff;<br \/>\n} <\/p>\n<p>\n\/\/ \uc544\ub798\ub294 \uc2e4\uc81c\ub85c DB\uc5d0 \uc800\uc7a5\ud568.\uc790\uc2e0\uc758DB\uc5d0 \ub9de\ucd94\uc5b4 \uc218\uc815\ud560\uac83.<\/p>\n<p>\n$subject=trim($subject);<br \/>\n$size=strlen($body);<br \/>\n$subject=str_replace(\"'\",\"\\'\",$subject);<br \/>\n$body=str_replace(\"'\",\"\\'\",$body);<br \/>\n$code=\"ktip\";<\/p>\n<p>if (!$define_db) {<br \/>\n        if (file_exists(\"..\/db.htm\")) {<br \/>\n                include \"..\/db.htm\";<br \/>\n                include \"..\/utbase.htm\";<br \/>\n        }<br \/>\n        else {<br \/>\n                include \"db.htm\";<br \/>\n                include \"utbase.htm\";<br \/>\n        }<br \/>\n        include \"\/nfs\/php\/lib\/ut.htm\";<br \/>\n}<\/p>\n<p>$connect=mysql_connect($DB_HOST,$DB_USER,$DB_PASS);<\/p>\n<p>$table_name=\"main_$code\";<br \/>\n$query=\"select max(pos) from $table_name\";<br \/>\n$result=mysql_db_query($DB_CM,$query);<br \/>\nif(!$result) {echo $query,mysql_error();exit;}<br \/>\n$row=mysql_fetch_array($result);<br \/>\n$newpos=$row[0]+1;<\/p>\n<p>$query = \"<br \/>\ninsert into $table_name (<br \/>\npos,id,tid,name<br \/>\n,tcode<br \/>\n,title,date<br \/>\n,size,body,tag<br \/>\n,f_link1<br \/>\n)<br \/>\nvalues (<br \/>\n'$newpos','$write_id','$write_id','$write_id'<br \/>\n,'$code'<br \/>\n,'$subject','$write_date'<br \/>\n,'$size','$body','2'<br \/>\n,'$get_url'<br \/>\n)\";<\/p>\n<p>\/\/echo($query);exit;<\/p>\n<p>$result=mysql_db_query($DB_CM,$query);<br \/>\nif(!$result) {<br \/>\n        echo $query,mysql_error(),mysql_errno();<br \/>\n        exit;<br \/>\n}<\/p>\n<p>\n?> <\/p>\n","protected":false},"excerpt":{"rendered":"<p>\uae40\uc131\ub300 http:\/\/xhost.co.kr * \uc774 \ub0b4\uc6a9\uc740 PHPSCHOOL\uc5d0 \uad00\ub9ac\uc790\uc758 \ud310\ub2e8\uc5d0 \ub530\ub77c \uc0ad\uc81c\ub420\ud558\uc5ec\ub3c4 \ub429\ub2c8\ub2e4. * \uc0ac\uc6a9\ubaa9\uc801\uc740 PHP\uc2a4\ucfe8\uc911\uc5d0 \uc788\ub294 \uc77c\ubd80 \uac8c\uc2dc\ud310\uc744 \uc790\uc2e0\uc758 \uac8c\uc2dc\ud310\uc5d0 \ub9c1\ud06c\ub610\ub294 \ubcf5\uc0ac\ud558\uc5ec \uc27d\uac8c \uc815\ub9ac\ud558\uc5ec \ucc3e\uae30\uc704\ud55c \ubaa9\uc801\uc73c\ub85c \uac1c\uc778\uc801\uc778 \ubaa9\uc801\uc73c\ub85c \uc0ac\uc6a9\ud558\uae30 \uc704\ud568\uc785\ub2c8\ub2e4. \uc800\uc791\uad8c\uc758 \ubb38\uc81c\uac00 \ubc1c\uc0dd\ub420\uc218 \uc788\uc73c\uba70 \uadf8\uc5d0 \ub300\ud55c \ucc45\uc784\uc740 \uc9c0\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. * \uc218\uc815,\ud3b8\uc9d1\uc740 \uc790\uc720\uc774\ub098, \uc18c\uc2a4\ub97c \uace0\ucce4\uc73c\uba74 \uc774 \uac8c\uc2dc\ud310\uc5d0 \ub9ac\ud50c\ub85c \uc62c\ub824\uc8fc\uc2dc\uba74 \ub3c4\uc6c0\uc774 \ub418\uaca0\uc2b5\ub2c8\ub2e4. * \uac04\ub2e8\ud788 \ub9cc\ub4e0\uac83\uc774\ub77c \uc635\ud2f0\ub9c8\uc774\uc9d5\uc774 \uc548\ub418\uc5b4 \uc788\uc73c\ub2c8 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[51],"tags":[],"class_list":["post-681","post","type-post","status-publish","format-standard","hentry","category-papa-php"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/jblove.net\/index.php?rest_route=\/wp\/v2\/posts\/681","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jblove.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jblove.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jblove.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jblove.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=681"}],"version-history":[{"count":0,"href":"https:\/\/jblove.net\/index.php?rest_route=\/wp\/v2\/posts\/681\/revisions"}],"wp:attachment":[{"href":"https:\/\/jblove.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=681"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jblove.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=681"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jblove.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=681"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}