ASP ¼Ò½º º¸±â - ±Û¾²±â´ÙÀ½ÀÇ ASP ¼Ò½º´Â °Ô½ÃÆÇ¿¡¼ ±Û¾²±â¿¡ ´ëÇÑ ¼¼ºÎ ¼Ò½ºÀÔ´Ï´Ù. ÀÌ ¼Ò½º¸¦ ±â¹ÝÀ¸·Î ±Û¾²±â ÀÔ·Â ÆûÀ» ¸¸µé¾î ¼Ò½º¿Í ¿¬°áÇØ ÁÖ¼Å¾ß °Ô½ÃÆÇÀÇ ±Û¾²±â°¡ Á¤»óÀûÀ¸·Î ÀÛµ¿ÇÕ´Ï´Ù.
|
<!-- #include file = "board.conf.asp" --> <!-- #include file = "board.util.asp" --> <!--METADATA NAME="Microsoft ActiveX Data Objects 2.5 Library" TYPE="TypeLib" UUID="{00000205-0000-0010-8000-00AA006D2EA4}"--> <% ' °Ô½Ã¹°, ´ä±Û ¾²±â ½ºÅ©¸³Æ®
Dim con, rs, strSql Dim offset, msgno, pMsgno Dim uploadPath, uploadUrl Dim wname, email, homepage, subject, msgbody, passwd, mode Dim namoMime, fso, converted, ts, f, folder, files Dim pID, ptID, ptStep Dim fileCount
offset = Request.QueryString("offset") mode = Request.QueryString("mode")
wname = Request.Form("author") ' ±Û¾´ÀÌ email = Request.Form("email") ' ±Û¾´ÀÌÀÇ ¸ÞÀÏ ÁÖ¼Ò homepage = Request.Form("homepage") ' ±Û¾´ÀÌÀÇ È¨ÆäÀÌÁö subject = Request.Form("subject") ' Á¦¸ñ msgbody = Request.Form("contents") ' º»¹® passwd = Request.Form("pass") ' ¾ÏÈ£
' º»¹® : 100K ¾¿ ³ª´²¼ ¿Â °É Çϳª·Î ÇÕÄ£´Ù For i = 1 To Request.Form("contents").Count msgbody = msgbody + Request.Form("contents")(i) Next
Set con = Server.CreateObject("ADODB.Connection") Set rs = Server.CreateObject("ADODB.Recordset")
con.Open "DSN=" & BBS_DSN ' DB¿¡ Á¢¼Ó rs.Open "select max(msgno) from board", con ' °¡Àå ÃÖ±Ù °Ô½Ã¹°ÀÇ °Ô½Ã¹° ¹øÈ£. msgno = CInt(rs(0)) + 1 rs.Close
uploadPath = BBS_UPLOAD_PATH & msgno & "/" ' ÆÄÀÏÀ» ÀúÀåÇÒ °æ·Î¸í uploadUrl = BBS_UPLOAD_URL & msgno & "/" ' ÷ºÎ ÆÄÀÏÀ» ÀÐ¾î µéÀÏ URL
Set namoMime = Server.CreateObject("NamoMIME7.MIMEObject") ' NamoMIME À¯Æ¿¸®Æ¼ÀÎ COM Class¸¦ ºÒ·¯¿È Set fso = Server.CreateObject("Scripting.FileSystemObject") ' ÆÄÀÏ ½Ã½ºÅÛ¿ë ¿ÀºêÁ§Æ®¸¦ »ý¼º
On Error Resume Next ' ¿¡·¯ ó¸® fso.CreateFolder uploadPath ' Æú´õ »ý¼º Err.Clear namoMime.SetBaseDecodeUrl uploadPath ' ÆÄÀϰæ·Î º¯È¯À» À§ÇØ ·ÎÄà ¾÷·Îµå°æ·Î¸¦ ÁöÁ¤ÇÕ´Ï´Ù. namoMime.Decode msgbody, uploadPath ' ¾÷·Îµå °æ·Î¿¡ ÀÖ´Â ÆÄÀϵéÀ» µðÄÚµåÇÔ Set ts = fso.OpenTextFile(uploadPath & "noname.htm", 1) converted = ts.ReadAll ts.Close fso.DeleteFile uploadPath & "noname.htm" ' µðÄÚµåÇÑ ¸Þ¼¼Áö¿Í ÆÄÀÏÀ» Áö¿ò.
' Replace src path of attached files to accessable URL Set folder = fso.GetFolder(uploadPath) Set files = folder.Files For each f in files converted = Replace(converted, f.name, uploadUrl & f.name) Next converted = AddSlashes(Left(converted, Len(converted) - 1)) ' EOF°¡ ÀÖ´Â HTMLÀ» ÀÐ¾î µéÀÓ.
If mode = "write" Then strSql = "insert into board (msgno, wname, email, homepage, subject, msgbody, passwd, p_id, wtime) values (" strSql = strSql & msgno & ", " strSql = strSql & "'" & wname & "', " strSql = strSql & "'" & email & "', " strSql = strSql & "'" & homepage & "', " strSql = strSql & "'" & subject & "', " strSql = strSql & "'" & converted & "', " strSql = strSql & "'" & passwd & "', " strSql = strSql & msgno & ", " strSql = strSql & "Now());" con.Execute strSql ' ¸Þ¼¼Áö¸¦ DB¿¡ Ãß°¡ÇÔ ElseIf mode = "reply" Then ' Query parent message information pMsgno = Request.Form("msgno") strSql = "select msgno, p_id, t_id, t_step from board where msgno = " & pMsgno rs.Open strSql, con ppID = rs("p_id") ptID = rs("t_id") ptStep = rs("t_step") strSql = "update board set t_id = t_id + 1 where p_id = "& ppID & " and t_id >= " & CInt(ptID) + 1 rs.Close con.Execute strSql strSql = "insert into board (msgno, wname, email, homepage, subject, msgbody, p_id, t_id, t_step, wtime) values (" strSql = strSql & msgno & ", " strSql = strSql & "'" & wname & "', " strSql = strSql & "'" & email & "', " strSql = strSql & "'" & homepage & "', " strSql = strSql & "'" & subject & "', " strSql = strSql & "'" & converted & "', " strSql = strSql & ppID & ", " strSql = strSql & (CInt(ptID) + 1) & ", " strSql = strSql & (CInt(ptStep) + 1) & ", " strSql = strSql & "Now());" con.Execute strSql ' DB¿¡ ´ä±ÛÀ» Ãß°¡ÇÔ End If con.Close
Response.Redirect "list.asp?offset=" & offset ' ¸ñ·Ï º¸±â·Î µ¹¾Æ°¨ %> |