|
|
|
Çѽº / 2003-01-08 / ¿ÀÈÄ 4:07:07 / 203.228.58.138
Á¶È¸¼ö : 193
|
[Áú¹®] FileMan °´Ã¼ »ý¼ºÇÑ°É »çÀÌÆ®°¶·°½Ã·Î ´©°¡Á» ¹Ù²ãÁÖ¼¼¿ä |
FileMan °´Ã¼ »ý¼ºÇÑ°É »çÀÌÆ®°¶·°½Ã·Î ´©°¡ ¹Ù²ãÁÖ½Ã¸é °¨»çÇÏ°Ú½À´Ï´Ù
¸î¹øÇÏ´Ù µµÀúÈ÷ ¾ÈµÅ¼....
Å×À̺íÀº ¾Æ·¡....Âü°í¹Ù¶ø´Ï´Ù
CREATE TABLE [dbo].[StudyBoard] (
[S_numb] [int] NOT NULL ,
[BookName] [nvarchar] (50) NULL ,
[CName] [nvarchar] (50) NULL ,
[JName] [nvarchar] (50) NULL ,
[S_Cont] [ntext] NULL , '¹®Àå ³»¿ë
[S_count] [int] NULL 'Ä«¿îÅÍ
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
'------------------------------------------------
study_write_ok.asp
'------------------------------------------------
Dim UserDim
If Request.cookies("User") = "" Then 'ÄíÅ°°¡ ¾øÀ» ¶§
Response.Redirect "../default.asp"
Else
UserDim = Split(Request.cookies("User"), "@", -1, 1)
UserID = UserDim(0)
UserPW = UserDim(1)
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' DB Open
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'DBCon °´Ã¼ »ý¼º
Set DBCon = Server.CreateObject("ADODB.Connection")
'ODBC DSNÁ¢¼Ó
DBCon.open("DSN=xxx;UID=xx;PWD=xxxxx")
Set rs = Server.CreateObject("ADODB.RecordSet")
rs.CursorType = 1
sql = "select * from UserTable where UserID ='" &UserID& "'"
Set rs = DBCon.Execute(sql)
If rs.Eof or rs.Bof Then
Set rs = Nothing
DBCon.Close
Set DBCon = Nothing
Response.Redirect "../default.asp"
Else
Set rs = Nothing
If UserID = "admin" Then
'FileMan °´Ã¼ »ý¼º
Set ObjFileMan = Server.CreateObject("FileMan.FileUpload")
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' ÀúÀåÇÒ µð·ºÅ丮 ÁöÁ¤ (Server), ´Ù¿îÇÒ URL ÁöÁ¤ (Server) ÀӽùæÆí user.asp¿¡ ³Ö´Â´Ù.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
strDirectory = "D:\study\figs\"
strUrl = "http://www.xxxx.co.kr/figs/"
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' DB¿¡ ÀúÀåÇÒ ³»¿ëÀ» °¡Á® ¿Â´Ù.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
BookName = Trim(objFileMan.GetValueByName("BookName"))
CName = Trim(objFileMan.GetValueByName("CName"))
JName = Trim(objFileMan.GetValueByName("JName"))
ViewType = Trim(objFileMan.GetValueByName("ViewType"))
S_Cont = Trim(objFileMan.GetValueByName("S_Cont"))
S_Cont = Replace(S_Cont, "&" , "&")
S_Cont = Replace(S_Cont, "'", "''")
If ViewType="html" Then
S_Cont = Replace(S_Cont, Chr(13)&Chr(10)&"<t","<t")
S_Cont = Replace(S_Cont, Chr(13)&Chr(10)&"<T","<T")
S_Cont = Replace(S_Cont, Chr(13)&Chr(10)&"</t","</t")
S_Cont = Replace(S_Cont, Chr(13)&Chr(10)&"</T","</T")
S_Cont = Replace(S_Cont, Chr(13)&Chr(10),"<br>")
S_Cont = Replace(S_Cont, " "," ")
Else
S_Cont = Replace(S_Cont, "<", "<")
S_Cont = Replace(S_Cont, ">", ">")
S_Cont = Replace(S_Cont, Chr(13)&Chr(10),"<br>")
S_Cont = Replace(S_Cont, " "," ")
End If
For II = 1 to 10
Fig = Trim(objFileMan.GetValueByName("fig"&CStr(II)))
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' ÷ºÎÆÄÀÏÀÌ ÀÖÀ»°æ¿ì ÇØ´ç Àý´ë°æ·Î¿¡ ÀúÀåÈÄ DB Update
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
If Fig <> "" and Not IsNull(Fig) Then
'ÀúÀå¿À·ù À϶§ ¸Þ»õÁö »Ñ¸®°í ¾Æ´Ò °æ¿ì ÆÄÀÏÀúÀåÇÔ
'½ÇÁúÀûÀÎ ÆÄÀϸ¸ °¡Áö°í ¿È
FileName = Mid(Fig, InstrRev(Fig, "\") + 1)
'ÆÄÀϸí°ú °æ·Î¸¦ Çϳª·Î ÇÕħ
strFileName = strDirectory & FileName
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'ÆÄÀϸíÀÌ Á¸ÀçÇÒ °æ¿ì ÆÄÀÏ¸í º¯°æ ·çƾ
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Set fso = CreateObject("Scripting.FileSystemObject")
Do While (fso.FileExists(strFileName))
File_Name = Mid(strFileName, 1, InstrRev(strFileName, ".") - 1)
File_Expen = Mid(strFileName, InstrRev(strFileName, ".") + 1)
Do While IsNumeric(Right(File_Name, "1"))
File_Count = Right(File_Name, "1") & File_Count
File_name = Mid(File_Name, 1, Len(File_Name) - 1)
Loop
File_Count = CStr(CInt(File_Count) + 1)
strFileName = File_Name & File_Count & "." & File_Expen
Loop
Set fso = Nothing
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'ÆÄÀϸíÀÌ Á¸ÀçÇÒ °æ¿ì ÆÄÀÏ¸í º¯°æ ·çƾ ³¡
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
On Error Resume Next
strRet = ObjFileMan.SaveFile("fig"&CStr(II), CStr(strFileName))
If IsNull(strRet) Then
Response.Write "ÆÄÀÏÀúÀå ½ÇÆÐ"
End If
inpFileName = FileName
savFileName = Mid(strFileName, InstrRev(strFileName, "\") + 1)
S_Cont = Replace(S_Cont, "-^"&inpFileName, "<img src=../figs/"&savFileName)
S_Cont = Replace(S_Cont, "^-", ">")
End If
Next
S_Cont = Replace(S_Cont, "-^", "<img src=../figs/")
S_Cont = Replace(S_Cont, "^-", ">")
Set ObjFileMan = Nothing
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' µ¿ÀÏÇÑ Á¦¸ñÀ¸·Î ³»¿ëÀÌ ÀÖ´Â °æ¿ì Ãß°¡ÇÑ´Ù.
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
sql1 = "select * from StudyBoard where BookName = '" &BookName& "' and CName = '" &CName& "' and JName = '"
&JName& "'"
Set rs1 = DBCon.Execute(sql1)
If rs1.Eof or rs1.Bof Then
Set rs1 = Nothing
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' ½ÇÁúÀûÀÎ DB Insert
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
sql = "insert into StudyBoard (BookName, CName, JName, S_Cont, S_count) values ('"
&BookName& "', '" &CName& "', '" &JName& "', '" &S_Cont& "', 0)"
DBCon.Execute(sql)
DBCon.Close
Set DBCon = Nothing
Else
S_Cont = rs1("S_cont") & "<br>" & S_Cont
Set rs1 = Nothing
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' ÀÌÀüÀÇ ³»¿ë¿¡ Ãß°¡
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
sql = "update StudyBoard set S_Cont = '" &S_Cont& "' where BookName = '" &BookName& "' and CName
= '" &CName& "' and JName = '" &JName& "'"
DBCon.Execute(sql)
DBCon.Close
Set DBCon = Nothing
End If
Response.Redirect "study_write.asp?BookName=" &BookName
Else
DBCon.Close
Set DBCon = Nothing
Response.Redirect "../default.asp"
End If
End If
End If
=============================================================
¹®Àå( S_Cont)¾È¿¡ ±×¸²ÆÄÀÏ¸íµµÇÔ²² »ðÀÔÇÏ°í ³»¿ëÀ» ÀÔ·ÂÇÒ¶§ ±×¸²ÆÄÀÏ À§Ä¡´Â -^±×¸²¸í(È®ÀåÀÚ Æ÷ÇÔ)^-À¸·Î Ç¥½ÃÇÏ°Ú²û
Çϴ°Űŵç¿ä.
¼öÇй®Á¦³¾¶§ Ư¼ö±âÈ£°¡ ¸¹¾Æ¼ ¹®Á¦Áß°£¿¡ ±×¸²À¸·Î µÎ°í ±Û¾²´Ù°¡ ´Ù½Ã ±×¸²¿Ã¸®°í ±×·±°Í À̰ŵç¿ä.
¹®Á¦³»¿ë¾È¿¡ ±×¸²À» ¿Ã¸®¸é¼ ű׸¦ »ç¿ëÇؼ ±×¸²À§Ä¡¸¦ ÀúÀåÇϴ°ǵ¥¿ä.
À§ ³»¿ëÀ» »çÀÌÆ®°¶·°½Ã·Î ´©°¡ º¯È¯Á» ÇØÁÖ¼¼¿ä ¤Ð¤Ð
|
|
|
|