ASP ¼Ò½º º¸±â - ¼öÁ¤Çϱâ¼öÁ¤Çϱâ ASP ¼Ò½º´Â ¼¹ö¿¡ ÀúÀåµÇ¾î ÀÖ´Â DB(DataBase)ÀÇ Æ¯Á¤ Çʵå(Field)¸¦ ºÒ·¯¿Í ¾×Ƽºê½ºÄù¾î ³»¿¡¼ ¼öÁ¤ÇÒ ¼ö ÀÖµµ·Ï ÇÏ´Â ¸¸µé¾îÁø °Í ÀÔ´Ï´Ù.
|
<!-- #include file="board.conf.asp" --> <!-- #include file="board.util.asp" --> <% ' °Ô½Ã¹° ÆíÁý ½ºÅ©¸³Æ® edit.asp
Dim offset Dim con, rs, strSql Dim uploadPath, uploadUrl Dim msgno, subject, homepage, email, author, msgbody, pass Dim fso, namoMime, ts, converted, folder, files, f
offset = Request.QueryString("offset") msgno = Request.QueryString("msgno") subject = Request.Form("subject") homepage = Request.Form("homepage") email = Request.Form("email") author = Request.Form("author") msgbody = Request.Form("msgbody") pass = Request.Form("pass")
Set con = Server.CreateObject("ADODB.Connection") Set rs = Server.CreateObject("ADODB.Recordset")
con.Open "DSN=" & BBS_DSN strSql = "select passwd from board where msgno = " & msgno rs.Open strSql, con rs.MoveFirst If pass <> rs("passwd") Then ' ¾ÏÈ£°¡ Ʋ·ÈÀ» °æ¿ì Response.write "<script>alert(""¾ÏÈ£°¡ ¸ÂÁö ¾Ê½À´Ï´Ù.""); history.go(-1);</script>" Response.End End If
uploadPath = BBS_UPLOAD_PATH & msgno uploadUrl = BBS_UPLOAD_URL & msgno & "/"
On Error Resume Next Set fso = Server.CreateObject("Scripting.FileSystemObject") ' ¾÷·ÎµåÇÑ ÆÄÀÏÀ» Áö¿ò fso.DeleteFolder uploadPath Err.Clear
Set namoMime = Server.CreateObject("NamoMIME7.MIMEObject") ' NamoMIME À¯Æ¿¸®Æ¼ÀÎ COM Class¸¦ ºÒ·¯¿È
On Error Resume Next fso.CreateFolder uploadPath ' Æú´õ »ý¼º Err.Clear namoMime.SetBaseDeocdeUrl uploadPath ' ÆÄÀϰæ·Î º¯È¯À» À§ÇØ ·ÎÄà ¾÷·Îµå°æ·Î¸¦ ÁöÁ¤ÇÕ´Ï´Ù. namoMime.Decode msgbody, uploadPath ' 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)) ' HTMLÀ» Àд´Ù. (ÀоîµéÀÎ ½ºÆ®¸µÀÇ ³¡¿¡´Â EOF°¡ ÀÖÀ½)
strSql = "update board set subject='" & subject & "', " strSql = strSql & "homepage='" & homepage & "', " strSql = strSql & "email='" & email & "', " strSql = strSql & "wname='" & author & "', " strSql = strSql & "wtime=Now(), " strSql = strSql & "msgbody='" & converted & "' " strSql = strSql & "where msgno=" & msgno
con.Execute strSql ' ¸Þ¼¼Áö¸¦ ¾÷·ÎµåÇÔ rs.Close con.Close Response.Redirect "read.asp?msgno=" & msgno & "&offset=" & offset ' ÆíÁýÇÑ ¸Þ¼¼Áö¸¦ ´Ù½Ã ÀоîµéÀÓ.
%> |