diff --git a/approval/doc_myun_pay_print2.asp b/approval/doc_myun_pay_print2.asp
index be8d441..7f794d5 100644
--- a/approval/doc_myun_pay_print2.asp
+++ b/approval/doc_myun_pay_print2.asp
@@ -277,12 +277,12 @@
'request("aa")
query = "insert into 문서내용 (문서번호, 문서제목, target1, target2, target3, target4, target5, "
- query = query & " target6, target7, target8, target9, target10, target11, target12, target13, target14, target15, target16, target17, target20, target21, target97,target98,target99,target100,p_sn, 발급일, 발급시각, login_p_no, login_이름,login_ip) values ( "
+ query = query & " target6, target7, target8, target9, target10, target11, target12, target13, target14, target15, target16, target17, target20, target21, target97,target98,target99,target100,p_sn, 발급일, 발급시각, login_p_no, login_이름,login_ip, remark1) values ( "
query = query & "'" & krc_no & "', "
query = query & "'" & replace(title, " ", "") & "', "
query = query & "'" & gap(1) & "', "
query = query & "'" & CheckWord(gap(2)) & "', "
- query = query & "'" & gap(3) & "', "
+ query = query & "'" & year(date) & "-" & zeroformat(month(date),2) & "-" & zeroformat(day(date),2) & "', "
query = query & "'" & gap(4) & "', "
query = query & "'" & gap(5) & "', "
query = query & "'" & gap(6) & "', "
@@ -312,7 +312,7 @@
query = query & "'" & time() & "', "
query = query & "'" & user_name(0) & "', "
query = query & "'" & user_name(1) & "', "
- query = query & "'" & Session("USERIP") & "') "
+ query = query & "'" & Session("USERIP") & "', '3') "
'Response.Write query & "
"
adoconn.execute query
diff --git a/ess/doc_attach_add.asp b/ess/doc_attach_add.asp
new file mode 100644
index 0000000..64662a8
--- /dev/null
+++ b/ess/doc_attach_add.asp
@@ -0,0 +1,93 @@
+
+<%
+Response.CharSet = "euc-kr"
+Response.AddHeader "Pragma","no-cache"
+Response.Expires = -1
+
+Dim attachClientIp
+attachClientIp = Replace(Replace(Trim(Request.ServerVariables("REMOTE_ADDR")), "10.10.20.", "10.10.13."), "10.10.17.", "10.10.13.")
+
+If attachClientIp <> "10.10.13.47" And _
+ attachClientIp <> "10.10.13.105" And _
+ attachClientIp <> "10.10.13.48" And _
+ attachClientIp <> "10.10.13.6" And _
+ attachClientIp <> "10.10.13.29" Then
+ Response.Write "{""result"":""denied""}"
+ Response.End
+End If
+
+Dim uploadform, fso, krc_no, folderPath, i, foundSlot, targetPath, fileName, ext
+Dim allowedExt, folderObj, oneFile, us, dt, idxPart
+Dim usedSlot(20)
+
+' PDFs are rasterized into jpg on the client (pdf.js) before upload, same as the
+' registration page, so the server only ever needs to save the file as-is.
+allowedExt = "|jpg|jpeg|png|gif|zip|pdf|hwp|doc|docx|xls|xlsx|ppt|pptx|"
+
+Set uploadform = Server.CreateObject("DEXT.FileUpload")
+uploadform.Codepage = 949
+
+krc_no = uploadform("krc_no")
+
+If krc_no = "" Or InStr(krc_no, "..") > 0 Or InStr(krc_no, "/") > 0 Or InStr(krc_no, "\") > 0 Then
+ Response.Write "{""result"":""fail""}"
+ Response.End
+End If
+
+fileName = uploadform("attach_file")(1).FileName
+
+If fileName = "" Then
+ Response.Write "{""result"":""fail""}"
+ Response.End
+End If
+
+ext = LCase(Mid(fileName, InStrRev(fileName, ".") + 1))
+
+If InStr(allowedExt, "|" & ext & "|") = 0 Then
+ Response.Write "{""result"":""badtype""}"
+ Response.End
+End If
+
+Set fso = Server.CreateObject("Scripting.FileSystemObject")
+folderPath = Server.Mappath("/") & "/Upload/DOC_ATTACH/" & krc_no
+
+If fso.FolderExists(folderPath) = False Then
+ fso.CreateFolder folderPath
+End If
+
+' find used index slots regardless of extension
+Set folderObj = fso.GetFolder(folderPath)
+For Each oneFile In folderObj.Files
+ us = InStrRev(oneFile.Name, "_")
+ dt = InStrRev(oneFile.Name, ".")
+ If us > 0 And dt > us Then
+ idxPart = Mid(oneFile.Name, us + 1, dt - us - 1)
+ If IsNumeric(idxPart) Then
+ If CInt(idxPart) >= 1 And CInt(idxPart) <= 20 Then
+ usedSlot(CInt(idxPart)) = 1
+ End If
+ End If
+ End If
+Next
+
+foundSlot = 0
+For i = 1 To 20
+ If usedSlot(i) <> 1 Then
+ foundSlot = i
+ Exit For
+ End If
+Next
+
+If foundSlot = 0 Then
+ Response.Write "{""result"":""full""}"
+ Response.End
+End If
+
+targetPath = folderPath & "/" & krc_no & "_" & CStr(foundSlot) & "." & ext
+uploadform("attach_file")(1).saveAs(targetPath)
+
+Response.Write "{""result"":""ok""}"
+
+Set fso = Nothing
+Set uploadform = Nothing
+%>
diff --git a/ess/doc_attach_del.asp b/ess/doc_attach_del.asp
new file mode 100644
index 0000000..a8e82dc
--- /dev/null
+++ b/ess/doc_attach_del.asp
@@ -0,0 +1,83 @@
+
+<%
+Response.CharSet = "euc-kr"
+Response.AddHeader "Pragma","no-cache"
+Response.Expires = -1
+
+Dim attachClientIp
+attachClientIp = Replace(Replace(Trim(Request.ServerVariables("REMOTE_ADDR")), "10.10.20.", "10.10.13."), "10.10.17.", "10.10.13.")
+
+If attachClientIp <> "10.10.13.47" And _
+ attachClientIp <> "10.10.13.105" And _
+ attachClientIp <> "10.10.13.48" And _
+ attachClientIp <> "10.10.13.6" And _
+ attachClientIp <> "10.10.13.29" Then
+ Response.Write "{""result"":""denied""}"
+ Response.End
+End If
+
+Dim fso, krc_no, delIdx, folderPath, i, writePos
+Dim folderObj, oneFile, us, dt, idxPart, srcName, extPart
+Dim fileMap(20)
+
+krc_no = Request.Form("krc_no")
+
+If krc_no = "" Or InStr(krc_no, "..") > 0 Or InStr(krc_no, "/") > 0 Or InStr(krc_no, "\") > 0 Then
+ Response.Write "{""result"":""fail""}"
+ Response.End
+End If
+
+If Not IsNumeric(Request.Form("idx")) Then
+ Response.Write "{""result"":""fail""}"
+ Response.End
+End If
+
+delIdx = CInt(Request.Form("idx"))
+
+If delIdx < 1 Or delIdx > 20 Then
+ Response.Write "{""result"":""fail""}"
+ Response.End
+End If
+
+Set fso = Server.CreateObject("Scripting.FileSystemObject")
+folderPath = Server.Mappath("/") & "/Upload/DOC_ATTACH/" & krc_no
+
+If fso.FolderExists(folderPath) = False Then
+ Response.Write "{""result"":""ok""}"
+ Response.End
+End If
+
+Set folderObj = fso.GetFolder(folderPath)
+For Each oneFile In folderObj.Files
+ us = InStrRev(oneFile.Name, "_")
+ dt = InStrRev(oneFile.Name, ".")
+ If us > 0 And dt > us Then
+ idxPart = Mid(oneFile.Name, us + 1, dt - us - 1)
+ If IsNumeric(idxPart) Then
+ If CInt(idxPart) >= 1 And CInt(idxPart) <= 20 Then
+ fileMap(CInt(idxPart)) = oneFile.Name
+ End If
+ End If
+ End If
+Next
+
+If fileMap(delIdx) <> "" Then
+ fso.DeleteFile folderPath & "/" & fileMap(delIdx)
+ fileMap(delIdx) = ""
+End If
+
+' close the numbering gap, preserving each remaining file's own extension
+writePos = delIdx
+For i = delIdx + 1 To 20
+ If fileMap(i) <> "" Then
+ srcName = fileMap(i)
+ extPart = Mid(srcName, InStrRev(srcName, "."))
+ fso.MoveFile folderPath & "/" & srcName, folderPath & "/" & krc_no & "_" & CStr(writePos) & extPart
+ writePos = writePos + 1
+ End If
+Next
+
+Response.Write "{""result"":""ok""}"
+
+Set fso = Nothing
+%>
diff --git a/ess/doc_expense2_print_2014.asp b/ess/doc_expense2_print_2014.asp
index 6915767..6fd527c 100644
--- a/ess/doc_expense2_print_2014.asp
+++ b/ess/doc_expense2_print_2014.asp
@@ -30,6 +30,9 @@
'--------------- 추가(20170306)↓ ------------------------
dim xadmin : xadmin = request("xadmin") '-- 수정(edit)
+ dim attachClientIp, attachEditAllowed
+ attachClientIp = Replace(Replace(Trim(Request.ServerVariables("REMOTE_ADDR")), "10.10.20.", "10.10.13."), "10.10.17.", "10.10.13.")
+ attachEditAllowed = (attachClientIp = "10.10.13.47" Or attachClientIp = "10.10.13.105" Or attachClientIp = "10.10.13.48" Or attachClientIp = "10.10.13.6" Or attachClientIp = "10.10.13.29")
'response.write "[" & xadmin & "]"
dim pay_type(4)
@@ -915,7 +918,7 @@ if rsc.RecordCount > 0 then
%>