first commit
This commit is contained in:
44
Lib/ApiLog.asp
Normal file
44
Lib/ApiLog.asp
Normal file
@@ -0,0 +1,44 @@
|
||||
<%
|
||||
'###########################################################################################
|
||||
'api 호출 바디 구하기
|
||||
'return : string
|
||||
'###########################################################################################
|
||||
Function ReadRequestBodySafe()
|
||||
Dim ctype : ctype = LCase(Request.ServerVariables("CONTENT_TYPE"))
|
||||
Dim body : body = ""
|
||||
|
||||
' JSON/XML/Text 류만 BinaryRead 시도
|
||||
If InStr(ctype, "application/json")>0 Or InStr(ctype, "text/")>0 Or InStr(ctype, "application/xml")>0 Or InStr(ctype, "application/vnd.api+json")>0 Then
|
||||
If Request.TotalBytes > 0 Then
|
||||
On Error Resume Next
|
||||
Dim bin, stm
|
||||
bin = Request.BinaryRead(Request.TotalBytes) ' 이미 Form을 썼다면 여기서 0206 발생
|
||||
If Err.Number = 0 Then
|
||||
Set stm = Server.CreateObject("ADODB.Stream")
|
||||
stm.Type = 1 : stm.Open : stm.Write bin
|
||||
stm.Position = 0 : stm.Type = 2 : stm.Charset = "utf-8"
|
||||
body = stm.ReadText
|
||||
stm.Close : Set stm = Nothing
|
||||
End If
|
||||
Err.Clear
|
||||
On Error GoTo 0
|
||||
End If
|
||||
' HTML Form-URL-Encoded: BinaryRead 금지, 키-값으로 요약
|
||||
ElseIf InStr(ctype, "application/x-www-form-urlencoded")>0 Then
|
||||
Dim k, s : s = ""
|
||||
For Each k In Request.Form ' 여기서 처음 Form을 파싱하도록 함
|
||||
s = s & k & "=" & Request.Form(k) & "&"
|
||||
Next
|
||||
If Len(s) > 0 Then
|
||||
s = Left(s, Len(s)-1)
|
||||
End If
|
||||
body = s
|
||||
|
||||
' Multipart/Form-Data: 대용량/파일 포함 가능 → 요약만
|
||||
ElseIf InStr(ctype, "multipart/form-data")>0 Then
|
||||
body = "[multipart/form-data length=" & Request.TotalBytes & " bytes]"
|
||||
End If
|
||||
|
||||
ReadRequestBodySafe = body
|
||||
End Function
|
||||
%>
|
||||
240
Lib/Base64.asp
Normal file
240
Lib/Base64.asp
Normal file
@@ -0,0 +1,240 @@
|
||||
<%
|
||||
Dim sBASE_64_CHARACTERS
|
||||
Dim sBASE_64_CHARACTERSansi
|
||||
|
||||
|
||||
' Base64 ==================================================
|
||||
|
||||
sBASE_64_CHARACTERS= "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
|
||||
sBASE_64_CHARACTERSansi = strUnicode2Ansi(sBASE_64_CHARACTERS)
|
||||
|
||||
|
||||
Function strUnicodeLen(asContents)
|
||||
Dim asContents1 : asContents1 ="a" & asContents
|
||||
Dim Len1 : Len1=Len(asContents1)
|
||||
Dim K : K=0
|
||||
Dim I, Asc1
|
||||
|
||||
For I=1 To Len1
|
||||
Asc1 = asc(mid(asContents1,I,1))
|
||||
IF Asc1 < 0 Then Asc1 = 65536 + Asc1
|
||||
IF Asc1 > 255 Then
|
||||
K = K + 2
|
||||
ELSE
|
||||
K = K + 1
|
||||
End IF
|
||||
Next
|
||||
|
||||
strUnicodeLen = K - 1
|
||||
End Function
|
||||
|
||||
Function strUnicode2Ansi(asContents)
|
||||
Dim Len1 : Len1 = Len(asContents)
|
||||
Dim I, VarCHAR, VarASC, VarHEX, VarLOW, VarHIGH
|
||||
|
||||
strUnicode2Ansi = ""
|
||||
|
||||
For I = 1 to Len1
|
||||
VarCHAR = Mid(asContents,I,1)
|
||||
VarASC = Asc(VarCHAR)
|
||||
IF VarASC < 0 Then VarASC = VarASC + 65536
|
||||
IF VarASC > 255 Then
|
||||
VarHEX = Hex(VarASC)
|
||||
VarLOW = Left(VarHEX,2)
|
||||
VarHIGH = Right(VarHEX,2)
|
||||
strUnicode2Ansi = strUnicode2Ansi & ChrB("&H" & VarLOW ) & ChrB("&H" & VarHIGH )
|
||||
Else
|
||||
strUnicode2Ansi = strUnicode2Ansi & ChrB(VarASC)
|
||||
End IF
|
||||
Next
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
Function strAnsi2Unicode(asContents)
|
||||
Dim Len1 : Len1 = LenB(asContents)
|
||||
Dim VarCHAR, VarASC, I
|
||||
|
||||
strAnsi2Unicode = ""
|
||||
|
||||
IF Len1=0 Then Exit Function
|
||||
|
||||
For I=1 To Len1
|
||||
VarCHAR = MidB(asContents,I,1)
|
||||
VarASC = AscB(VarCHAR)
|
||||
IF VarASC > 127 Then
|
||||
strAnsi2Unicode = strAnsi2Unicode & Chr(AscW(MidB(asContents, I+1,1) & VarCHAR))
|
||||
I = I + 1
|
||||
Else
|
||||
strAnsi2Unicode = strAnsi2Unicode & Chr(VarASC)
|
||||
End IF
|
||||
Next
|
||||
|
||||
End function
|
||||
|
||||
Function Base64encode(asContents)
|
||||
Dim lnPosition
|
||||
Dim lsResult
|
||||
Dim Char1
|
||||
Dim Char2
|
||||
Dim Char3
|
||||
Dim Char4
|
||||
Dim Byte1
|
||||
Dim Byte2
|
||||
Dim Byte3
|
||||
Dim SaveBits1
|
||||
Dim SaveBits2
|
||||
Dim lsGroupBinary
|
||||
Dim lsGroup64
|
||||
Dim M3, M4, Len1, Len2
|
||||
|
||||
Len1 =LenB(asContents)
|
||||
|
||||
IF Len1 < 1 Then
|
||||
Base64encode = ""
|
||||
Exit Function
|
||||
End IF
|
||||
|
||||
M3=Len1 Mod 3
|
||||
|
||||
IF M3 > 0 Then asContents = asContents & String(3 - M3, ChrB(0))
|
||||
|
||||
IF m3 > 0 Then
|
||||
Len1 = Len1 + (3 - M3)
|
||||
Len2 = Len1 - 3
|
||||
Else
|
||||
Len2 = Len1
|
||||
End IF
|
||||
|
||||
lsResult = ""
|
||||
|
||||
For lnPosition = 1 To Len2 Step 3
|
||||
lsGroup64 = ""
|
||||
lsGroupBinary = MidB(asContents, lnPosition, 3)
|
||||
|
||||
Byte1 = AscB(MidB(lsGroupBinary, 1, 1)) : SaveBits1 = Byte1 And 3
|
||||
Byte2 = AscB(MidB(lsGroupBinary, 2, 1)) : SaveBits2 = Byte2 And 15
|
||||
Byte3 = AscB(MidB(lsGroupBinary, 3, 1))
|
||||
|
||||
Char1 = MidB(sBASE_64_CHARACTERSansi, ((Byte1 And 252) \ 4) + 1, 1)
|
||||
Char2 = MidB(sBASE_64_CHARACTERSansi, (((Byte2 And 240) \ 16) Or (SaveBits1 * 16) And &HFF) + 1, 1)
|
||||
Char3 = MidB(sBASE_64_CHARACTERSansi, (((Byte3 And 192) \ 64) Or (SaveBits2 * 4) And &HFF) + 1, 1)
|
||||
Char4 = MidB(sBASE_64_CHARACTERSansi, (Byte3 And 63) + 1, 1)
|
||||
lsGroup64 = Char1 & Char2 & Char3 & Char4
|
||||
|
||||
lsResult = lsResult & lsGroup64
|
||||
Next
|
||||
|
||||
IF M3 > 0 Then
|
||||
lsGroup64 = ""
|
||||
lsGroupBinary = MidB(asContents, Len2 + 1, 3)
|
||||
|
||||
Byte1 = AscB(MidB(lsGroupBinary, 1, 1)) : SaveBits1 = Byte1 And 3
|
||||
Byte2 = AscB(MidB(lsGroupBinary, 2, 1)) : SaveBits2 = Byte2 And 15
|
||||
Byte3 = AscB(MidB(lsGroupBinary, 3, 1))
|
||||
|
||||
Char1 = MidB(sBASE_64_CHARACTERSansi, ((Byte1 And 252) \ 4) + 1, 1)
|
||||
Char2 = MidB(sBASE_64_CHARACTERSansi, (((Byte2 And 240) \ 16) Or (SaveBits1 * 16) And &HFF) + 1, 1)
|
||||
Char3 = MidB(sBASE_64_CHARACTERSansi, (((Byte3 And 192) \ 64) Or (SaveBits2 * 4) And &HFF) + 1, 1)
|
||||
|
||||
IF M3=1 Then
|
||||
lsGroup64 = Char1 & Char2 & ChrB(61) & ChrB(61)
|
||||
Else
|
||||
lsGroup64 = Char1 & Char2 & Char3 & ChrB(61)
|
||||
End IF
|
||||
|
||||
lsResult = lsResult & lsGroup64
|
||||
End IF
|
||||
|
||||
Base64encode = lsResult
|
||||
End Function
|
||||
|
||||
Function Base64decode(asContents)
|
||||
Dim lsResult
|
||||
Dim lnPosition
|
||||
Dim lsGroup64, lsGroupBinary
|
||||
Dim Char1, Char2, Char3, Char4
|
||||
Dim Byte1, Byte2, Byte3
|
||||
Dim M4, Len1, Len2
|
||||
|
||||
Len1 = LenB(asContents)
|
||||
M4 = Len1 Mod 4
|
||||
|
||||
IF Len1 < 1 Or M4 > 0 Then
|
||||
Base64decode = ""
|
||||
Exit Function
|
||||
End IF
|
||||
|
||||
IF MidB(asContents, Len1, 1) = ChrB(61) Then M4 = 3
|
||||
IF MidB(asContents, Len1-1, 1) = ChrB(61) Then M4 = 2
|
||||
|
||||
IF M4 = 0 Then
|
||||
Len2 = Len1
|
||||
Else
|
||||
Len2 = Len1 - 4
|
||||
End IF
|
||||
|
||||
For lnPosition = 1 To Len2 Step 4
|
||||
lsGroupBinary = ""
|
||||
lsGroup64 = MidB(asContents, lnPosition, 4)
|
||||
|
||||
Char1 = InStrB(sBASE_64_CHARACTERSansi, MidB(lsGroup64, 1, 1)) - 1
|
||||
Char2 = InStrB(sBASE_64_CHARACTERSansi, MidB(lsGroup64, 2, 1)) - 1
|
||||
Char3 = InStrB(sBASE_64_CHARACTERSansi, MidB(lsGroup64, 3, 1)) - 1
|
||||
Char4 = InStrB(sBASE_64_CHARACTERSansi, MidB(lsGroup64, 4, 1)) - 1
|
||||
|
||||
Byte1 = ChrB(((Char2 And 48) \ 16) Or (Char1 * 4) And &HFF)
|
||||
Byte2 = lsGroupBinary & ChrB(((Char3 And 60) \ 4) Or (Char2 * 16) And &HFF)
|
||||
Byte3 = ChrB((((Char3 And 3) * 64) And &HFF) Or (Char4 And 63))
|
||||
lsGroupBinary = Byte1 & Byte2 & Byte3
|
||||
|
||||
lsResult = lsResult & lsGroupBinary
|
||||
Next
|
||||
|
||||
IF M4 > 0 Then
|
||||
lsGroupBinary = ""
|
||||
lsGroup64 = MidB(asContents, Len2 + 1, M4) & ChrB(65)
|
||||
IF M4=2 Then
|
||||
lsGroup64 = lsGroup64 & chrB(65)
|
||||
End IF
|
||||
Char1 = InStrB(sBASE_64_CHARACTERSansi, MidB(lsGroup64, 1, 1)) - 1
|
||||
Char2 = InStrB(sBASE_64_CHARACTERSansi, MidB(lsGroup64, 2, 1)) - 1
|
||||
Char3 = InStrB(sBASE_64_CHARACTERSansi, MidB(lsGroup64, 3, 1)) - 1
|
||||
Char4 = InStrB(sBASE_64_CHARACTERSansi, MidB(lsGroup64, 4, 1)) - 1
|
||||
|
||||
Byte1 = ChrB(((Char2 And 48) \ 16) Or (Char1 * 4) And &HFF)
|
||||
Byte2 = lsGroupBinary & ChrB(((Char3 And 60) \ 4) Or (Char2 * 16) And &HFF)
|
||||
Byte3 = ChrB((((Char3 And 3) * 64) And &HFF) Or (Char4 And 63))
|
||||
|
||||
IF M4=2 Then
|
||||
lsGroupBinary = Byte1
|
||||
elseIF M4=3 Then
|
||||
lsGroupBinary = Byte1 & Byte2
|
||||
end IF
|
||||
|
||||
lsResult = lsResult & lsGroupBinary
|
||||
End IF
|
||||
|
||||
Base64decode = lsResult
|
||||
End Function
|
||||
|
||||
|
||||
'###########################################################
|
||||
'###########################################################
|
||||
|
||||
' Base64 <20><><EFBFBD>ڵ<EFBFBD>
|
||||
Function Base64_Encode(ORIGNvalue)
|
||||
Base64_Encode = strAnsi2Unicode(Base64encode(strUnicode2Ansi(ORIGNvalue)))
|
||||
End Function
|
||||
|
||||
' Base64 <20><><EFBFBD>ڵ<EFBFBD>
|
||||
Function Base64_Decode(EncodeA)
|
||||
Base64_Decode = strAnsi2Unicode(Base64decode(strUnicode2Ansi(EncodeA)))
|
||||
End Function
|
||||
|
||||
'###########################################################
|
||||
'###########################################################
|
||||
' Base64 ==================================================
|
||||
|
||||
|
||||
%>
|
||||
241
Lib/CAPICOM.asp
Normal file
241
Lib/CAPICOM.asp
Normal file
@@ -0,0 +1,241 @@
|
||||
<%
|
||||
Dim sBASE_64_CHARACTERS, sBASE_64_CHARACTERSansi
|
||||
sBASE_64_CHARACTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
|
||||
sBASE_64_CHARACTERSansi = strUnicode2Ansi(sBASE_64_CHARACTERS)
|
||||
|
||||
|
||||
Function strUnicodeLen(asContents)
|
||||
Dim asContents1 : asContents1 ="a" & asContents
|
||||
Dim Len1 : Len1=Len(asContents1)
|
||||
Dim K : K=0
|
||||
Dim I, Asc1
|
||||
|
||||
For I=1 To Len1
|
||||
Asc1 = asc(mid(asContents1,I,1))
|
||||
IF Asc1 < 0 Then Asc1 = 65536 + Asc1
|
||||
IF Asc1 > 255 Then
|
||||
K = K + 2
|
||||
ELSE
|
||||
K = K + 1
|
||||
End IF
|
||||
Next
|
||||
|
||||
strUnicodeLen = K - 1
|
||||
End Function
|
||||
|
||||
Function strUnicode2Ansi(asContents)
|
||||
Dim Len1 : Len1 = Len(asContents)
|
||||
Dim I, VarCHAR, VarASC, VarHEX, VarLOW, VarHIGH
|
||||
|
||||
strUnicode2Ansi = ""
|
||||
|
||||
For I = 1 to Len1
|
||||
VarCHAR = Mid(asContents,I,1)
|
||||
VarASC = Asc(VarCHAR)
|
||||
IF VarASC < 0 Then VarASC = VarASC + 65536
|
||||
IF VarASC > 255 Then
|
||||
VarHEX = Hex(VarASC)
|
||||
VarLOW = Left(VarHEX,2)
|
||||
VarHIGH = Right(VarHEX,2)
|
||||
strUnicode2Ansi = strUnicode2Ansi & ChrB("&H" & VarLOW ) & ChrB("&H" & VarHIGH )
|
||||
Else
|
||||
strUnicode2Ansi = strUnicode2Ansi & ChrB(VarASC)
|
||||
End IF
|
||||
Next
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
Function strAnsi2Unicode(asContents)
|
||||
Dim Len1 : Len1 = LenB(asContents)
|
||||
Dim VarCHAR, VarASC, I
|
||||
|
||||
strAnsi2Unicode = ""
|
||||
|
||||
IF Len1=0 Then Exit Function
|
||||
|
||||
For I=1 To Len1
|
||||
VarCHAR = MidB(asContents,I,1)
|
||||
VarASC = AscB(VarCHAR)
|
||||
IF VarASC > 127 Then
|
||||
strAnsi2Unicode = strAnsi2Unicode & Chr(AscW(MidB(asContents, I+1,1) & VarCHAR))
|
||||
I = I + 1
|
||||
Else
|
||||
strAnsi2Unicode = strAnsi2Unicode & Chr(VarASC)
|
||||
End IF
|
||||
Next
|
||||
|
||||
End function
|
||||
|
||||
Function Base64encode(asContents)
|
||||
Dim lnPosition
|
||||
Dim lsResult
|
||||
Dim Char1
|
||||
Dim Char2
|
||||
Dim Char3
|
||||
Dim Char4
|
||||
Dim Byte1
|
||||
Dim Byte2
|
||||
Dim Byte3
|
||||
Dim SaveBits1
|
||||
Dim SaveBits2
|
||||
Dim lsGroupBinary
|
||||
Dim lsGroup64
|
||||
Dim M3, M4, Len1, Len2
|
||||
|
||||
Len1 =LenB(asContents)
|
||||
|
||||
IF Len1 < 1 Then
|
||||
Base64encode = ""
|
||||
Exit Function
|
||||
End IF
|
||||
|
||||
M3=Len1 Mod 3
|
||||
|
||||
IF M3 > 0 Then asContents = asContents & String(3 - M3, ChrB(0))
|
||||
|
||||
IF m3 > 0 Then
|
||||
Len1 = Len1 + (3 - M3)
|
||||
Len2 = Len1 - 3
|
||||
Else
|
||||
Len2 = Len1
|
||||
End IF
|
||||
|
||||
lsResult = ""
|
||||
|
||||
For lnPosition = 1 To Len2 Step 3
|
||||
lsGroup64 = ""
|
||||
lsGroupBinary = MidB(asContents, lnPosition, 3)
|
||||
|
||||
Byte1 = AscB(MidB(lsGroupBinary, 1, 1)) : SaveBits1 = Byte1 And 3
|
||||
Byte2 = AscB(MidB(lsGroupBinary, 2, 1)) : SaveBits2 = Byte2 And 15
|
||||
Byte3 = AscB(MidB(lsGroupBinary, 3, 1))
|
||||
|
||||
Char1 = MidB(sBASE_64_CHARACTERSansi, ((Byte1 And 252) \ 4) + 1, 1)
|
||||
Char2 = MidB(sBASE_64_CHARACTERSansi, (((Byte2 And 240) \ 16) Or (SaveBits1 * 16) And &HFF) + 1, 1)
|
||||
Char3 = MidB(sBASE_64_CHARACTERSansi, (((Byte3 And 192) \ 64) Or (SaveBits2 * 4) And &HFF) + 1, 1)
|
||||
Char4 = MidB(sBASE_64_CHARACTERSansi, (Byte3 And 63) + 1, 1)
|
||||
lsGroup64 = Char1 & Char2 & Char3 & Char4
|
||||
|
||||
lsResult = lsResult & lsGroup64
|
||||
Next
|
||||
|
||||
IF M3 > 0 Then
|
||||
lsGroup64 = ""
|
||||
lsGroupBinary = MidB(asContents, Len2 + 1, 3)
|
||||
|
||||
Byte1 = AscB(MidB(lsGroupBinary, 1, 1)) : SaveBits1 = Byte1 And 3
|
||||
Byte2 = AscB(MidB(lsGroupBinary, 2, 1)) : SaveBits2 = Byte2 And 15
|
||||
Byte3 = AscB(MidB(lsGroupBinary, 3, 1))
|
||||
|
||||
Char1 = MidB(sBASE_64_CHARACTERSansi, ((Byte1 And 252) \ 4) + 1, 1)
|
||||
Char2 = MidB(sBASE_64_CHARACTERSansi, (((Byte2 And 240) \ 16) Or (SaveBits1 * 16) And &HFF) + 1, 1)
|
||||
Char3 = MidB(sBASE_64_CHARACTERSansi, (((Byte3 And 192) \ 64) Or (SaveBits2 * 4) And &HFF) + 1, 1)
|
||||
|
||||
IF M3=1 Then
|
||||
lsGroup64 = Char1 & Char2 & ChrB(61) & ChrB(61)
|
||||
Else
|
||||
lsGroup64 = Char1 & Char2 & Char3 & ChrB(61)
|
||||
End IF
|
||||
|
||||
lsResult = lsResult & lsGroup64
|
||||
End IF
|
||||
|
||||
Base64encode = lsResult
|
||||
End Function
|
||||
|
||||
Function Base64decode(asContents)
|
||||
Dim lsResult
|
||||
Dim lnPosition
|
||||
Dim lsGroup64, lsGroupBinary
|
||||
Dim Char1, Char2, Char3, Char4
|
||||
Dim Byte1, Byte2, Byte3
|
||||
Dim M4, Len1, Len2
|
||||
|
||||
Len1 = LenB(asContents)
|
||||
M4 = Len1 Mod 4
|
||||
|
||||
IF Len1 < 1 Or M4 > 0 Then
|
||||
Base64decode = ""
|
||||
Exit Function
|
||||
End IF
|
||||
|
||||
IF MidB(asContents, Len1, 1) = ChrB(61) Then M4 = 3
|
||||
IF MidB(asContents, Len1-1, 1) = ChrB(61) Then M4 = 2
|
||||
|
||||
IF M4 = 0 Then
|
||||
Len2 = Len1
|
||||
Else
|
||||
Len2 = Len1 - 4
|
||||
End IF
|
||||
|
||||
For lnPosition = 1 To Len2 Step 4
|
||||
lsGroupBinary = ""
|
||||
lsGroup64 = MidB(asContents, lnPosition, 4)
|
||||
|
||||
Char1 = InStrB(sBASE_64_CHARACTERSansi, MidB(lsGroup64, 1, 1)) - 1
|
||||
Char2 = InStrB(sBASE_64_CHARACTERSansi, MidB(lsGroup64, 2, 1)) - 1
|
||||
Char3 = InStrB(sBASE_64_CHARACTERSansi, MidB(lsGroup64, 3, 1)) - 1
|
||||
Char4 = InStrB(sBASE_64_CHARACTERSansi, MidB(lsGroup64, 4, 1)) - 1
|
||||
|
||||
Byte1 = ChrB(((Char2 And 48) \ 16) Or (Char1 * 4) And &HFF)
|
||||
Byte2 = lsGroupBinary & ChrB(((Char3 And 60) \ 4) Or (Char2 * 16) And &HFF)
|
||||
Byte3 = ChrB((((Char3 And 3) * 64) And &HFF) Or (Char4 And 63))
|
||||
lsGroupBinary = Byte1 & Byte2 & Byte3
|
||||
|
||||
lsResult = lsResult & lsGroupBinary
|
||||
Next
|
||||
|
||||
IF M4 > 0 Then
|
||||
lsGroupBinary = ""
|
||||
lsGroup64 = MidB(asContents, Len2 + 1, M4) & ChrB(65)
|
||||
IF M4=2 Then
|
||||
lsGroup64 = lsGroup64 & chrB(65)
|
||||
End IF
|
||||
Char1 = InStrB(sBASE_64_CHARACTERSansi, MidB(lsGroup64, 1, 1)) - 1
|
||||
Char2 = InStrB(sBASE_64_CHARACTERSansi, MidB(lsGroup64, 2, 1)) - 1
|
||||
Char3 = InStrB(sBASE_64_CHARACTERSansi, MidB(lsGroup64, 3, 1)) - 1
|
||||
Char4 = InStrB(sBASE_64_CHARACTERSansi, MidB(lsGroup64, 4, 1)) - 1
|
||||
|
||||
Byte1 = ChrB(((Char2 And 48) \ 16) Or (Char1 * 4) And &HFF)
|
||||
Byte2 = lsGroupBinary & ChrB(((Char3 And 60) \ 4) Or (Char2 * 16) And &HFF)
|
||||
Byte3 = ChrB((((Char3 And 3) * 64) And &HFF) Or (Char4 And 63))
|
||||
|
||||
IF M4=2 Then
|
||||
lsGroupBinary = Byte1
|
||||
elseIF M4=3 Then
|
||||
lsGroupBinary = Byte1 & Byte2
|
||||
end IF
|
||||
|
||||
lsResult = lsResult & lsGroupBinary
|
||||
End IF
|
||||
|
||||
Base64decode = lsResult
|
||||
End Function
|
||||
|
||||
|
||||
Public Function Encrypt(Message)
|
||||
Dim ed, key
|
||||
key = gcKEY
|
||||
|
||||
Set ed = CreateObject("CAPICOM.EncryptedData")
|
||||
ed.Content = Message
|
||||
ed.SetSecret key
|
||||
Encrypt = ed.Encrypt
|
||||
Set ed = Nothing
|
||||
End Function
|
||||
|
||||
Public Function Decrypt(EncMessage)
|
||||
Dim ed, key
|
||||
|
||||
key = gcKEY
|
||||
Set ed = CreateObject("CAPICOM.EncryptedData")
|
||||
|
||||
ed.SetSecret key
|
||||
ed.Decrypt EncMessage
|
||||
Decrypt = ed.Content
|
||||
|
||||
Set ed = Nothing
|
||||
End Function
|
||||
|
||||
%>
|
||||
693
Lib/ComLib.asp
Normal file
693
Lib/ComLib.asp
Normal file
@@ -0,0 +1,693 @@
|
||||
<%
|
||||
'###########################################################################################
|
||||
'Request 데이터 받아오기
|
||||
'###########################################################################################
|
||||
|
||||
Function getRD(dataname)
|
||||
If Not IsNull(Request.Form(dataname)) Then
|
||||
getRD = getRF(dataname)
|
||||
ElseIf Not IsNull(Request.QueryString(dataname)) Then
|
||||
getRD = getRQ(dataname)
|
||||
Else
|
||||
getRD = null
|
||||
End If
|
||||
End Function
|
||||
|
||||
Function getRF(dataname)
|
||||
getRF=checkValue(Request.Form(dataname))
|
||||
End Function
|
||||
|
||||
Function getRQ(dataname)
|
||||
getRQ=checkValue(Request.QueryString(dataname))
|
||||
End Function
|
||||
|
||||
Function getR(dataname)
|
||||
getR=checkValue(Request(dataname))
|
||||
End Function
|
||||
|
||||
'###########################################################################################
|
||||
'lenchk : 바이트수 짜르기
|
||||
' title_msg - 문자열
|
||||
' title_length - 짜를바이트수
|
||||
'###########################################################################################
|
||||
function lenchk(title_msg,title_length)
|
||||
dim k,tmpv,j,tmps
|
||||
k = 0
|
||||
tmpv=""
|
||||
|
||||
if vartype(title_msg) = vbnull or trim(title_msg)="" then
|
||||
lenchk = title_msg
|
||||
exit Function
|
||||
End If
|
||||
|
||||
If Len(title_msg)<CLng(title_length) Then
|
||||
lenchk = title_msg
|
||||
exit Function
|
||||
end if
|
||||
|
||||
for j = 1 to len(title_msg)
|
||||
tmps = asc(mid(title_msg,j,1))
|
||||
if tmps < 0 then
|
||||
k=k+2
|
||||
else
|
||||
k=k+1
|
||||
end if
|
||||
if k > clng(title_length) then
|
||||
exit for
|
||||
else
|
||||
tmpv= tmpv & mid(title_msg,j,1)
|
||||
end if
|
||||
next
|
||||
|
||||
if len(title_msg) > int(title_length / 2) then
|
||||
lenchk = tmpv &"..."
|
||||
else
|
||||
lenchk = tmpv
|
||||
end if
|
||||
|
||||
end Function
|
||||
|
||||
'###########################################################################################
|
||||
' 숫자0채우기 : format(123, "00000") ==> 000123
|
||||
'###########################################################################################
|
||||
Function format(ByVal szString, ByVal Expression)
|
||||
If Len(szString) < Len(Expression) Then
|
||||
format = Left(expression,Len(Expression)-Len(szString)) & szString
|
||||
Else
|
||||
format = szString
|
||||
End If
|
||||
End Function
|
||||
|
||||
'###########################################################################################
|
||||
' 문자짜르고점으로표현 : cutString("스트링문자들",num) ==> 스트링문...
|
||||
'###########################################################################################
|
||||
Function cutString(ByVal szString,num)
|
||||
if len(szString) > num then
|
||||
cutString = left(szString,9) & "..."
|
||||
end if
|
||||
End Function
|
||||
|
||||
'##############################################################################
|
||||
'#날짜 2자리로 만들기
|
||||
'##############################################################################
|
||||
Function DateLenChk(dat)
|
||||
If Len(Trim(dat))=1 Then
|
||||
DateLenChk = "0" & Trim(dat)
|
||||
Else
|
||||
DateLenChk = Trim(dat)
|
||||
End IF
|
||||
End Function
|
||||
|
||||
'###########################################################################################
|
||||
'정규식을 이용하여 문자열을 치환하는 함수
|
||||
'###########################################################################################
|
||||
Public Function eregi_replace(ByVal pattern, ByVal replacestr, ByVal text)
|
||||
Dim eregObj
|
||||
|
||||
'** Create regular expression
|
||||
Set eregObj = New RegExp
|
||||
|
||||
eregObj.Pattern = pattern '** Set Pattern(패턴 설정)
|
||||
eregObj.IgnoreCase = True '** Set Case Insensitivity(대소문자 구분 여부)
|
||||
eregObj.Global = True '** Set All Replace(전체 문서에서 검색)
|
||||
|
||||
eregi_replace = eregObj.Replace(text, replacestr) '** Replace String
|
||||
End Function
|
||||
|
||||
|
||||
'###########################################################################################
|
||||
'HTML 실행 방지 함수
|
||||
'###########################################################################################
|
||||
Public Function SpecialHtmlChars(ByVal str, ByVal dtype, ByVal tags)
|
||||
Dim contents: contents = str
|
||||
Dim doctype: doctype = LCase(dtype)
|
||||
Dim allowTagList: allowTagList = Replace(tags,",","|")
|
||||
|
||||
if str<>"" Then
|
||||
Select Case doctype
|
||||
Case "text"
|
||||
contents = Replace(contents,"<","<")
|
||||
contents = Replace(contents,">",">")
|
||||
contents = Replace(contents," "," ")
|
||||
contents = Replace(contents," "," ")
|
||||
contents = Replace(contents,Chr(13),"<br />") '** 줄바꿈을 <br />태그로 변환
|
||||
|
||||
Case "html"
|
||||
contents = eregi_replace("<(\/?)(?!\/|" & allowTagList & ")([^<>]*)?>", "<$1$2>", contents) '** 허용한 태그 이외의 모든 태그를 변환
|
||||
contents = eregi_replace("(javascript\:|vbscript\:)+","$1** ",contents) '** 클라이언트 스크립트 실행 방지
|
||||
contents = eregi_replace("(\.location|location\.|onload=|\.cookie|alert\(|window\.open\(|onmouse|onkey|onclick|view\-source\:)+", "** ", contents) '** 스크립트 이벤트 실행 방지
|
||||
contents = Replace(contents,"<" & "%","<%") '** ASP태그 방지
|
||||
contents = Replace(contents,"%" & ">","<%") '** ASP태그 방지
|
||||
|
||||
Case "br"
|
||||
contents = eregi_replace("<(\/?)(?!\/|" & allowTagList & ")([^<>]*)?>", "<$1$2>", contents) '** 허용한 태그 이외의 모든 태그를 변환
|
||||
contents = eregi_replace("(javascript\:|vbscript\:)+","$1** ",contents) '** 클라이언트 스크립트 실행 방지
|
||||
contents = eregi_replace("(\.location|location\.|onload=|\.cookie|alert\(|window\.open\(|onmouse|onkey|onclick|view\-source\:)+", "** ", contents) '** 스크립트 이벤트 실행 방지
|
||||
contents = Replace(contents,"<" & "%","<%") '** ASP태그 방지
|
||||
contents = Replace(contents,"%" & ">","<%") '** ASP태그 방지
|
||||
contents = Replace(contents,Chr(13),"<br />") '** 줄바꿈을 <br />태그로 바꿈
|
||||
Case Else
|
||||
contents = eregi_replace("<(\/?)(?!\/|)([^<>]*)?>","<$1$2>", contents) '** 모든 <>태그 실행 방지
|
||||
contents = Replace(contents,Chr(13),"<br />") '** 줄바꿈을 <br />태그로 바꿈
|
||||
End Select
|
||||
Else
|
||||
contents = ""
|
||||
End if
|
||||
|
||||
SpecialHtmlChars = contents
|
||||
End Function
|
||||
|
||||
'#################################################################################
|
||||
'# 금액에 콤마넣기
|
||||
'#################################################################################
|
||||
|
||||
Function InsertComma(money)
|
||||
Dim Value,factor,su,src,comi
|
||||
if not money = "" AND Not isNull(money) then
|
||||
if mid(money,1,1)="-" then
|
||||
Value = mid(money,2,len(money))
|
||||
else
|
||||
Value =money
|
||||
end if
|
||||
factor = len(Value) MOD 3
|
||||
su = (len(Value) - factor) / 3
|
||||
src = mid(Value,1,factor)
|
||||
|
||||
For comi = 0 to su-1
|
||||
|
||||
if factor = 0 and comi = 0 then
|
||||
src = src&mid(Value, factor+(3*comi)+1, 3)
|
||||
else
|
||||
src = src&","
|
||||
src = src&mid(Value, factor+(3*comi)+1, 3)
|
||||
end if
|
||||
next
|
||||
|
||||
if mid(money,1,1)="-" then
|
||||
insertComma = "-"&src
|
||||
else
|
||||
insertComma = src
|
||||
end if
|
||||
else
|
||||
insertComma=0
|
||||
end if
|
||||
End Function
|
||||
|
||||
'#################################################################################
|
||||
'# 금액에 콤마넣기
|
||||
'#################################################################################
|
||||
|
||||
Function InsertCommaNull(money)
|
||||
|
||||
Dim factor,su,src,comi
|
||||
if not money = "" AND Not isNull(money) then
|
||||
if mid(money,1,1)="-" then
|
||||
Value = mid(money,2,len(money))
|
||||
else
|
||||
Value =money
|
||||
end if
|
||||
factor = len(Value) MOD 3
|
||||
su = (len(Value) - factor) / 3
|
||||
src = mid(Value,1,factor)
|
||||
|
||||
For comi = 0 to su-1
|
||||
|
||||
if factor = 0 and comi = 0 then
|
||||
src = src&mid(Value, factor+(3*comi)+1, 3)
|
||||
else
|
||||
src = src&","
|
||||
src = src&mid(Value, factor+(3*comi)+1, 3)
|
||||
end if
|
||||
next
|
||||
|
||||
if mid(money,1,1)="-" then
|
||||
InsertCommaNull = "-"&src
|
||||
else
|
||||
InsertCommaNull = src
|
||||
end if
|
||||
else
|
||||
InsertCommaNull=""
|
||||
end if
|
||||
End Function
|
||||
|
||||
'#################################################################################
|
||||
'# 금액에 콤마지우기
|
||||
'#################################################################################
|
||||
|
||||
Function DelComma(money)
|
||||
Dim result,comi
|
||||
if not money = "" AND Not isNull(money) then
|
||||
For comi = 0 to len(money)
|
||||
if Mid(money,comi+1,1)<>"," Then
|
||||
result = result & Mid(money,comi+1,1)
|
||||
End if
|
||||
Next
|
||||
End if
|
||||
|
||||
DelComma = result
|
||||
|
||||
End Function
|
||||
|
||||
'#################################################################################
|
||||
'#날짜만 가져오기
|
||||
'#월, 일을 "." 으로 변경하기
|
||||
'#################################################################################
|
||||
|
||||
Function ConvertDate(val)
|
||||
|
||||
Dim result
|
||||
if not val = "" AND Not isNull(val) Then
|
||||
result = Replace(Split(val," ")(0),"-",".")
|
||||
End if
|
||||
|
||||
ConvertDate = result
|
||||
End Function
|
||||
|
||||
'#################################################################################
|
||||
'#월, 일을 "." 으로 변경하기
|
||||
'#################################################################################
|
||||
Function ConvertDate2(val)
|
||||
|
||||
Dim result,left_result
|
||||
if not val = "" AND Not isNull(val) Then
|
||||
result = Replace(val,"-",".")
|
||||
End if
|
||||
|
||||
ConvertDate2 = result
|
||||
End Function
|
||||
|
||||
|
||||
'#################################################################################
|
||||
'#연령 계산
|
||||
'#################################################################################
|
||||
Function GET_AGE(jumin1,age_type)
|
||||
Dim nAge
|
||||
Dim BirthDay,nowBirthDay
|
||||
Dim strYY
|
||||
|
||||
If CLng(Left(jumin1,2))>0 Then
|
||||
strYY = "19"
|
||||
Else
|
||||
strYY = "20"
|
||||
End If
|
||||
|
||||
BirthDay = dateserial(strYY & Left(jumin1, 2),mid(jumin1,3,2),mid(jumin1,5)) '생년월일
|
||||
nowBirthDay = DateSerial(Year(date()),Month(date()),Day(date()))
|
||||
|
||||
If age_type="2" Then
|
||||
nAge = DateDiff("yyyy", BirthDay, Date()) + 1
|
||||
Else
|
||||
If CDate(nowBirthDay) > CDate(Now()) Then '생일이 안 지났다면 나이-1
|
||||
nAge = DateDiff("yyyy", BirthDay, Date()) - 1
|
||||
Else
|
||||
nAge = DateDiff("yyyy", BirthDay, Date())
|
||||
End If
|
||||
End If
|
||||
|
||||
GET_AGE = CStr(nAge)
|
||||
End Function
|
||||
|
||||
'#################################################################################
|
||||
'#연령 계산
|
||||
'#################################################################################
|
||||
Function READ_AGE(jumin1, jumin2, B_Date, age_type) 'age_type 1-만나이,2-일반나이
|
||||
Dim nowBirthDay 'B_Date의 생일
|
||||
Dim BirthDay '생년월일
|
||||
Dim strYY
|
||||
Dim nAge
|
||||
|
||||
Select Case Mid(jumin2, 1, 1)
|
||||
Case 0, 9: strYY = "18"
|
||||
Case 1, 2, 5, 6: strYY = "19"
|
||||
Case 3, 4, 7, 8: strYY = "20"
|
||||
End Select
|
||||
|
||||
BirthDay = dateserial(strYY & Left(jumin1, 2),mid(jumin1,3,2),mid(jumin1,5)) '생년월일
|
||||
|
||||
nowBirthDay = DateSerial(Year(B_Date), Month(BirthDay), Day(BirthDay))
|
||||
|
||||
if age_type = "2" then
|
||||
nAge = DateDiff("yyyy", BirthDay, B_Date) + 1
|
||||
else
|
||||
If CDate(nowBirthDay) > CDate(B_Date) Then '생일이 안 지났다면 나이-1
|
||||
nAge = DateDiff("yyyy", BirthDay, B_Date) - 1
|
||||
Else
|
||||
nAge = DateDiff("yyyy", BirthDay, B_Date)
|
||||
End If
|
||||
end if
|
||||
|
||||
READ_AGE = CStr(nAge)
|
||||
End Function
|
||||
|
||||
'###########################################################################################
|
||||
'# 자바스크립트 메세지 처리
|
||||
'###########################################################################################
|
||||
Sub WriteJMessage(message,url)
|
||||
Dim bodys
|
||||
bodys = ReadFile("/inc/JMSG.htm")
|
||||
bodys = Replace(bodys,"[$MESSAGE$]",message)
|
||||
bodys = Replace(bodys,"[$PAGENAME$]",url)
|
||||
|
||||
Response.Write bodys
|
||||
Response.end
|
||||
End Sub
|
||||
|
||||
|
||||
'###########################################################################################
|
||||
'random_key : 랜덤키생성
|
||||
'###########################################################################################
|
||||
function Random_key(Byval key_len)
|
||||
dim key_str,i
|
||||
Randomize
|
||||
for i=1 to key_len
|
||||
key_str = key_str & Int(Rnd * 9 + 1)
|
||||
next
|
||||
Random_key = key_str
|
||||
end Function
|
||||
|
||||
'###########################################################################################
|
||||
'Recordset 결과로 HTML 테이블 만들기
|
||||
'###########################################################################################
|
||||
|
||||
Function makeTable(rsx)
|
||||
|
||||
Dim rss
|
||||
Dim TableSource
|
||||
Dim i
|
||||
Dim item
|
||||
|
||||
set rss = rsx
|
||||
|
||||
TableSource = "<Table cellpadding=1 cellspacing=1 width=100% border=1 style='border-collapse: collapse; font-family:Tahoma; font-size:9pt'>" & vbCrlf
|
||||
TableSource = TableSource & vbtab & "<tr style='font-weight: bold'>" & vbcrlf
|
||||
|
||||
for i=0 to rss.fields.count-1
|
||||
TableSource = TableSource & vbtab & vbtab & "<td align='center'>" & rss.fields(i).name & "</td>" & vbcrlf
|
||||
next
|
||||
|
||||
TableSource = TableSource & vbtab & "</tr>" & vbcrlf
|
||||
|
||||
do while not rss.eof
|
||||
|
||||
TableSource = TableSource & vbtab & "<tr>" & vbcrlf
|
||||
|
||||
for i=0 to rss.fields.count-1
|
||||
|
||||
item = rss(i)
|
||||
|
||||
If item="" Or isNull(item) Then item=" "
|
||||
If isNumeric(item) Then item="'" & item
|
||||
|
||||
TableSource = TableSource & vbtab & vbtab & "<td align='center'>" & item & "</td>" & vbcrlf
|
||||
next
|
||||
|
||||
TableSource = TableSource & vbtab & "</tr>" & vbcrlf
|
||||
|
||||
rss.movenext
|
||||
|
||||
loop
|
||||
|
||||
TableSource = TableSource & "</Table>" & vbcrlf
|
||||
|
||||
makeTable = TableSource
|
||||
End Function
|
||||
|
||||
'######################################################################
|
||||
' 연도/월 출력
|
||||
'######################################################################
|
||||
Function Today(Tp)
|
||||
Dim ReturnV,xx
|
||||
ReturnV = ""
|
||||
|
||||
If TP = "1" Then
|
||||
For xx=Year(Date) To 2011 Step -1
|
||||
ReturnV = ReturnV & "<option value="""&xx&""">"&xx&"</option>" & vbCRLF
|
||||
Next
|
||||
Else
|
||||
For xx=1 To 12
|
||||
If Len(xx)=1 Then
|
||||
xx = "0"&xx
|
||||
End if
|
||||
ReturnV = ReturnV & "<option value="""&xx&""">"&xx&"</option>" & vbCRLF
|
||||
Next
|
||||
End if
|
||||
|
||||
Today = ReturnV
|
||||
End Function
|
||||
|
||||
Function cutStr(dat,chars)
|
||||
Dim xIdx
|
||||
xIdx = InStr(dat,chars)
|
||||
cutStr = Left(dat,xIdx-1)
|
||||
End Function
|
||||
|
||||
'###########################################################################################
|
||||
'지정길이로 랜덤 숫자 만들기
|
||||
'###########################################################################################
|
||||
Function getRandomNum(ByVal rLen)
|
||||
Dim idx, rndSeed, rndSeed2
|
||||
|
||||
If rLen>15 Then rLen =15
|
||||
|
||||
|
||||
rndSeed = ""
|
||||
rndSeed2 = "1"
|
||||
|
||||
For idx=1 To rLen
|
||||
rndSeed = rndSeed & "1"
|
||||
rndSeed2 = rndSeed2 & "0"
|
||||
Next
|
||||
|
||||
rndSeed = Int(rndSeed)
|
||||
rndSeed2 = Int(rndSeed2)
|
||||
|
||||
Randomize
|
||||
getRandomNum = Int(Rnd(rndSeed)*rndSeed2)
|
||||
|
||||
End Function
|
||||
|
||||
'###########################################################################################
|
||||
'지정길이로 랜덤 문자 만들기
|
||||
'###########################################################################################
|
||||
Function getRandomChar(ByVal rLen)
|
||||
Dim rtnStr, idx
|
||||
|
||||
Randomize
|
||||
For idx=1 To rLen
|
||||
rtnStr = rtnStr & Chr(Int(2*Rnd)*32 + Int((90-65+1)*Rnd+65))
|
||||
Next
|
||||
|
||||
getRandomChar = rtnStr
|
||||
End Function
|
||||
|
||||
'###########################################################################################
|
||||
'8자리 임시 비밀번호 만들기
|
||||
'###########################################################################################
|
||||
Function getTempPassword()
|
||||
Dim strTmp1,strTmp2
|
||||
strTmp1 = getRandomNum(4)
|
||||
strTmp2 = getRandomChar(4)
|
||||
|
||||
getTempPassword = strTmp1 & strTmp2
|
||||
End Function
|
||||
|
||||
'###########################################################################################
|
||||
'랜덤 String 생성
|
||||
'###########################################################################################
|
||||
Function CreateRandomString(iSize)
|
||||
Const VALID_TEXT = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
|
||||
Dim sNewSearchTag
|
||||
Dim I
|
||||
|
||||
For I = 0 To iSize
|
||||
Randomize
|
||||
sNewSearchTag = sNewSearchTag & Mid(VALID_TEXT,Round(Rnd * Len(VALID_TEXT)),1)
|
||||
Next
|
||||
|
||||
CreateRandomString = sNewSearchTag
|
||||
End Function
|
||||
|
||||
'#################################################################################
|
||||
'#페이지 리스트 표시
|
||||
'# c_page : 현재 페이지 넘버
|
||||
'# p_start : start 페이지 넘버
|
||||
'# p_end : end 페이지 넘버
|
||||
'# p_size : 한페이지에 보여질 숫자 갯수
|
||||
'# t_size : 토탈 페이지 수
|
||||
'# url : 리스트 페이지 명
|
||||
'#################################################################################
|
||||
Function Pagenation_Coding(c_page,p_start,p_end,p_size,t_size,searchType,searchValue,IDX,url)
|
||||
Dim iCnts
|
||||
Dim cP
|
||||
Dim rStr
|
||||
rStr = ""
|
||||
|
||||
|
||||
If searchType <>"" Then searchType = strAnsi2Unicode(Base64encode(strUnicode2Ansi(searchType)))
|
||||
If searchValue <>"" Then searchValue = strAnsi2Unicode(Base64encode(strUnicode2Ansi(searchValue)))
|
||||
|
||||
if CLng(p_end) <= CLng(p_size) Then
|
||||
rStr = rStr & "<li><a href=''><i class='icon-backward'></i></a></li>" & vbCrLf
|
||||
else
|
||||
' cP = c_page-10
|
||||
' if cp<1 Then
|
||||
' cp = 1
|
||||
' End if
|
||||
|
||||
cP = int(((c_Page-10)-1) / P_size) * P_size + 1
|
||||
|
||||
rStr = rStr & "<li><a href="""& url &"?IDX="& IDX &"&G_cpage="& strAnsi2Unicode(Base64encode(strUnicode2Ansi(cP))) &"&G_pagesize="& strAnsi2Unicode(Base64encode(strUnicode2Ansi(p_size))) &"&G_searchType="& searchType &"&G_searchValue="& searchValue &"""><i class='icon-backward'></i></a></li>"
|
||||
end if
|
||||
|
||||
if p_end="1" OR p_end="0" OR p_end="-1" Then
|
||||
rStr = rStr & "<li class='active'><a href='#'>1</a></li>"
|
||||
Else
|
||||
for iCnts = p_start to p_end
|
||||
if iCnts <> cint(c_Page) then
|
||||
rStr = rStr & "<li><a href="""& url &"?IDX="& IDX &"&G_cpage="& strAnsi2Unicode(Base64encode(strUnicode2Ansi(iCnts))) &"&G_pagesize="& strAnsi2Unicode(Base64encode(strUnicode2Ansi(p_size))) &"&G_searchType="& searchType &"&G_searchValue="& searchValue &""">"& icnts &"</a></li>" & vbCrLf
|
||||
else
|
||||
rStr = rStr & "<li class='active'><a href='#'>"& icnts &"</a></li>" & vbCrLf
|
||||
end if
|
||||
next
|
||||
End if
|
||||
if cint(p_end) >= t_size Then
|
||||
|
||||
rStr = rStr & "<li><a href=''><i class='icon-forward'></i></a></li>" & vbCrLf
|
||||
|
||||
else
|
||||
|
||||
cP = int(((c_Page+10)-1) / P_size) * P_size + 1
|
||||
|
||||
' cP = c_page+10
|
||||
' if cp>t_size Then
|
||||
' cp = t_size
|
||||
' End if
|
||||
|
||||
rStr = rStr & "<li><a href="""& url &"?IDX="& IDX &"&G_cpage="& strAnsi2Unicode(Base64encode(strUnicode2Ansi(cP))) &"&G_pagesize="& strAnsi2Unicode(Base64encode(strUnicode2Ansi(p_size))) &"&G_searchType="& searchType &"&G_searchValue="& searchValue &"""><i class='icon-forward'></i></a></li>"
|
||||
End If
|
||||
Pagenation_Coding = rStr
|
||||
End Function
|
||||
|
||||
'#################################################################################
|
||||
'#페이지 리스트 표시
|
||||
'# c_page : 현재 페이지 넘버
|
||||
'# p_start : start 페이지 넘버
|
||||
'# p_end : end 페이지 넘버
|
||||
'# p_size : 한페이지에 보여질 숫자 갯수
|
||||
'# t_size : 토탈 페이지 수
|
||||
'# url : 리스트 페이지 명
|
||||
'# searchType : 검색 조건
|
||||
'# searchValue : 검색 값
|
||||
'# IDField : INDEX 필드명
|
||||
'# IDValue : INDEX 값
|
||||
'#################################################################################
|
||||
Function Pagenation(c_page,p_start,p_end,p_size,t_size,url,searchType,searchValue,IDField,IDValue)
|
||||
Dim iCnts
|
||||
Dim cP
|
||||
Dim IDSTR
|
||||
Dim CU_PAGE
|
||||
IDSTR = ""
|
||||
|
||||
If IDField<>"" And IDValue<>"" Then IDSTR="&"& IDField & "=" & IDValue
|
||||
|
||||
Response.Write " <div class=""text-center"">"& vbCrLf
|
||||
Response.Write " <nav>"& vbCrLf
|
||||
Response.Write " <ul class=""pagination pagination-sm"">"& vbCrLf
|
||||
|
||||
If CLng(p_end) <= CLng(p_size) Then
|
||||
Response.Write " "
|
||||
Response.Write "<li><a href=""#""><i class=""fa fa-caret-left""></i></a></li>"& vbCrLf
|
||||
Else
|
||||
cP = int(((c_page-10)-1) / p_size) * p_size + 1
|
||||
Response.Write " "
|
||||
Response.Write "<li><a href="""&url&"?cpage="&cp&"&searchType="&searchType&"&searchValue="&searchValue&IDSTR&"""><i class='fa fa-caret-left'></i></a></li>"& vbCrLf
|
||||
End If
|
||||
|
||||
If p_end="1" OR p_end="0" OR p_end="-1" Then
|
||||
Response.Write " "
|
||||
Response.Write "<li class=""active""><a href=""#"">1</a></li>" & vbCrLf
|
||||
Else
|
||||
For iCnts = p_start to p_end
|
||||
Response.Write " "
|
||||
If iCnts <> cint(c_Page) Then
|
||||
Response.Write "<li><a href="""&url&"?cpage="&icnts&"&searchType="&searchType&"&searchValue="&searchValue&IDSTR&""">"& icnts &"</a></li>" & vbCrLf
|
||||
Else
|
||||
Response.Write "<li class=""active""><a href=""#"">"& icnts &"</a></li>" & vbCrLf
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
If cint(p_end) >= t_size Then
|
||||
Response.Write " "
|
||||
Response.Write "<li><a href=""#""><i class=""fa fa-caret-right""></i></a></li>" & vbCrLf
|
||||
Else
|
||||
|
||||
cP = int(((c_page+10)-1) / p_size) * p_size + 1
|
||||
Response.Write " "
|
||||
Response.Write "<li><a href="""&url&"?cpage="&cp&"&searchType="&searchType&"&searchValue="&searchValue&IDSTR&"""><i class=""fa fa-caret-right""></i></a></li>" & vbCrLf
|
||||
End If
|
||||
|
||||
Response.Write " </ul>" & vbCrLf
|
||||
Response.Write " </nav>" & vbCrLf
|
||||
Response.Write " </div>" & vbCrLf
|
||||
|
||||
End Function
|
||||
|
||||
'#################################################################################
|
||||
'#URL Decode
|
||||
'#################################################################################
|
||||
Function FnURLDecode(sStr)
|
||||
|
||||
Dim sRet, reEncode, sChar
|
||||
Dim i
|
||||
|
||||
If isnull(sStr) Then
|
||||
sStr = ""
|
||||
Else
|
||||
Set reEncode = New RegExp
|
||||
reEncode.IgnoreCase = True
|
||||
reEncode.Pattern = "^%[0-9a-f][0-9a-f]$"
|
||||
sStr = Replace(sStr, "+", " ")
|
||||
sRet = ""
|
||||
|
||||
For i = 1 To Len(sStr)
|
||||
sChar = Mid(sStr, i, 3)
|
||||
If reEncode.Test(sChar) Then
|
||||
If CInt("&H" & Mid(sStr, i + 1, 2)) < 128 Then
|
||||
sRet = sRet & Chr(CInt("&H" & Mid(sStr, i + 1, 2)))
|
||||
i = i + 2
|
||||
Elseif mid(sStr, i+3, 1) ="%" Then
|
||||
sRet = sRet & Chr(CInt("&H" & Mid(sStr, i + 1, 2) & Mid(sStr, i + 4, 2)))
|
||||
i = i + 5
|
||||
Else
|
||||
sRet = sRet & Chr(CInt("&H" & Mid(sStr, i + 1, 2) & "00") + asc(mid(sStr,i+3,1)))
|
||||
i = i + 3
|
||||
'이부분이 중요하다.
|
||||
'기존 urldecode함수가 몇 몇 글자들에서 에러를 내는 이유는 3바이트로 인코딩 되어있는 부분이 있기 때문. ascII로 변형되어 인코딩 된 부분이 존재한다.
|
||||
End If
|
||||
Else
|
||||
sRet = sRet & Mid(sStr, i, 1)
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
FnURLDecode = sRet
|
||||
End Function
|
||||
|
||||
|
||||
'#################################################################################
|
||||
'#비밀번호 암호화
|
||||
'#################################################################################
|
||||
Function MakePassword(passwordStr)
|
||||
Dim HashPassword
|
||||
|
||||
Dim SHAOBJ
|
||||
Set SHAOBJ = New clsSHA256
|
||||
|
||||
HashPassword = SHAOBJ.SHA256(passwordStr&SALT)
|
||||
MakePassword = HashPassword
|
||||
|
||||
Set SHAOBJ = Nothing
|
||||
|
||||
End Function
|
||||
|
||||
%>
|
||||
76
Lib/Config.asp
Normal file
76
Lib/Config.asp
Normal file
@@ -0,0 +1,76 @@
|
||||
<% @Language='vbscript' codepage='65001'%>
|
||||
|
||||
<!--METADATA TYPE= "typelib" NAME= "ADODB Type Library" FILE="C:\Program Files\Common Files\SYSTEM\ADO\msado15.dll" -->
|
||||
<%
|
||||
Option Explicit
|
||||
|
||||
Response.CharSet="utf-8"
|
||||
Session.codepage="65001"
|
||||
Response.codepage="65001"
|
||||
Response.ContentType="text/html;charset=utf-8"
|
||||
|
||||
'Survey DB 설정
|
||||
Dim SV_NAME,DB_NAME,UID,PWD
|
||||
Dim SV_NAME1,DB_NAME1,UID1,PWD1,SV_NAME2,DB_NAME2,UID2,PWD2
|
||||
Dim DBconn
|
||||
Dim SITENAME ' 사이트 URL
|
||||
Dim LOGINURL ' 로그인 URL
|
||||
Dim PROGRAMTITLE '페이지 타이틀
|
||||
Dim MAIL_SV,MAIL_ID,MAIL_PW '메일 설정 자료
|
||||
Dim SALT '암호화 도움키 *분실하거나 수정되면 안됨. - 비밀번호를 전부 재설정 해야함
|
||||
Dim BASIC_COL '설문 데이터의 시스템 컬럼 갯수
|
||||
Dim Local_IP : Local_IP = Request.ServerVariables("REMOTE_ADDR") '접속자 IP(사내용)
|
||||
|
||||
'//-------------------------------
|
||||
'//-- hwkim 2020-08-19 17:28:41
|
||||
Dim ip: ip = Request.ServerVariables("REMOTE_ADDR"): 'Response.Write ip
|
||||
Dim DevNode: DevNode = "real"
|
||||
|
||||
If( ip = "10.10.13.82" or ip = "10.10.13.115" or ip = "10.10.13.117" or ip = "10.10.13.118" or ip = "10.10.13.130" )Then
|
||||
DevNode = "dev"
|
||||
Else
|
||||
DevNode = "real"
|
||||
End if
|
||||
'-------------------------------//
|
||||
|
||||
DevNode = "real"
|
||||
|
||||
'#######################################################################################
|
||||
'DB 설정값 Read
|
||||
'#######################################################################################
|
||||
|
||||
SV_NAME = "1.235.195.34"
|
||||
DB_NAME= "project2"
|
||||
UID = "sa"
|
||||
PWD = "krco#51304"
|
||||
|
||||
SV_NAME1 = "1.235.195.34"
|
||||
DB_NAME1= "project2"
|
||||
UID1 = "sa"
|
||||
PWD1 = "krco#51304"
|
||||
|
||||
If( DevNode = "dev" )then
|
||||
SV_NAME2 = "10.10.13.177,1313"
|
||||
DB_NAME2= "kon"
|
||||
UID2 = "kon"
|
||||
PWD2 = "kon#51304"
|
||||
Else
|
||||
SV_NAME2 = "1.235.195.8,20022"
|
||||
DB_NAME2= "kon"
|
||||
UID2 = "kon"
|
||||
PWD2 = "kon#51304"
|
||||
end if
|
||||
|
||||
|
||||
%>
|
||||
<!-- #include file = "./DBConn.asp" -->
|
||||
<!-- #include file = "./DBLib.asp" -->
|
||||
<!-- #include file = "./FileLib.asp" -->
|
||||
<!-- #include file = "./CAPICOM.asp" -->
|
||||
<!-- #include file = "./Func.asp" -->
|
||||
<!-- #include file = "./SiteFunc.asp" -->
|
||||
<!-- #include file = "./ApiLog.asp" -->
|
||||
<!-- #include file = "./sha256.asp" -->
|
||||
<!-- #include file = "./md5.asp" -->
|
||||
<!-- #include file = "./aspJSON1.17.asp" -->
|
||||
<!-- #include file = "./JSON_2.0.4.asp" -->
|
||||
79
Lib/Config.asp.mine
Normal file
79
Lib/Config.asp.mine
Normal file
@@ -0,0 +1,79 @@
|
||||
<% @Language='vbscript' codepage='65001'%>
|
||||
|
||||
<!--METADATA TYPE= "typelib" NAME= "ADODB Type Library" FILE="C:\Program Files\Common Files\SYSTEM\ADO\msado15.dll" -->
|
||||
<%
|
||||
Option Explicit
|
||||
|
||||
Response.CharSet="utf-8"
|
||||
Session.codepage="65001"
|
||||
Response.codepage="65001"
|
||||
Response.ContentType="text/html;charset=utf-8"
|
||||
|
||||
'Survey DB 설정
|
||||
Dim SV_NAME,DB_NAME,UID,PWD
|
||||
Dim SV_NAME1,DB_NAME1,UID1,PWD1,SV_NAME2,DB_NAME2,UID2,PWD2
|
||||
Dim DBconn
|
||||
Dim SITENAME ' 사이트 URL
|
||||
Dim LOGINURL ' 로그인 URL
|
||||
Dim PROGRAMTITLE '페이지 타이틀
|
||||
Dim MAIL_SV,MAIL_ID,MAIL_PW '메일 설정 자료
|
||||
Dim SALT '암호화 도움키 *분실하거나 수정되면 안됨. - 비밀번호를 전부 재설정 해야함
|
||||
Dim BASIC_COL '설문 데이터의 시스템 컬럼 갯수
|
||||
Dim Local_IP : Local_IP = Request.ServerVariables("REMOTE_ADDR") '접속자 IP(사내용)
|
||||
|
||||
'//-------------------------------
|
||||
'//-- hwkim 2020-08-19 17:28:41
|
||||
Dim ip: ip = Request.ServerVariables("REMOTE_ADDR"): 'Response.Write ip
|
||||
Dim DevNode: DevNode = "real"
|
||||
|
||||
'--or ip = "10.10.13.115"
|
||||
|
||||
If( ip = "10.10.17.82" or ip = "10.10.17.115" or ip = "10.10.17.117" or ip = "10.10.17.118" or ip = "10.10.17.130" or ip = "10.10.17.83" )Then
|
||||
'--or ip = "10.10.13.115"
|
||||
|
||||
DevNode = "dev"
|
||||
Else
|
||||
DevNode = "real"
|
||||
End if
|
||||
'-------------------------------//
|
||||
'--
|
||||
DevNode = "real"
|
||||
|
||||
'#######################################################################################
|
||||
'DB 설정값 Read
|
||||
'#######################################################################################
|
||||
|
||||
SV_NAME = "1.235.195.34"
|
||||
DB_NAME= "project2"
|
||||
UID = "sa"
|
||||
PWD = "krco#51304"
|
||||
|
||||
SV_NAME1 = "1.235.195.34"
|
||||
DB_NAME1= "project2"
|
||||
UID1 = "sa"
|
||||
PWD1 = "krco#51304"
|
||||
|
||||
If( DevNode = "dev" )then
|
||||
SV_NAME2 = "10.10.15.177,1313"
|
||||
DB_NAME2= "kon"
|
||||
UID2 = "kon"
|
||||
PWD2 = "kon#51304"
|
||||
Else
|
||||
SV_NAME2 = "1.265.195.83,20022"
|
||||
DB_NAME2= "kon"
|
||||
UID2 = "kon"
|
||||
PWD2 = "kon#51304"
|
||||
end if
|
||||
|
||||
|
||||
%>
|
||||
<!-- #include file = "./DBConn.asp" -->
|
||||
<!-- #include file = "./DBLib.asp" -->
|
||||
<!-- #include file = "./FileLib.asp" -->
|
||||
<!-- #include file = "./CAPICOM.asp" -->
|
||||
<!-- #include file = "./Func.asp" -->
|
||||
<!-- #include file = "./SiteFunc.asp" -->
|
||||
<!-- #include file = "./sha256.asp" -->
|
||||
<!-- #include file = "./md5.asp" -->
|
||||
<!-- #include file = "./aspJSON1.17.asp" -->
|
||||
<!-- #include file = "./JSON_2.0.4.asp" -->
|
||||
75
Lib/Config.asp.r2043
Normal file
75
Lib/Config.asp.r2043
Normal file
@@ -0,0 +1,75 @@
|
||||
<% @Language='vbscript' codepage='65001'%>
|
||||
|
||||
<!--METADATA TYPE= "typelib" NAME= "ADODB Type Library" FILE="C:\Program Files\Common Files\SYSTEM\ADO\msado15.dll" -->
|
||||
<%
|
||||
Option Explicit
|
||||
|
||||
Response.CharSet="utf-8"
|
||||
Session.codepage="65001"
|
||||
Response.codepage="65001"
|
||||
Response.ContentType="text/html;charset=utf-8"
|
||||
|
||||
'Survey DB 설정
|
||||
Dim SV_NAME,DB_NAME,UID,PWD
|
||||
Dim SV_NAME1,DB_NAME1,UID1,PWD1,SV_NAME2,DB_NAME2,UID2,PWD2
|
||||
Dim DBconn
|
||||
Dim SITENAME ' 사이트 URL
|
||||
Dim LOGINURL ' 로그인 URL
|
||||
Dim PROGRAMTITLE '페이지 타이틀
|
||||
Dim MAIL_SV,MAIL_ID,MAIL_PW '메일 설정 자료
|
||||
Dim SALT '암호화 도움키 *분실하거나 수정되면 안됨. - 비밀번호를 전부 재설정 해야함
|
||||
Dim BASIC_COL '설문 데이터의 시스템 컬럼 갯수
|
||||
Dim Local_IP : Local_IP = Request.ServerVariables("REMOTE_ADDR") '접속자 IP(사내용)
|
||||
|
||||
'//-------------------------------
|
||||
'//-- hwkim 2020-08-19 17:28:41
|
||||
Dim ip: ip = Request.ServerVariables("REMOTE_ADDR"): 'Response.Write ip
|
||||
Dim DevNode: DevNode = "real"
|
||||
|
||||
If( ip = "10.10.13.82" or ip = "10.10.13.115" or ip = "10.10.13.117" or ip = "10.10.13.118" or ip = "10.10.13.130" )Then
|
||||
DevNode = "dev"
|
||||
Else
|
||||
DevNode = "real"
|
||||
End if
|
||||
'-------------------------------//
|
||||
|
||||
DevNode = "real"
|
||||
|
||||
'#######################################################################################
|
||||
'DB 설정값 Read
|
||||
'#######################################################################################
|
||||
|
||||
SV_NAME = "10.10.11.6"
|
||||
DB_NAME= "project2"
|
||||
UID = "sa"
|
||||
PWD = "krco#51304"
|
||||
|
||||
SV_NAME1 = "10.10.11.6"
|
||||
DB_NAME1= "project2"
|
||||
UID1 = "sa"
|
||||
PWD1 = "krco#51304"
|
||||
|
||||
If( DevNode = "dev" )then
|
||||
SV_NAME2 = "10.10.13.177,1313"
|
||||
DB_NAME2= "kon"
|
||||
UID2 = "kon"
|
||||
PWD2 = "kon#51304"
|
||||
Else
|
||||
SV_NAME2 = "10.10.11.7,20022"
|
||||
DB_NAME2= "kon"
|
||||
UID2 = "kon"
|
||||
PWD2 = "kon#51304"
|
||||
end if
|
||||
|
||||
|
||||
%>
|
||||
<!-- #include file = "./DBConn.asp" -->
|
||||
<!-- #include file = "./DBLib.asp" -->
|
||||
<!-- #include file = "./FileLib.asp" -->
|
||||
<!-- #include file = "./CAPICOM.asp" -->
|
||||
<!-- #include file = "./Func.asp" -->
|
||||
<!-- #include file = "./SiteFunc.asp" -->
|
||||
<!-- #include file = "./sha256.asp" -->
|
||||
<!-- #include file = "./md5.asp" -->
|
||||
<!-- #include file = "./aspJSON1.17.asp" -->
|
||||
<!-- #include file = "./JSON_2.0.4.asp" -->
|
||||
76
Lib/Config.asp.r2139
Normal file
76
Lib/Config.asp.r2139
Normal file
@@ -0,0 +1,76 @@
|
||||
<% @Language='vbscript' codepage='65001'%>
|
||||
|
||||
<!--METADATA TYPE= "typelib" NAME= "ADODB Type Library" FILE="C:\Program Files\Common Files\SYSTEM\ADO\msado15.dll" -->
|
||||
<%
|
||||
Option Explicit
|
||||
|
||||
Response.CharSet="utf-8"
|
||||
Session.codepage="65001"
|
||||
Response.codepage="65001"
|
||||
Response.ContentType="text/html;charset=utf-8"
|
||||
|
||||
'Survey DB 설정
|
||||
Dim SV_NAME,DB_NAME,UID,PWD
|
||||
Dim SV_NAME1,DB_NAME1,UID1,PWD1,SV_NAME2,DB_NAME2,UID2,PWD2
|
||||
Dim DBconn
|
||||
Dim SITENAME ' 사이트 URL
|
||||
Dim LOGINURL ' 로그인 URL
|
||||
Dim PROGRAMTITLE '페이지 타이틀
|
||||
Dim MAIL_SV,MAIL_ID,MAIL_PW '메일 설정 자료
|
||||
Dim SALT '암호화 도움키 *분실하거나 수정되면 안됨. - 비밀번호를 전부 재설정 해야함
|
||||
Dim BASIC_COL '설문 데이터의 시스템 컬럼 갯수
|
||||
Dim Local_IP : Local_IP = Request.ServerVariables("REMOTE_ADDR") '접속자 IP(사내용)
|
||||
|
||||
'//-------------------------------
|
||||
'//-- hwkim 2020-08-19 17:28:41
|
||||
Dim ip: ip = Request.ServerVariables("REMOTE_ADDR"): 'Response.Write ip
|
||||
Dim DevNode: DevNode = "real"
|
||||
|
||||
If( ip = "10.10.13.82" or ip = "10.10.13.115" or ip = "10.10.13.117" or ip = "10.10.13.118" or ip = "10.10.13.130" )Then
|
||||
DevNode = "dev"
|
||||
Else
|
||||
DevNode = "real"
|
||||
End if
|
||||
'-------------------------------//
|
||||
|
||||
DevNode = "real"
|
||||
|
||||
'#######################################################################################
|
||||
'DB 설정값 Read
|
||||
'#######################################################################################
|
||||
|
||||
|
||||
SV_NAME = "1.235.195.34"
|
||||
DB_NAME= "project2"
|
||||
UID = "sa"
|
||||
PWD = "krco#51304"
|
||||
|
||||
SV_NAME1 = "1.235.195.34"
|
||||
DB_NAME1= "project2"
|
||||
UID1 = "sa"
|
||||
PWD1 = "krco#51304"
|
||||
|
||||
If( DevNode = "dev" )then
|
||||
SV_NAME2 = "10.10.13.177,1313"
|
||||
DB_NAME2= "kon"
|
||||
UID2 = "kon"
|
||||
PWD2 = "kon#51304"
|
||||
Else
|
||||
SV_NAME2 = "1.235.195.8,20022"
|
||||
DB_NAME2= "kon"
|
||||
UID2 = "kon"
|
||||
PWD2 = "kon#51304"
|
||||
end if
|
||||
|
||||
|
||||
%>
|
||||
<!-- #include file = "./DBConn.asp" -->
|
||||
<!-- #include file = "./DBLib.asp" -->
|
||||
<!-- #include file = "./FileLib.asp" -->
|
||||
<!-- #include file = "./CAPICOM.asp" -->
|
||||
<!-- #include file = "./Func.asp" -->
|
||||
<!-- #include file = "./SiteFunc.asp" -->
|
||||
<!-- #include file = "./sha256.asp" -->
|
||||
<!-- #include file = "./md5.asp" -->
|
||||
<!-- #include file = "./aspJSON1.17.asp" -->
|
||||
<!-- #include file = "./JSON_2.0.4.asp" -->
|
||||
76
Lib/Config.asp_js
Normal file
76
Lib/Config.asp_js
Normal file
@@ -0,0 +1,76 @@
|
||||
<% @Language='vbscript' codepage='65001'%>
|
||||
|
||||
<!--METADATA TYPE= "typelib" NAME= "ADODB Type Library" FILE="C:\Program Files\Common Files\SYSTEM\ADO\msado15.dll" -->
|
||||
<%
|
||||
Option Explicit
|
||||
|
||||
Response.CharSet="utf-8"
|
||||
Session.codepage="65001"
|
||||
Response.codepage="65001"
|
||||
Response.ContentType="text/html;charset=utf-8"
|
||||
|
||||
'Survey DB 설정
|
||||
Dim SV_NAME,DB_NAME,UID,PWD
|
||||
Dim SV_NAME1,DB_NAME1,UID1,PWD1,SV_NAME2,DB_NAME2,UID2,PWD2
|
||||
Dim DBconn
|
||||
Dim SITENAME ' 사이트 URL
|
||||
Dim LOGINURL ' 로그인 URL
|
||||
Dim PROGRAMTITLE '페이지 타이틀
|
||||
Dim MAIL_SV,MAIL_ID,MAIL_PW '메일 설정 자료
|
||||
Dim SALT '암호화 도움키 *분실하거나 수정되면 안됨. - 비밀번호를 전부 재설정 해야함
|
||||
Dim BASIC_COL '설문 데이터의 시스템 컬럼 갯수
|
||||
Dim Local_IP : Local_IP = Request.ServerVariables("REMOTE_ADDR") '접속자 IP(사내용)
|
||||
|
||||
'//-------------------------------
|
||||
'//-- hwkim 2020-08-19 17:28:41
|
||||
Dim ip: ip = Request.ServerVariables("REMOTE_ADDR"): 'Response.Write ip
|
||||
Dim DevNode: DevNode = "real"
|
||||
|
||||
If( ip = "10.10.13.82" or ip = "10.10.13.115" or ip = "10.10.13.117" or ip = "10.10.13.118" or ip = "10.10.13.130" )Then
|
||||
DevNode = "dev"
|
||||
Else
|
||||
DevNode = "real"
|
||||
End if
|
||||
'-------------------------------//
|
||||
|
||||
DevNode = "real"
|
||||
|
||||
'#######################################################################################
|
||||
'DB 설정값 Read
|
||||
'#######################################################################################
|
||||
|
||||
SV_NAME = "1.235.195.34"
|
||||
DB_NAME= "project2"
|
||||
UID = "sa"
|
||||
PWD = "krco#51304"
|
||||
|
||||
SV_NAME1 = "1.235.195.34"
|
||||
DB_NAME1= "project2"
|
||||
UID1 = "sa"
|
||||
PWD1 = "krco#51304"
|
||||
|
||||
If( DevNode = "dev" )then
|
||||
SV_NAME2 = "10.10.13.177,1313"
|
||||
DB_NAME2= "kon"
|
||||
UID2 = "kon"
|
||||
PWD2 = "kon#51304"
|
||||
Else
|
||||
SV_NAME2 = "1.235.195.8,20022"
|
||||
DB_NAME2= "kon"
|
||||
UID2 = "kon"
|
||||
PWD2 = "kon#51304"
|
||||
end if
|
||||
|
||||
|
||||
%>
|
||||
<!-- #include file = "./DBConn.asp" -->
|
||||
<!-- #include file = "./DBLib.asp" -->
|
||||
<!-- #include file = "./FileLib.asp" -->
|
||||
<!-- #include file = "./CAPICOM.asp" -->
|
||||
<!-- #include file = "./Func.asp" -->
|
||||
<!-- #include file = "./SiteFunc.asp" -->
|
||||
<!-- #include file = "./ApiLog.asp" -->
|
||||
<!-- #include file = "./sha256.asp" -->
|
||||
<!-- #include file = "./md5.asp" -->
|
||||
<!-- #include file = "./aspJSON1.17.asp" -->
|
||||
<!-- #include file = "./JSON_2.0.4.asp" -->
|
||||
79
Lib/Config_hwkim.asp
Normal file
79
Lib/Config_hwkim.asp
Normal file
@@ -0,0 +1,79 @@
|
||||
<% @Language='vbscript' codepage='65001'%>
|
||||
|
||||
<!--METADATA TYPE= "typelib" NAME= "ADODB Type Library" FILE="C:\Program Files\Common Files\SYSTEM\ADO\msado15.dll" -->
|
||||
<%
|
||||
Option Explicit
|
||||
|
||||
Response.CharSet="utf-8"
|
||||
Session.codepage="65001"
|
||||
Response.codepage="65001"
|
||||
Response.ContentType="text/html;charset=utf-8"
|
||||
|
||||
'Survey DB 설정
|
||||
Dim SV_NAME,DB_NAME,UID,PWD
|
||||
Dim SV_NAME1,DB_NAME1,UID1,PWD1,SV_NAME2,DB_NAME2,UID2,PWD2
|
||||
Dim DBconn
|
||||
Dim SITENAME ' 사이트 URL
|
||||
Dim LOGINURL ' 로그인 URL
|
||||
Dim PROGRAMTITLE '페이지 타이틀
|
||||
Dim MAIL_SV,MAIL_ID,MAIL_PW '메일 설정 자료
|
||||
Dim SALT '암호화 도움키 *분실하거나 수정되면 안됨. - 비밀번호를 전부 재설정 해야함
|
||||
Dim BASIC_COL '설문 데이터의 시스템 컬럼 갯수
|
||||
Dim Local_IP : Local_IP = Request.ServerVariables("REMOTE_ADDR") '접속자 IP(사내용)
|
||||
|
||||
'//-------------------------------
|
||||
'//-- hwkim 2020-08-19 17:28:41
|
||||
Dim ip: ip = Request.ServerVariables("REMOTE_ADDR"): 'Response.Write ip
|
||||
Dim DevNode: DevNode = "real"
|
||||
|
||||
If( ip = "10.10.13.82" or ip = "10.10.13.115" or ip = "10.10.13.117" or ip = "10.10.13.118" or ip = "10.10.13.130" )Then
|
||||
DevNode = "dev"
|
||||
Else
|
||||
DevNode = "real"
|
||||
End if
|
||||
'-------------------------------//
|
||||
|
||||
DevNode = "real"
|
||||
|
||||
'#######################################################################################
|
||||
'DB 설정값 Read
|
||||
'#######################################################################################
|
||||
|
||||
SV_NAME = "1.235.195.34"
|
||||
DB_NAME= "capi"
|
||||
UID = "sa"
|
||||
PWD = "krco#51304"
|
||||
|
||||
SV_NAME1 = "1.235.195.34"
|
||||
DB_NAME1= "krc_survey"
|
||||
UID1 = "sa"
|
||||
PWD1 = "krco#51304"
|
||||
|
||||
'SV_NAME2 = "1.235.195.8,20022"
|
||||
'DB_NAME2= "kri_exit_poll_2020"
|
||||
'UID2 = "2020poll"
|
||||
'PWD2 = "krco#51304"
|
||||
|
||||
If( DevNode = "dev" )then
|
||||
SV_NAME2 = "10.10.13.177,1313"
|
||||
DB_NAME2= "kon"
|
||||
UID2 = "kon"
|
||||
PWD2 = "kon#51304"
|
||||
Else
|
||||
SV_NAME2 = "1.235.195.8,20022"
|
||||
DB_NAME2= "kon"
|
||||
UID2 = "kon"
|
||||
PWD2 = "kon#51304"
|
||||
end if
|
||||
|
||||
%>
|
||||
<!-- #include file = "./DBConn.asp" -->
|
||||
<!-- #include file = "./DBLib.asp" -->
|
||||
<!-- #include file = "./FileLib.asp" -->
|
||||
<!-- #include file = "./CAPICOM.asp" -->
|
||||
<!-- #include file = "./Func.asp" -->
|
||||
<!-- #include file = "./SiteFunc.asp" -->
|
||||
<!-- #include file = "./sha256.asp" -->
|
||||
<!-- #include file = "./md5.asp" -->
|
||||
<!-- #include file = "./aspJSON1.17.asp" -->
|
||||
<!-- #include file = "./JSON_2.0.4.asp" -->
|
||||
65
Lib/DBConn.asp
Normal file
65
Lib/DBConn.asp
Normal file
@@ -0,0 +1,65 @@
|
||||
<%
|
||||
|
||||
'Database Connection
|
||||
'DBConn : 설문 DataBase
|
||||
'RSConn : List Database
|
||||
|
||||
Dim DBFlag,RBFlag
|
||||
|
||||
'###########################################################################################
|
||||
'CAPI 시스템 DB 연결
|
||||
'###########################################################################################
|
||||
Sub DBConnect()
|
||||
|
||||
Set DBConn=Server.CreateObject("ADODB.Connection")
|
||||
DBConn.CursorLocation = adUseClient
|
||||
DBConn.CommandTimeout = 0 ' select 쿼리 시간 무제한
|
||||
DBConn.Open GetDBStr()
|
||||
DBFlag = True
|
||||
|
||||
End Sub
|
||||
|
||||
'###########################################################################################
|
||||
'CAPI Project DB 연결
|
||||
'###########################################################################################
|
||||
Sub DBConnect1()
|
||||
Set DBConn=Server.CreateObject("ADODB.Connection")
|
||||
DBConn.CursorLocation = adUseClient
|
||||
DBConn.Open GetDBStr1()
|
||||
DBFlag = True
|
||||
End Sub
|
||||
|
||||
Sub DBConnect2()
|
||||
|
||||
Set DBConn=Server.CreateObject("ADODB.Connection")
|
||||
DBConn.Open GetDBStr2()
|
||||
DBConn.CursorLocation = adUseClient
|
||||
DBFlag = True
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Function GetDBStr()
|
||||
GetDBStr = "Driver=SQL Server; Server=" & SV_NAME & "; Database=" & DB_NAME & "; UID=" & UID & "; PWD=" & PWD
|
||||
End Function
|
||||
|
||||
Function GetDBStr1()
|
||||
|
||||
GetDBStr1 = "Driver=SQL Server; Server=" & SV_NAME1 & "; Database=" & DB_NAME1 & "; UID=" & UID1 & "; PWD=" & PWD1 & ";"
|
||||
End Function
|
||||
|
||||
Function GetDBStr2()
|
||||
GetDBStr2 = "Provider=SQLOLEDB; Server=" & SV_NAME2 & ";Initial Catalog=" & DB_NAME2 & "; UID=" & UID2 & "; PWD=" & PWD2
|
||||
End Function
|
||||
|
||||
'DB 끊기
|
||||
Sub DBClose()
|
||||
|
||||
If Not DBConn Is Nothing Then
|
||||
DBConn.Close
|
||||
Set DBConn = Nothing
|
||||
End If
|
||||
DBFlag = False
|
||||
End Sub
|
||||
|
||||
%>
|
||||
456
Lib/DBHelper.asp
Normal file
456
Lib/DBHelper.asp
Normal file
@@ -0,0 +1,456 @@
|
||||
<!--METADATA TYPE= "typelib" NAME= "ADODB Type Library"
|
||||
FILE="C:\Program Files\Common Files\SYSTEM\ADO\msado15.dll" -->
|
||||
<%
|
||||
|
||||
Class clsDBHelper
|
||||
Private DefaultConnString
|
||||
Private DefaultConnection
|
||||
Private m_ServerIP
|
||||
Private m_DBName
|
||||
Private m_UserID
|
||||
Private m_UserPW
|
||||
Dim cmd
|
||||
Dim rs
|
||||
Dim inum
|
||||
|
||||
Private sub Class_Initialize()
|
||||
'----------------------------------------------------
|
||||
'SQL OLE DB ConnString
|
||||
'----------------------------------------------------
|
||||
'DefaultConnString = "Provider=SQLOLEDB;Data Source=" & m_ServerIP & ";Initial Catalog=" & m_DBName & ";User Id=" & m_UserID & ";Password=" & m_UserPW & ";"
|
||||
|
||||
'----------------------------------------------------
|
||||
'MS SQL DB ConnString
|
||||
'----------------------------------------------------
|
||||
DefaultConnString = "Driver=SQL Server; Server=" & m_ServerIP & "; Database=" & m_DBName & "; UID=" & m_UserID & "; PWD=" & m_UserPW
|
||||
Set DefaultConnection = Nothing
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
'소멸자
|
||||
Private Sub Class_Terminate()
|
||||
Set DefaultConnection = Nothing
|
||||
End Sub
|
||||
|
||||
'---------------------------------------------------
|
||||
' 서버 설정
|
||||
'---------------------------------------------------
|
||||
Public Property Set Server(mServer)
|
||||
m_ServerIP = mServer
|
||||
End Property
|
||||
|
||||
Public Property Set DBName(mDBName)
|
||||
m_DBName = mDBName
|
||||
End Property
|
||||
|
||||
Public Property Set UserID(mUserID)
|
||||
m_UserID = mUserID
|
||||
End Property
|
||||
|
||||
Public Property Set UserPW(mUserPW)
|
||||
m_UserPW = mUserPW
|
||||
End Property
|
||||
|
||||
'---------------------------------------------------
|
||||
' SP를 실행하고, RecordSet을 반환한다.
|
||||
'---------------------------------------------------
|
||||
Public Function ExecSPReturnRS(spName, params, connectionString)
|
||||
If IsObject(connectionString) Then
|
||||
If connectionString is Nothing Then
|
||||
If DefaultConnection is Nothing Then
|
||||
Set DefaultConnection = CreateObject("ADODB.Connection")
|
||||
DefaultConnection.Open DefaultConnString
|
||||
End If
|
||||
Set connectionString = DefaultConnection
|
||||
End If
|
||||
End If
|
||||
|
||||
Set rs = CreateObject("ADODB.RecordSet")
|
||||
Set cmd = CreateObject("ADODB.Command")
|
||||
|
||||
cmd.ActiveConnection = connectionString
|
||||
cmd.CommandText = spName
|
||||
cmd.CommandType = adCmdStoredProc
|
||||
Set cmd = collectParams(cmd, params)
|
||||
'cmd.Parameters.Refresh
|
||||
|
||||
rs.CursorLocation = adUseClient
|
||||
rs.Open cmd, ,adOpenStatic, adLockReadOnly
|
||||
|
||||
For i = 0 To cmd.Parameters.Count - 1
|
||||
If cmd.Parameters(i).Direction = adParamOutput OR cmd.Parameters(i).Direction = adParamInputOutput OR cmd.Parameters(i).Direction = adParamReturnValue Then
|
||||
If IsObject(params) Then
|
||||
If params is Nothing Then
|
||||
Exit For
|
||||
End If
|
||||
Else
|
||||
params(i)(4) = cmd.Parameters(i).Value
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
Set cmd.ActiveConnection = Nothing
|
||||
Set cmd = Nothing
|
||||
If rs.State = adStateClosed Then
|
||||
Set rs.Source = Nothing
|
||||
End If
|
||||
Set rs.ActiveConnection = Nothing
|
||||
|
||||
Set ExecSPReturnRS = rs
|
||||
|
||||
End Function
|
||||
|
||||
'---------------------------------------------------
|
||||
' SQL Query를 실행하고, RecordSet을 반환한다.
|
||||
'---------------------------------------------------
|
||||
Public Function ExecSQLReturnRS(strSQL, params, connectionString)
|
||||
If IsObject(connectionString) Then
|
||||
If connectionString is Nothing Then
|
||||
If DefaultConnection is Nothing Then
|
||||
Set DefaultConnection = CreateObject("ADODB.Connection")
|
||||
DefaultConnection.Open DefaultConnString
|
||||
End If
|
||||
Set connectionString = DefaultConnection
|
||||
End If
|
||||
End If
|
||||
|
||||
Set rs = CreateObject("ADODB.RecordSet")
|
||||
Set cmd = CreateObject("ADODB.Command")
|
||||
|
||||
cmd.ActiveConnection = connectionString
|
||||
cmd.Prepared = true
|
||||
cmd.CommandText = strSQL
|
||||
cmd.CommandType = adCmdText
|
||||
|
||||
Set cmd = collectParams(cmd, params)
|
||||
|
||||
' On Error Resume Next
|
||||
|
||||
' Response.Write strSQL & "<BR>"
|
||||
|
||||
rs.CursorLocation = adUseClient
|
||||
rs.Open cmd, , adOpenStatic, adLockReadOnly
|
||||
|
||||
If Err.Number<>0 Then
|
||||
ErrorLog DefaultConnection.Number, DefaultConnection.Description
|
||||
End IF
|
||||
|
||||
Set cmd.ActiveConnection = Nothing
|
||||
Set cmd = Nothing
|
||||
If rs.State = adStateClosed Then
|
||||
Set rs.Source = Nothing
|
||||
End If
|
||||
|
||||
Set rs.ActiveConnection = Nothing
|
||||
|
||||
Set ExecSQLReturnRS = rs
|
||||
End Function
|
||||
|
||||
'---------------------------------------------------
|
||||
' SQL Query를 실행하고, RecordSet Array을 반환한다.
|
||||
'---------------------------------------------------
|
||||
Public Function ExecSQLReturnAR(strSQL, params, connectionString)
|
||||
If IsObject(connectionString) Then
|
||||
If connectionString is Nothing Then
|
||||
If DefaultConnection is Nothing Then
|
||||
Set DefaultConnection = CreateObject("ADODB.Connection")
|
||||
DefaultConnection.Open DefaultConnString
|
||||
End If
|
||||
Set connectionString = DefaultConnection
|
||||
End If
|
||||
End If
|
||||
|
||||
Set rs = CreateObject("ADODB.RecordSet")
|
||||
Set cmd = CreateObject("ADODB.Command")
|
||||
|
||||
cmd.ActiveConnection = connectionString
|
||||
cmd.Prepared = true
|
||||
cmd.CommandText = strSQL
|
||||
cmd.CommandType = adCmdText
|
||||
|
||||
Set cmd = collectParams(cmd, params)
|
||||
|
||||
' On Error Resume Next
|
||||
|
||||
'Response.Write strSQL & "<BR>"& "<BR>"& "<BR>"& "<BR>"
|
||||
|
||||
rs.CursorLocation = adUseClient
|
||||
rs.Open cmd, , adOpenStatic, adLockReadOnly
|
||||
|
||||
If Err.Number<>0 Then
|
||||
ErrorLog DefaultConnection.Number, DefaultConnection.Description
|
||||
End IF
|
||||
|
||||
Set cmd.ActiveConnection = Nothing
|
||||
Set cmd = Nothing
|
||||
If rs.State = adStateClosed Then
|
||||
Set rs.Source = Nothing
|
||||
End If
|
||||
|
||||
Set rs.ActiveConnection = Nothing
|
||||
|
||||
Set ExecSQLReturnAR = rs.getRows
|
||||
End Function
|
||||
|
||||
'---------------------------------------------------
|
||||
' SQL Query를 실행하고, RecordSet String을 반환한다.
|
||||
'---------------------------------------------------
|
||||
Public Function ExecSQLReturnST(strSQL, params, connectionString)
|
||||
If IsObject(connectionString) Then
|
||||
If connectionString is Nothing Then
|
||||
If DefaultConnection is Nothing Then
|
||||
Set DefaultConnection = CreateObject("ADODB.Connection")
|
||||
DefaultConnection.Open DefaultConnString
|
||||
End If
|
||||
Set connectionString = DefaultConnection
|
||||
End If
|
||||
End If
|
||||
|
||||
Set rs = CreateObject("ADODB.RecordSet")
|
||||
Set cmd = CreateObject("ADODB.Command")
|
||||
|
||||
cmd.ActiveConnection = connectionString
|
||||
cmd.Prepared = true
|
||||
cmd.CommandText = strSQL
|
||||
cmd.CommandType = adCmdText
|
||||
|
||||
Set cmd = collectParams(cmd, params)
|
||||
|
||||
' On Error Resume Next
|
||||
|
||||
'Response.Write strSQL & "<BR>"& "<BR>"& "<BR>"& "<BR>"
|
||||
|
||||
rs.CursorLocation = adUseClient
|
||||
rs.Open cmd, , adOpenStatic, adLockReadOnly
|
||||
|
||||
If Err.Number<>0 Then
|
||||
ErrorLog DefaultConnection.Number, DefaultConnection.Description
|
||||
End IF
|
||||
|
||||
Set cmd.ActiveConnection = Nothing
|
||||
Set cmd = Nothing
|
||||
If rs.State = adStateClosed Then
|
||||
Set rs.Source = Nothing
|
||||
End If
|
||||
|
||||
Set rs.ActiveConnection = Nothing
|
||||
|
||||
Set ExecSQLReturnAR = rs.getString(2)
|
||||
End Function
|
||||
|
||||
'---------------------------------------------------
|
||||
' SP를 실행한다.(RecordSet 반환없음)
|
||||
'---------------------------------------------------
|
||||
Public Sub ExecSP(strSP,params,connectionString)
|
||||
If IsObject(connectionString) Then
|
||||
If connectionString is Nothing Then
|
||||
If DefaultConnection is Nothing Then
|
||||
Set DefaultConnection = CreateObject("ADODB.Connection")
|
||||
DefaultConnection.Open DefaultConnString
|
||||
End If
|
||||
Set connectionString = DefaultConnection
|
||||
End If
|
||||
End If
|
||||
|
||||
Set cmd = CreateObject("ADODB.Command")
|
||||
|
||||
cmd.ActiveConnection = connectionString
|
||||
cmd.CommandText = strSP
|
||||
cmd.CommandType = adCmdStoredProc
|
||||
Set cmd = collectParams(cmd, params)
|
||||
|
||||
cmd.Execute , , adExecuteNoRecords
|
||||
|
||||
For inum = 0 To cmd.Parameters.Count - 1
|
||||
If cmd.Parameters(inum).Direction = adParamOutput OR cmd.Parameters(inum).Direction = adParamInputOutput OR cmd.Parameters(inum).Direction = adParamReturnValue Then
|
||||
If IsObject(params) Then
|
||||
If params is Nothing Then
|
||||
Exit For
|
||||
End If
|
||||
Else
|
||||
params(inum)(4) = cmd.Parameters(inum).Value
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
Set cmd.ActiveConnection = Nothing
|
||||
Set cmd = Nothing
|
||||
End Sub
|
||||
|
||||
'---------------------------------------------------
|
||||
' SQL Query를 실행한다.(RecordSet 반환없음)
|
||||
'---------------------------------------------------
|
||||
Public Sub ExecSQL(strSQL,params,connectionString)
|
||||
If IsObject(connectionString) Then
|
||||
If connectionString is Nothing Then
|
||||
If DefaultConnection is Nothing Then
|
||||
Set DefaultConnection = CreateObject("ADODB.Connection")
|
||||
DefaultConnection.Open DefaultConnString
|
||||
End If
|
||||
Set connectionString = DefaultConnection
|
||||
End If
|
||||
End If
|
||||
|
||||
On Error Resume Next
|
||||
|
||||
Set cmd = CreateObject("ADODB.Command")
|
||||
|
||||
cmd.ActiveConnection = connectionString
|
||||
cmd.CommandText = strSQL
|
||||
cmd.CommandType = adCmdText
|
||||
Set cmd = collectParams(cmd, params)
|
||||
cmd.Execute , , adExecuteNoRecords
|
||||
|
||||
' If DefaultConnection.Errors.Count <> 0 Then
|
||||
' For each objErr in DefaultConnection.Errors
|
||||
' response.write("<p>")
|
||||
' response.write("Description: ")
|
||||
' response.write(objErr.Description & "<br>")
|
||||
' response.write("Help context: ")
|
||||
' response.write(objErr.HelpContext & "<br>")
|
||||
' response.write("Help file: ")
|
||||
' response.write(objErr.HelpFile & "<br>")
|
||||
' response.write("Native error: ")
|
||||
' response.write(objErr.NativeError & "<br>")
|
||||
' response.write("Error number: ")
|
||||
' response.write(objErr.Number & "<br>")
|
||||
' response.write("Error source: ")
|
||||
' response.write(objErr.Source & "<br>")
|
||||
' response.write("SQL state: ")
|
||||
' response.write(objErr.SQLState & "<br>")
|
||||
' response.write("</p>")
|
||||
' Next
|
||||
' Response.End
|
||||
' End IF
|
||||
|
||||
if err.number <> 0 then
|
||||
response.Write("<b>SQL :</B>"&strSQL&"<br>")
|
||||
response.Write("<b>err.description :</B>"&err.Description&"<br>")
|
||||
response.Write("<b>err.number : </b>"&err.Number&"<br>")
|
||||
response.Write("<b>err.Source : </b>"&err.Source&"<br>")
|
||||
Response.End
|
||||
End IF
|
||||
|
||||
Set cmd.ActiveConnection = Nothing
|
||||
Set cmd = Nothing
|
||||
End Sub
|
||||
|
||||
'---------------------------------------------------
|
||||
' 트랜잭션을 시작하고, Connetion 개체를 반환한다.
|
||||
'---------------------------------------------------
|
||||
Public Function BeginTrans(connectionString)
|
||||
If IsObject(connectionString) Then
|
||||
If connectionString is Nothing Then
|
||||
connectionString = DefaultConnString
|
||||
End If
|
||||
End If
|
||||
|
||||
Set conn = CreateObject("ADODB.Connection")
|
||||
conn.Open connectionString
|
||||
conn.BeginTrans
|
||||
Set BeginTrans = conn
|
||||
End Function
|
||||
|
||||
'---------------------------------------------------
|
||||
' 활성화된 트랜잭션을 커밋한다.
|
||||
'---------------------------------------------------
|
||||
Public Sub CommitTrans(connectionObj)
|
||||
If Not connectionObj Is Nothing Then
|
||||
connectionObj.CommitTrans
|
||||
connectionObj.Close
|
||||
Set ConnectionObj = Nothing
|
||||
End If
|
||||
End Sub
|
||||
|
||||
'---------------------------------------------------
|
||||
' 활성화된 트랜잭션을 롤백한다.
|
||||
'---------------------------------------------------
|
||||
Public Sub RollbackTrans(connectionObj)
|
||||
If Not connectionObj Is Nothing Then
|
||||
connectionObj.RollbackTrans
|
||||
connectionObj.Close
|
||||
Set ConnectionObj = Nothing
|
||||
End If
|
||||
End Sub
|
||||
|
||||
'---------------------------------------------------
|
||||
' 배열로 매개변수를 만든다.
|
||||
'---------------------------------------------------
|
||||
Public Function MakeParam(PName,PType,PDirection,PSize,PValue)
|
||||
MakeParam = Array(PName, PType, PDirection, PSize, PValue)
|
||||
End Function
|
||||
|
||||
'---------------------------------------------------
|
||||
' 매개변수 배열 내에서 지정된 이름의 매개변수 값을 반환한다.
|
||||
'---------------------------------------------------
|
||||
Public Function GetValue(params, paramName)
|
||||
For Each param in params
|
||||
If param(0) = paramName Then
|
||||
GetValue = param(4)
|
||||
Exit Function
|
||||
End If
|
||||
Next
|
||||
End Function
|
||||
|
||||
Public Sub Dispose
|
||||
if (Not DefaultConnection is Nothing) Then
|
||||
if (DefaultConnection.State = adStateOpen) Then DefaultConnection.Close
|
||||
Set DefaultConnection = Nothing
|
||||
End if
|
||||
End Sub
|
||||
|
||||
'---------------------------------------------------------------------------
|
||||
'Array로 넘겨오는 파라메터를 Parsing 하여 Parameter 객체를
|
||||
'생성하여 Command 객체에 추가한다.
|
||||
'---------------------------------------------------------------------------
|
||||
Private Function collectParams(cmd,argparams)
|
||||
Dim params
|
||||
Dim i,l,u,v
|
||||
If VarType(argparams) = 8192 or VarType(argparams) = 8204 or VarType(argparams) = 8209 then
|
||||
params = argparams
|
||||
For i = LBound(params) To UBound(params)
|
||||
l = LBound(params(i))
|
||||
u = UBound(params(i))
|
||||
' Check for nulls.
|
||||
If u - l = 4 Then
|
||||
|
||||
If VarType(params(i)(4)) = vbString Then
|
||||
If params(i)(4) = "" Then
|
||||
v = Null
|
||||
Else
|
||||
v = Trim(params(i)(4))
|
||||
End If
|
||||
Else
|
||||
v = params(i)(4)
|
||||
End If
|
||||
' On Error Resume Next
|
||||
' If err.number <> 0 then
|
||||
' Response.Write params(i)(0) & ":" & params(i)(1) & ":" & params(i)(2) & ":" & params(i)(3)& ":" &v&"<BR>"
|
||||
' End If
|
||||
|
||||
If VarType(params(i)(4)) = vbString And params(i)(4) = "" Then
|
||||
Set cnParam = cmd.CreateParameter(params(i)(0))
|
||||
cnParam.attributes=adParamNullable
|
||||
cnParam.type = params(i)(1)
|
||||
cnParam.Direction = params(i)(2)
|
||||
cnParam.Size=1
|
||||
cnParam.value=Null
|
||||
cmd.Parameters.Append cnParam 'cmd.CreateParameter(params(i)(0), params(i)(1), params(i)(2), params(i)(3), Null)
|
||||
Else
|
||||
cmd.Parameters.Append cmd.CreateParameter(params(i)(0), params(i)(1), params(i)(2), params(i)(3), v)
|
||||
End If
|
||||
|
||||
End If
|
||||
Next
|
||||
|
||||
Set collectParams = cmd
|
||||
Exit Function
|
||||
Else
|
||||
Set collectParams = cmd
|
||||
End If
|
||||
End Function
|
||||
|
||||
End Class
|
||||
|
||||
%>
|
||||
300
Lib/DBLib.asp
Normal file
300
Lib/DBLib.asp
Normal file
@@ -0,0 +1,300 @@
|
||||
<%
|
||||
'###########################################################################################
|
||||
'정규식을 이용하여 문자열을 치환하는 함수
|
||||
'###########################################################################################
|
||||
Public Function eregi_replace(ByVal pattern, ByVal replacestr, ByVal text)
|
||||
Dim eregObj
|
||||
|
||||
'** Create regular expression
|
||||
Set eregObj = New RegExp
|
||||
|
||||
eregObj.Pattern = pattern '** Set Pattern(패턴 설정)
|
||||
eregObj.IgnoreCase = True '** Set Case Insensitivity(대소문자 구분 여부)
|
||||
eregObj.Global = True '** Set All Replace(전체 문서에서 검색)
|
||||
|
||||
eregi_replace = eregObj.Replace(text, replacestr) '** Replace String
|
||||
End Function
|
||||
|
||||
'###########################################################################################
|
||||
'레코드셋 JSON형식으로 변환
|
||||
'###########################################################################################
|
||||
Function RecordToJSON(Rcset)
|
||||
Dim JSON : JSON = " [ "
|
||||
Dim iCnt ,Field
|
||||
IF Rcset.RecordCount > 0 THEN
|
||||
|
||||
while not Rcset.eof
|
||||
iCnt = Rcset.Fields.Count
|
||||
JSON = JSON & " { "
|
||||
FOR EACH Field IN Rcset.Fields
|
||||
iCnt = iCNt - 1
|
||||
IF IsNull(Field.Value) THEN
|
||||
JSON = JSON & Chr(34) & Field.Name & Chr(34) & " : " & Chr(34) & Chr(34) & vbcrlf
|
||||
ELSE
|
||||
JSON = JSON & Chr(34) & Field.Name & Chr(34) & " : " & Chr(34) & Replace(Replace(Field.Value,Chr(34), "˝"),chr(10)," ") & Chr(34) & vbcrlf
|
||||
|
||||
' ' HTML 태그 내의 따옴표를 완전히 제거하여 JSON 파싱 오류 방지
|
||||
' Dim safeValue : safeValue = Field.Value
|
||||
' safeValue = Replace(safeValue, Chr(34), "") ' 따옴표 완전 제거
|
||||
' safeValue = Replace(safeValue, Chr(10), " ") ' 줄바꿈 제거
|
||||
' safeValue = Replace(safeValue, Chr(13), "") ' 캐리지 리턴 제거
|
||||
' safeValue = Replace(safeValue, Chr(9), " ") ' 탭을 공백으로
|
||||
' JSON = JSON & Chr(34) & Field.Name & Chr(34) & " : " & Chr(34) & safeValue & Chr(34) & vbcrlf
|
||||
END IF
|
||||
|
||||
IF iCnt > 0 THEN JSON = JSON & ", "
|
||||
NEXT
|
||||
JSON = JSON & " } "
|
||||
Rcset.movenext : IF NOT Rcset.eof THEN JSON = JSON & ","
|
||||
wend
|
||||
JSON = JSON & " ] "
|
||||
RecordToJSON = JSON
|
||||
ELSE
|
||||
RecordToJSON = "[]"
|
||||
END IF
|
||||
END Function
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
'###########################################################################################
|
||||
'데이터입력시 쿼리에 영향주는 문자 제거
|
||||
'###########################################################################################
|
||||
Public Function checkValue(inWord)
|
||||
inWord = eregi_replace("'", "´", inWord)
|
||||
inWord = eregi_replace(Chr(34), "˝", inWord)
|
||||
inWord = eregi_replace("\\", "\\", inWord)
|
||||
'inWord = eregi_replace("""", "˝", inWord)
|
||||
inWord = eregi_replace(";", "", inWord)
|
||||
inWord = eregi_replace(",", "¸", inWord)
|
||||
inWord = eregi_replace("--", "", inWord)
|
||||
inWord = eregi_replace("\@variable ", "", inWord)
|
||||
inWord = eregi_replace("\@@variable ", "", inWord)
|
||||
inWord = eregi_replace("\+", "", inWord)
|
||||
inWord = eregi_replace("print ", "", inWord)
|
||||
inWord = eregi_replace("set ", "", inWord)
|
||||
inWord = eregi_replace("union ", "", inWord)
|
||||
inWord = eregi_replace("insert ", "", inWord)
|
||||
inWord = eregi_replace("select ", "", inWord)
|
||||
inWord = eregi_replace("update ", "", inWord)
|
||||
inWord = eregi_replace("create ", "", inWord)
|
||||
inWord = eregi_replace("drop ", "", inWord)
|
||||
inWord = eregi_replace("openrowset ", "", inWord)
|
||||
inWord = eregi_replace("exec ", "", inWord)
|
||||
inWord = eregi_replace("§", "", inWord)
|
||||
inWord = eregi_replace("∑", "", inWord)
|
||||
inWord = eregi_replace("∮", "", inWord)
|
||||
inWord = eregi_replace("╫", "", inWord)
|
||||
inWord = eregi_replace("╬", "", inWord)
|
||||
checkValue = inWord
|
||||
End Function
|
||||
|
||||
'###########################################################################################
|
||||
' 다음 페이지 정보
|
||||
'###########################################################################################
|
||||
Function getNextPage(page,pcode)
|
||||
|
||||
Dim SQL
|
||||
Dim RsField
|
||||
|
||||
DBConnect2()
|
||||
Set RsField = Server.CreateObject("ADODB.Recordset")
|
||||
IF page = "INDEX" THEN
|
||||
SQL = " select Top 1 QID from kon.dbo.QUESTION WHERE [PKEY]= '" & pcode & "' order by Qorder "
|
||||
ELSE
|
||||
SQL = " select NPAGE from ( " &vbcrlf
|
||||
SQL = SQL & " select QID,LEAD(QID,'1','END') OVER (ORDER BY Qorder) as NPAGE from kon.dbo.QUESTION WHERE [PKEY]='" & pcode & "' " &vbcrlf
|
||||
SQL = SQL & " ) b where QID = '" & page & "' " &vbcrlf
|
||||
END IF
|
||||
|
||||
|
||||
RsField.Open SQL,DBConn,3,1,1
|
||||
|
||||
If RsField.Eof or RsField.Bof Then
|
||||
getNextPage = "END"
|
||||
else
|
||||
getNextPage = RsField(0)
|
||||
End if
|
||||
|
||||
RsField.Close
|
||||
DBClose()
|
||||
|
||||
End Function
|
||||
|
||||
'###########################################################################################
|
||||
' 다음 로테 페이지 정보
|
||||
'###########################################################################################
|
||||
Function getRotationEndPage (rota,pcode)
|
||||
|
||||
Dim SQL
|
||||
Dim RsField
|
||||
|
||||
DBConnect2()
|
||||
Set RsField = Server.CreateObject("ADODB.Recordset")
|
||||
SQL = " select top 1 NPAGE from ( " &vbcrlf
|
||||
SQL = SQL & " select QID,LEAD(QID,'1','END') OVER (ORDER BY Qorder) as NPAGE,JSON_VALUE(QUESTIONJSON ,'$.rota') as rota,Qorder from kon.dbo.QUESTION WHERE [PKEY]='"&pcode&"' " &vbcrlf
|
||||
SQL = SQL & " ) b where rota ='"&rota&"' order by Qorder desc " &vbcrlf
|
||||
RsField.Open SQL,DBConn,3,1,1
|
||||
|
||||
If RsField.Eof or RsField.Bof Then
|
||||
getRotationEndPage = "END"
|
||||
else
|
||||
getRotationEndPage = RsField(0)
|
||||
End if
|
||||
|
||||
RsField.Close
|
||||
DBClose()
|
||||
|
||||
End Function
|
||||
|
||||
'###########################################################################################
|
||||
' INIT DB DB 초기 세팅
|
||||
'###########################################################################################
|
||||
Function INITDB(DATA,PKEY,IDKEY,QID,SURVEYTYPE)
|
||||
Dim SQL
|
||||
Dim RsField
|
||||
DBConnect2()
|
||||
On Error Resume Next
|
||||
SQL = "insert into kon.dbo.DATA (IDKEY,PKEY,PAGENAME,SURVEY_TYPE,Status,DATJSON,survey_date) "
|
||||
SQL = SQL & " values('"&IDKEY&"','"&PKEY&"','"&QID&"','"&SURVEYTYPE&"','1', JSON_QUERY(N'{ "&CHR(34)& QID &CHR(34)&" : "& DATA &"}'), '{ """&QID&""":""' + cast(convert(varchar,getdate(),20) as varchar) + '""}' ) "
|
||||
|
||||
DBConn.Execute SQL
|
||||
If Err.Number > 0 Then
|
||||
CALL ERRSAVE(PKEY,IDKEY,QID," SAVEx ERROR ERR NUMBER " & Err.Number & " DESCRIPTION : " & Err.description )
|
||||
INITDB = "ERROR"
|
||||
ELSE
|
||||
|
||||
|
||||
Call WriteFileLog(Server.MapPath("/log/" & PKEY & "/LOG/" & IDKEY & ".qry"),SQL,True)
|
||||
INITDB = "SAVE"
|
||||
|
||||
'//-- wani
|
||||
SQL = " INSERT INTO Kon.dbo.DATA_SPLIT(PAGENAME, PCODE, IDKEY, SURVEY_TYPE, QNUMBER, ROTATION, DATAJSON, survey_date, DATA_IN_TYPE, DATA_IN_VAL) "
|
||||
SQL = SQL & " VALUES('"&QID&"', '"& PKEY &"', '"&IDKEY&"', '"&SURVEYTYPE&"', '"&QID&"', '', JSON_QUERY(N'{ "&CHR(34)& QID &CHR(34)&" : "& DATA &"}', getdate() "
|
||||
SQL = SQL & " , 'INITDB', 'SAVE'); "
|
||||
DBConn.Execute SQL
|
||||
|
||||
END IF
|
||||
|
||||
RsField.Close
|
||||
DBClose()
|
||||
End Function
|
||||
|
||||
|
||||
'###########################################################################################
|
||||
' SAVE DB
|
||||
'###########################################################################################
|
||||
Function SAVEDB(DATA,PKEY,IDKEY,QID,SURVEYTYPE)
|
||||
Dim SQL
|
||||
Dim RsField
|
||||
Dim num
|
||||
|
||||
|
||||
On Error Resume Next
|
||||
DBConnect2()
|
||||
|
||||
IF DATA <> "{}" THEN
|
||||
SQL = "update kon.dbo.DATA set DATJSON = JSON_MODIFY(DATJSON,'$."&QID&"',JSON_QUERY(N'"& DATA &"') ) "
|
||||
SQL = SQL & ", survey_date = JSON_MODIFY(survey_date,'$."&QID&"', cast(convert(varchar,getdate(),20) as varchar) ) "
|
||||
SQL = SQL & " where PKEY = '"& PKEY &"' and IDKEY = '" & IDKEY & "' "
|
||||
DBConn.Execute SQL,num
|
||||
END IF
|
||||
|
||||
If Err.Number > 0 Then
|
||||
CALL ERRSAVE(PKEY,IDKEY,QID," SAVEupdate ERROR ERR NUMBER " & Err.Number & " DESCRIPTION : " & Err.description )
|
||||
SAVEDB = "ERROR"
|
||||
Exit Function
|
||||
ELSE
|
||||
|
||||
IF num > 1 THEN
|
||||
'//-- wani
|
||||
SQL = " INSERT INTO Kon.dbo.DATA_SPLIT(PAGENAME, PCODE, IDKEY, SURVEY_TYPE, QNUMBER, ROTATION, DATAJSON, survey_date, DATA_IN_TYPE, DATA_IN_VAL) "
|
||||
SQL = SQL & " VALUES('"&QID&"', '"& PKEY &"', '"&IDKEY&"', '"&SURVEYTYPE&"', '"&QID&"', '', JSON_QUERY(N'"& DATA &"'), getdate() "
|
||||
SQL = SQL & " , 'SAVEDB', 'DOUBLE'); "
|
||||
DBConn.Execute SQL
|
||||
|
||||
SAVEDB = "DOUBLE"
|
||||
Exit Function
|
||||
ELSE
|
||||
Call WriteFileLog(Server.MapPath("/log/" & PKEY & "/LOG/" & IDKEY & ".qry"),SQL,False)
|
||||
|
||||
'//-- wani
|
||||
SQL = " INSERT INTO Kon.dbo.DATA_SPLIT(PAGENAME, PCODE, IDKEY, SURVEY_TYPE, QNUMBER, ROTATION, DATAJSON, survey_date, DATA_IN_TYPE, DATA_IN_VAL) "
|
||||
SQL = SQL & " VALUES('"&QID&"', '"& PKEY &"', '"&IDKEY&"', '"&SURVEYTYPE&"', '"&QID&"', '', JSON_QUERY(N'"& DATA &"'), getdate() "
|
||||
SQL = SQL & " , 'SAVEDB', 'SAVE'); "
|
||||
DBConn.Execute SQL
|
||||
|
||||
SAVEDB = "SAVE"
|
||||
Exit Function
|
||||
END IF
|
||||
END IF
|
||||
|
||||
DBClose()
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
'###########################################################################################
|
||||
' SAVE DB
|
||||
'###########################################################################################
|
||||
Function SAVEJSON(PATH,CONTENT)
|
||||
WriteUTF_File PATH, CONTENT
|
||||
End Function
|
||||
|
||||
'###########################################################################################
|
||||
' WRITE ERR 설문 진행 중 에러 저장
|
||||
'###########################################################################################
|
||||
|
||||
SUB ERRSAVE(PKEY,IDKEY,QID,DESCRIPTION)
|
||||
Dim SQL
|
||||
DBConnect2()
|
||||
DESCRIPTION = checkValue(DESCRIPTION)
|
||||
SQL = "insert into kon.dbo.ERROR (PKEY,IDKEY,QID,DESCRIPTION) "
|
||||
SQL = SQL & " values ('"&PKEY&"','"&IDKEY&"','"&QID&"','"&DESCRIPTION&"','"&Now()&"') "
|
||||
DBConn.Execute SQL
|
||||
DBClose()
|
||||
End SUB
|
||||
|
||||
'###########################################################################################
|
||||
'설문 종료
|
||||
'###########################################################################################
|
||||
|
||||
SUB ENDPROCESS(PKEY,IDKEY,ENDPAGE)
|
||||
Dim SQL
|
||||
DBConnect2()
|
||||
SQL = "update kon.dbo.DATA "
|
||||
IF ENDPAGE = "END" THEN
|
||||
SQL = SQL & " set Status = '10' "
|
||||
ELSEIF ENDPAGE = "SCREEN" THEN
|
||||
SQL = SQL & " set Status = '99' "
|
||||
ELSEIF ENDPAGE = "QUOTA" THEN
|
||||
SQL = SQL & " set Status = '98' "
|
||||
END IF
|
||||
SQL = SQL & " where PKEY = '"& PKEY &"' and IDKEY = '" & IDKEY & "' "
|
||||
DBConn.Execute SQL
|
||||
DBClose()
|
||||
End SUB
|
||||
|
||||
'###########################################################################################
|
||||
'데이터 가져오기
|
||||
'###########################################################################################
|
||||
Function getValue(fieldNm,PKEY,IDKEY)
|
||||
Dim uData
|
||||
Set uData = New aspJSON
|
||||
Dim DAT_PATH : DAT_PATH = "/log/"&PKEY&"/JSON/"&IDKEY&".json"
|
||||
Dim vData
|
||||
If FileChecker(DAT_PATH) Then
|
||||
uData.loadJSON(ReadUTF_File(DAT_PATH))
|
||||
Else
|
||||
getValue = ""
|
||||
Set uData = Nothing
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
getValue=uData.data(fieldNm)
|
||||
Set uData = Nothing
|
||||
|
||||
End Function
|
||||
|
||||
%>
|
||||
54
Lib/DBSrv.asp
Normal file
54
Lib/DBSrv.asp
Normal file
@@ -0,0 +1,54 @@
|
||||
<%
|
||||
'=======================================================================
|
||||
'업 무 명 : KRI-common
|
||||
'모듈기능 : 데이터베이스 서버 연결자 설정
|
||||
'파 일 명 : DBSrv.asp
|
||||
'작성일자 : 2004/10/09
|
||||
'작 성 자 : 김홍완
|
||||
'-----------------------------------------------------------------------
|
||||
'변경일자 변경자 변동내역
|
||||
'=======================================================================
|
||||
'
|
||||
'=======================================================================
|
||||
'Response.Expires = -1
|
||||
%>
|
||||
<%
|
||||
|
||||
'//-------------------------------
|
||||
'//-- hwkim 2020-08-19 17:28:41
|
||||
Dim rs_ip: rs_ip = Request.ServerVariables("REMOTE_ADDR"): 'Response.Write ip
|
||||
Dim rs_DevNode: rs_DevNode = "real"
|
||||
|
||||
If( rs_ip = "10.10.13.82" or rs_ip = "10.10.13.115" or rs_ip = "10.10.13.117" or rs_ip = "10.10.13.118" or rs_ip = "10.10.13.130" )Then
|
||||
rs_DevNode = "dev"
|
||||
|
||||
'response.write "----------------"& fncRequestVariables("LOCAL_ADDR") &"<br>"
|
||||
'response.write "----------------"& fncRequestVariables("REMOTE_ADDR") &"<br>"
|
||||
|
||||
Else
|
||||
rs_DevNode = "real"
|
||||
End if
|
||||
'-------------------------------//
|
||||
|
||||
|
||||
'서버 디비 연결자
|
||||
'**************************************
|
||||
Dim DBConCapi, DBConKrcSurvey, DBConKon, DBConHmcGmc
|
||||
|
||||
DBConCapi = "Provider=SQLOLEDB;User Id=sa;PWD=krco#51304;Data Source=1.235.195.34;Initial Catalog=capi;" 'capi 디비연결
|
||||
DBConKrcSurvey = "Provider=SQLOLEDB;User Id=sa;PWD=krco#51304;Data Source=1.235.195.34;Initial Catalog=krc_survey;" 'krc_survey 디비연결
|
||||
DBConHmcGmc = "Provider=SQLOLEDB;User Id=kon;PWD=kon#51304;Data Source=1.235.195.8,20022;Initial Catalog=HMC_2004045;" 'hmc_gmc 디비연결
|
||||
'DBConHmcGmc = "Provider=SQLOLEDB;User Id=2020poll;PWD=krco#51304;Data Source=1.235.195.8,20022;Initial Catalog=HMC_2004045;" 'hmc_gmc 디비연결
|
||||
|
||||
|
||||
|
||||
If( rs_DevNode = "dev" )then
|
||||
DBConKon = "Provider=SQLOLEDB;User Id=kon;PWD=kon#51304;Data Source=10.10.13.177,1313;Initial Catalog=kon;" 'K-ON 개발 디비연결
|
||||
else
|
||||
DBConKon = "Provider=SQLOLEDB;User Id=kon;PWD=kon#51304;Data Source=1.235.195.8,20022;Initial Catalog=kon;" 'K-ON 디비연결
|
||||
end if
|
||||
|
||||
|
||||
'response.write "----------------"& DBConKon &"<br>"
|
||||
|
||||
%>
|
||||
307
Lib/FileLib.asp
Normal file
307
Lib/FileLib.asp
Normal file
@@ -0,0 +1,307 @@
|
||||
<%
|
||||
|
||||
'###########################################################################################
|
||||
'ANSI 파일 함수
|
||||
'파일 관련 함수
|
||||
'###########################################################################################
|
||||
Function FileChecker(filePath)
|
||||
|
||||
Dim oFSO
|
||||
Set oFSO = Server.CreateObject("Scripting.FileSystemObject")
|
||||
' Response.Write filePath &" <BR>"
|
||||
|
||||
if oFSO.FileExists(Server.MapPath(filePath)) then
|
||||
FileChecker=true
|
||||
Else
|
||||
FileChecker=false
|
||||
End If
|
||||
|
||||
set oFSO = nothing
|
||||
End Function
|
||||
|
||||
'###########################################################################################
|
||||
'파일 복사
|
||||
'파일 관련 함수
|
||||
'###########################################################################################
|
||||
Function FileCopy(source,target)
|
||||
|
||||
Dim oFSO
|
||||
Set oFSO = Server.CreateObject("Scripting.FileSystemObject")
|
||||
|
||||
if oFSO.FileExists(Server.MapPath(source)) Then
|
||||
oFSO.CopyFile Server.MapPath(source),Server.MapPath(target)
|
||||
FileCopy=true
|
||||
Else
|
||||
FileCopy=false
|
||||
End If
|
||||
|
||||
set oFSO = nothing
|
||||
End Function
|
||||
|
||||
'###########################################################################################
|
||||
'파일 복사
|
||||
'파일 관련 함수
|
||||
'###########################################################################################
|
||||
Function FileCopyAll(source,target)
|
||||
|
||||
Dim oFSO
|
||||
Set oFSO = Server.CreateObject("Scripting.FileSystemObject")
|
||||
oFSO.CopyFile Server.MapPath(source)&"\*.*",Server.MapPath(target)
|
||||
FileCopyAll=true
|
||||
|
||||
set oFSO = nothing
|
||||
End Function
|
||||
|
||||
'###########################################################################################
|
||||
'파일 쓰기 함수
|
||||
'###########################################################################################
|
||||
function WriteFile(filePath,Str)
|
||||
|
||||
Dim oFSO,wFile
|
||||
Set oFSO = Server.CreateObject("Scripting.FileSystemObject")
|
||||
Set wFile = oFSO.CreateTextFile(filePath,true)
|
||||
|
||||
wFile.writeLine(Str)
|
||||
wFile.Close
|
||||
|
||||
Set oFSO = nothing
|
||||
end function
|
||||
|
||||
'###########################################################################################
|
||||
'로그파일 쓰기 함수
|
||||
'###########################################################################################
|
||||
function WriteFileLog(filePath,Str,Survey_Flag)
|
||||
|
||||
Dim Strs
|
||||
If Survey_Flag = True Then
|
||||
Strs = Str
|
||||
Else
|
||||
Strs = LoadStream(filePath) & Str
|
||||
End if
|
||||
|
||||
Dim oFSO,wFile
|
||||
|
||||
Set oFSO = Server.CreateObject("ADODB.Stream")
|
||||
|
||||
oFSO.CharSet = "utf-8"
|
||||
oFSO.Mode = 3
|
||||
oFSO.Type = 2
|
||||
oFSO.Open
|
||||
oFSO.WriteText(Strs),1
|
||||
oFSO.SaveToFile filePath,2
|
||||
oFSO.Flush
|
||||
oFSO.Close
|
||||
Set oFSO = Nothing
|
||||
|
||||
End function
|
||||
|
||||
'###########################################################################################
|
||||
'로그파일 읽어오기
|
||||
'###########################################################################################
|
||||
Function LoadStream(FilePath)
|
||||
Dim oFSO,wFile
|
||||
Set oFSO = Server.CreateObject("ADODB.Stream")
|
||||
|
||||
oFSO.CharSet = "utf-8"
|
||||
oFSO.Mode = 3
|
||||
oFSO.Type = 2
|
||||
oFSO.Open
|
||||
|
||||
|
||||
oFSO.LoadFromFile FilePath
|
||||
LoadStream = oFSO.ReadText
|
||||
|
||||
oFSO.Close
|
||||
Set oFSO = Nothing
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
'###########################################################################################
|
||||
'CONFIG 파일 수정.
|
||||
'###########################################################################################
|
||||
SUB MODIFY_CONFIG_FILE(PKEY,TITLE,PCOLOR)
|
||||
Dim configPath : configPath = "/projectTemplate/include/Config.asp"
|
||||
configFile = ReadUTF_File(configPath)
|
||||
configFile = Replace(configFile,"[@PROJECTCODE]",PKEY)
|
||||
configFile = Replace(configFile,"[@PROJECTTITLE]",TITLE)
|
||||
configFile = Replace(configFile,"[@PROJECTCOLOR]",PCOLOR)
|
||||
Dim targetPath : targetPath = "/project/"&PKEY&"/include/Config.asp"
|
||||
WriteUTF_File targetPath, configFile
|
||||
END SUB
|
||||
|
||||
'###########################################################################################
|
||||
'LOG 폴더 생성
|
||||
'###########################################################################################
|
||||
SUB MAKE_LOG_FOLDER(PKEY)
|
||||
DIM ROOTPATH : ROOTPATH = "/log/"&PKEY
|
||||
DIM LOGPATH : LOGPATH = ROOTPATH & "/LOG"
|
||||
DIM JSONPATH : JSONPATH = ROOTPATH & "/JSON"
|
||||
MakeFolder Server.mappath(ROOTPATH)
|
||||
MakeFolder Server.mappath(LOGPATH)
|
||||
MakeFolder Server.mappath(JSONPATH)
|
||||
END SUB
|
||||
|
||||
|
||||
'###########################################################################################
|
||||
'폴더 관련 함수
|
||||
'###########################################################################################
|
||||
Function FolderChecker(filePath)
|
||||
|
||||
Dim oFSO
|
||||
Set oFSO = Server.CreateObject("Scripting.FileSystemObject")
|
||||
|
||||
if oFSO.FolderExists(filePath) then
|
||||
FolderChecker=true
|
||||
Else
|
||||
FolderChecker=false
|
||||
End If
|
||||
|
||||
set oFSO = nothing
|
||||
End Function
|
||||
|
||||
'###########################################################################################
|
||||
'폴더 만들기
|
||||
'###########################################################################################
|
||||
function MakeFolder(filePath)
|
||||
|
||||
Dim oFSO,wFolder
|
||||
Set oFSO = Server.CreateObject("Scripting.FileSystemObject")
|
||||
|
||||
oFSO.CreateFolder filePath
|
||||
|
||||
Set oFSO = nothing
|
||||
end Function
|
||||
|
||||
'###########################################################################################
|
||||
'폴더 삭제
|
||||
'###########################################################################################
|
||||
function deleteFolder(filePath)
|
||||
|
||||
Dim oFSO,wFolder
|
||||
Set oFSO = Server.CreateObject("Scripting.FileSystemObject")
|
||||
|
||||
oFSO.deleteFolder filePath
|
||||
|
||||
Set oFSO = nothing
|
||||
end Function
|
||||
|
||||
'###########################################################################################
|
||||
'폴더 카피
|
||||
'###########################################################################################
|
||||
function CopyFolder(targetPath,destinationPath)
|
||||
|
||||
Dim oFSO
|
||||
Set oFSO = Server.CreateObject("Scripting.FileSystemObject")
|
||||
|
||||
oFSO.CopyFolder targetPath,destinationPath
|
||||
|
||||
Set oFSO = nothing
|
||||
end Function
|
||||
|
||||
'###########################################################################################
|
||||
'UTF-8
|
||||
'파일 읽기
|
||||
'###########################################################################################
|
||||
Function ReadUTF_File(FileUrl)
|
||||
|
||||
Dim objStream
|
||||
If FileChecker(fileUrl) Then
|
||||
Set objStream = CreateObject("ADODB.Stream")
|
||||
With objStream
|
||||
.Charset = "utf-8"
|
||||
.Type=2
|
||||
.mode=3
|
||||
.Open
|
||||
.loadfromfile Server.Mappath(FileUrl)
|
||||
ReadUTF_File=.readtext
|
||||
.Close
|
||||
End With
|
||||
|
||||
Set objStream = Nothing
|
||||
Else
|
||||
ReadUTF_File = ""
|
||||
End IF
|
||||
End Function
|
||||
|
||||
'###########################################################################################
|
||||
'파일 저장
|
||||
'###########################################################################################
|
||||
Sub WriteUTF_File (FileUrl,ByVal Str)
|
||||
|
||||
'Response.Write fileUrl & "<BR>"
|
||||
response.write server.MapPath(FileUrl)
|
||||
Dim objStream
|
||||
Set objStream=Server.CreateObject("ADODB.Stream")
|
||||
|
||||
With objStream
|
||||
.Type=2 '1: 바이너리 2: for text type
|
||||
.mode=3 '1: ReadOnly 2:WriteOnly 3:ReadWrite
|
||||
.Charset="utf-8"
|
||||
.Open
|
||||
.WriteText str
|
||||
.SaveToFile server.MapPath(FileUrl),2
|
||||
.flush
|
||||
.Close
|
||||
End With
|
||||
Set objStream=nothing
|
||||
End Sub
|
||||
|
||||
'###########################################################################################
|
||||
'파일 저장
|
||||
'###########################################################################################
|
||||
Sub WriteUTF_File2 (FileUrl,ByVal Str)
|
||||
|
||||
Dim objStream
|
||||
Set objStream=Server.CreateObject("ADODB.Stream")
|
||||
|
||||
With objStream
|
||||
.Type=1 '1: 바이너리 2: for text type
|
||||
.mode=3 '1: ReadOnly 2:WriteOnly 3:ReadWrite
|
||||
.Charset="utf-8"
|
||||
.Open
|
||||
.WriteText str
|
||||
.SaveToFile server.MapPath(FileUrl),2
|
||||
.flush
|
||||
.Close
|
||||
End With
|
||||
Set objStream=nothing
|
||||
End Sub
|
||||
|
||||
'###########################################################################################
|
||||
'파일 삭제를 위한 함수
|
||||
'###########################################################################################
|
||||
function DeleteFile(filePath)
|
||||
|
||||
Dim oFSO
|
||||
Set oFSO = Server.CreateObject("Scripting.FileSystemObject")
|
||||
|
||||
' 해당 파일이 있으면 삭제
|
||||
If oFSO.FileExists(filePath) Then
|
||||
oFSO.DeleteFile filePath
|
||||
end if
|
||||
|
||||
Set oFSO = nothing
|
||||
end Function
|
||||
|
||||
'###########################################################################################
|
||||
'텍스트 파일 읽기 - 상대 경로로 읽어들여짐
|
||||
'###########################################################################################
|
||||
Function ReadFile(FileUrl)
|
||||
|
||||
Dim fsObj,fileObj
|
||||
Dim readText
|
||||
readText = ""
|
||||
Set fsObj=Server.CreateObject("Scripting.FileSystemObject")
|
||||
|
||||
If FileChecker(FileUrl) Then
|
||||
Set fileObj=fsObj.OpenTextFile(Server.MapPath(FileUrl), 1)
|
||||
readText = fileObj.readAll
|
||||
End IF
|
||||
|
||||
Set fileObj = Nothing
|
||||
Set fsObj = Nothing
|
||||
|
||||
ReadFile = readText
|
||||
End Function
|
||||
%>
|
||||
210
Lib/JSON_2.0.4.asp
Normal file
210
Lib/JSON_2.0.4.asp
Normal file
@@ -0,0 +1,210 @@
|
||||
<%
|
||||
'
|
||||
' VBS JSON 2.0.3
|
||||
' Copyright (c) 2009 Tu?ul Topuz
|
||||
' Under the MIT (MIT-LICENSE.txt) license.
|
||||
'
|
||||
|
||||
Const JSON_OBJECT = 0
|
||||
Const JSON_ARRAY = 1
|
||||
|
||||
Class jsCore
|
||||
Public Collection
|
||||
Public Count
|
||||
Public QuotedVars
|
||||
Public Kind ' 0 = object, 1 = array
|
||||
|
||||
Private Sub Class_Initialize
|
||||
Set Collection = CreateObject("Scripting.Dictionary")
|
||||
QuotedVars = True
|
||||
Count = 0
|
||||
End Sub
|
||||
|
||||
Private Sub Class_Terminate
|
||||
Set Collection = Nothing
|
||||
End Sub
|
||||
|
||||
' counter
|
||||
Private Property Get Counter
|
||||
Counter = Count
|
||||
Count = Count + 1
|
||||
End Property
|
||||
|
||||
' - data maluplation
|
||||
' -- pair
|
||||
Public Property Let Pair(p, v)
|
||||
If IsNull(p) Then p = Counter
|
||||
Collection(p) = v
|
||||
End Property
|
||||
|
||||
Public Property Set Pair(p, v)
|
||||
If IsNull(p) Then p = Counter
|
||||
If TypeName(v) <> "jsCore" Then
|
||||
Err.Raise &hD, "class: class", "Incompatible types: '" & TypeName(v) & "'"
|
||||
End If
|
||||
Set Collection(p) = v
|
||||
End Property
|
||||
|
||||
Public Default Property Get Pair(p)
|
||||
If IsNull(p) Then p = Count - 1
|
||||
If IsObject(Collection(p)) Then
|
||||
Set Pair = Collection(p)
|
||||
Else
|
||||
Pair = Collection(p)
|
||||
End If
|
||||
End Property
|
||||
' -- pair
|
||||
Public Sub Clean
|
||||
Collection.RemoveAll
|
||||
End Sub
|
||||
|
||||
Public Sub Remove(vProp)
|
||||
Collection.Remove vProp
|
||||
End Sub
|
||||
' data maluplation
|
||||
|
||||
' encoding
|
||||
Function jsEncode(str)
|
||||
Dim charmap(127), haystack()
|
||||
charmap(8) = "\b"
|
||||
charmap(9) = "\t"
|
||||
charmap(10) = "\n"
|
||||
charmap(12) = "\f"
|
||||
charmap(13) = "\r"
|
||||
charmap(34) = "\"""
|
||||
charmap(47) = "\/"
|
||||
charmap(92) = "\\"
|
||||
|
||||
Dim strlen : strlen = Len(str) - 1
|
||||
ReDim haystack(strlen)
|
||||
|
||||
Dim i, charcode
|
||||
For i = 0 To strlen
|
||||
haystack(i) = Mid(str, i + 1, 1)
|
||||
|
||||
charcode = AscW(haystack(i)) And 65535
|
||||
If charcode < 127 Then
|
||||
If Not IsEmpty(charmap(charcode)) Then
|
||||
haystack(i) = charmap(charcode)
|
||||
ElseIf charcode < 32 Then
|
||||
haystack(i) = "\u" & Right("000" & Hex(charcode), 4)
|
||||
End If
|
||||
Else
|
||||
haystack(i) = "\u" & Right("000" & Hex(charcode), 4)
|
||||
End If
|
||||
Next
|
||||
|
||||
jsEncode = Join(haystack, "")
|
||||
End Function
|
||||
|
||||
' converting
|
||||
Public Function toJSON(vPair)
|
||||
Select Case VarType(vPair)
|
||||
Case 0 ' Empty
|
||||
toJSON = "null"
|
||||
Case 1 ' Null
|
||||
toJSON = "null"
|
||||
Case 7 ' Date
|
||||
' toJSON = "new Date(" & (vPair - CDate(25569)) * 86400000 & ")" ' let in only utc time
|
||||
toJSON = """" & CStr(vPair) & """"
|
||||
Case 8 ' String
|
||||
toJSON = """" & CStr(vPair) & """"
|
||||
Case 9 ' Object
|
||||
Dim bFI,i
|
||||
bFI = True
|
||||
If vPair.Kind Then toJSON = toJSON & "[" Else toJSON = toJSON & "{"
|
||||
For Each i In vPair.Collection
|
||||
If bFI Then bFI = False Else toJSON = toJSON & ","
|
||||
|
||||
If vPair.Kind Then
|
||||
toJSON = toJSON & toJSON(vPair(i))
|
||||
Else
|
||||
If QuotedVars Then
|
||||
toJSON = toJSON & """" & i & """:" & toJSON(vPair(i))
|
||||
Else
|
||||
toJSON = toJSON & i & ":" & toJSON(vPair(i))
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
If vPair.Kind Then toJSON = toJSON & "]" Else toJSON = toJSON & "}"
|
||||
Case 11
|
||||
If vPair Then toJSON = "true" Else toJSON = "false"
|
||||
Case 12, 8192, 8204
|
||||
toJSON = RenderArray(vPair, 1, "")
|
||||
Case Else
|
||||
toJSON = Replace(vPair, ",", ".")
|
||||
End select
|
||||
End Function
|
||||
|
||||
Function RenderArray(arr, depth, parent)
|
||||
Dim first : first = LBound(arr, depth)
|
||||
Dim last : last = UBound(arr, depth)
|
||||
|
||||
Dim index, rendered
|
||||
Dim limiter : limiter = ","
|
||||
|
||||
RenderArray = "["
|
||||
For index = first To last
|
||||
If index = last Then
|
||||
limiter = ""
|
||||
End If
|
||||
|
||||
On Error Resume Next
|
||||
rendered = RenderArray(arr, depth + 1, parent & index & "," )
|
||||
|
||||
If Err = 9 Then
|
||||
On Error GoTo 0
|
||||
RenderArray = RenderArray & toJSON(Eval("arr(" & parent & index & ")")) & limiter
|
||||
Else
|
||||
RenderArray = RenderArray & rendered & "" & limiter
|
||||
End If
|
||||
Next
|
||||
RenderArray = RenderArray & "]"
|
||||
End Function
|
||||
|
||||
Public Property Get jsString
|
||||
jsString = toJSON(Me)
|
||||
End Property
|
||||
|
||||
Sub Flush
|
||||
If TypeName(Response) <> "Empty" Then
|
||||
Response.Write(jsString)
|
||||
ElseIf WScript <> Empty Then
|
||||
WScript.Echo(jsString)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Function Clone
|
||||
Set Clone = ColClone(Me)
|
||||
End Function
|
||||
|
||||
Private Function ColClone(core)
|
||||
Dim jsc, i
|
||||
Set jsc = new jsCore
|
||||
jsc.Kind = core.Kind
|
||||
For Each i In core.Collection
|
||||
If IsObject(core(i)) Then
|
||||
Set jsc(i) = ColClone(core(i))
|
||||
Else
|
||||
jsc(i) = core(i)
|
||||
End If
|
||||
Next
|
||||
Set ColClone = jsc
|
||||
End Function
|
||||
|
||||
End Class
|
||||
|
||||
Function jsObject
|
||||
Set jsObject = new jsCore
|
||||
jsObject.Kind = JSON_OBJECT
|
||||
End Function
|
||||
|
||||
Function jsArray
|
||||
Set jsArray = new jsCore
|
||||
jsArray.Kind = JSON_ARRAY
|
||||
End Function
|
||||
|
||||
Function toJSON(val)
|
||||
toJSON = (new jsCore).toJSON(val)
|
||||
End Function
|
||||
%>
|
||||
29
Lib/JSON_UTIL_0.1.1.asp
Normal file
29
Lib/JSON_UTIL_0.1.1.asp
Normal file
@@ -0,0 +1,29 @@
|
||||
<%
|
||||
Function QueryToJSON(dbc, sql)
|
||||
Dim rs, jsa
|
||||
Set rs = dbc.Execute(sql)
|
||||
Set jsa = jsArray()
|
||||
While Not (rs.EOF Or rs.BOF)
|
||||
Set jsa(Null) = jsObject()
|
||||
For Each col In rs.Fields
|
||||
jsa(Null)(col.Name) = col.Value
|
||||
Next
|
||||
rs.MoveNext
|
||||
Wend
|
||||
Set QueryToJSON = jsa
|
||||
End Function
|
||||
|
||||
Function RecordsetToJSON(ByVal rs)
|
||||
Dim jsa,col
|
||||
Set jsa = jsArray()
|
||||
While Not (rs.EOF Or rs.BOF)
|
||||
Set jsa(Null) = jsObject()
|
||||
For Each col In rs.Fields
|
||||
jsa(Null)(col.Name) = col.Value
|
||||
Next
|
||||
rs.MoveNext
|
||||
Wend
|
||||
Set RecordsetToJSON = jsa
|
||||
End Function
|
||||
|
||||
%>
|
||||
59
Lib/KRConfig.asp
Normal file
59
Lib/KRConfig.asp
Normal file
@@ -0,0 +1,59 @@
|
||||
<% @Language='vbscript' codepage='65001'%>
|
||||
<!--METADATA TYPE= "typelib" NAME= "ADODB Type Library" FILE="C:\Program Files\Common Files\SYSTEM\ADO\msado15.dll" -->
|
||||
<%
|
||||
Option Explicit
|
||||
|
||||
'Survey DB 설정
|
||||
Dim SV_NAME,DB_NAME,UID,PWD
|
||||
Dim SV_NAME1,DB_NAME1,UID1,PWD1
|
||||
Dim DBconn
|
||||
Dim SITENAME ' 사이트 URL
|
||||
Dim LOGINURL ' 로그인 URL
|
||||
Dim PROGRAMTITLE '페이지 타이틀
|
||||
Dim MAIL_SV,MAIL_ID,MAIL_PW '메일 설정 자료
|
||||
Dim SALT '암호화 도움키 *분실하거나 수정되면 안됨. - 비밀번호를 전부 재설정 해야함
|
||||
Dim BASIC_COL '설문 데이터의 시스템 컬럼 갯수
|
||||
Dim Local_IP : Local_IP = Request.ServerVariables("REMOTE_ADDR") '접속자 IP(사내용)
|
||||
|
||||
SITENAME = "http://10.10.13.115:9999"
|
||||
LOGINURL = "http://10.10.13.115:9999/Login.html"
|
||||
|
||||
|
||||
SALT = "kric2016cp$@"
|
||||
PROGRAMTITLE = "온라인 설문지 제작 시스템"
|
||||
|
||||
BASIC_COL = 14
|
||||
|
||||
MAIL_SV = ""
|
||||
MAIL_ID = ""
|
||||
MAIL_PW = ""
|
||||
|
||||
'#######################################################################################
|
||||
'DB 설정값 Read
|
||||
'#######################################################################################
|
||||
SV_NAME = "10.10.13.115"
|
||||
DB_NAME= "capi"
|
||||
UID = "sa"
|
||||
PWD = "dudgus25"
|
||||
|
||||
SV_NAME1 = "10.10.13.115"
|
||||
DB_NAME1= "krc_survey"
|
||||
UID1 = "sa"
|
||||
PWD1 = "dudgus25"
|
||||
|
||||
%>
|
||||
<!-- #include Virtual = "/Lib/DBConn.asp" -->
|
||||
<!-- #include Virtual = "/Lib/DBLib.asp" -->
|
||||
<!-- #include Virtual = "/Lib/DBHelper.asp" -->
|
||||
<!-- #include Virtual = "/Lib/CAPICOM.asp" -->
|
||||
<!-- #include Virtual = "/Lib/Func.asp" -->
|
||||
<!-- #include Virtual = "/Lib/SiteFunc.asp" -->
|
||||
<!-- #include Virtual = "/Lib/ComLib.asp" -->
|
||||
<!-- #include Virtual = "/Lib/FileLib.asp" -->
|
||||
<!-- #include Virtual = "/Lib/XMLClass.asp" -->
|
||||
<!-- #include Virtual = "/Lib/freeASPUpload.asp" -->
|
||||
<!-- #include Virtual = "/Lib/sha256.asp" -->
|
||||
<!-- #include Virtual = "/Lib/md5.asp" -->
|
||||
<!-- #include Virtual = "/Lib/aspJSON1.17.asp" -->
|
||||
<!-- #include Virtual = "/Lib/JSON_2.0.4.asp" -->
|
||||
<!-- #include Virtual = "/Lib/JSON_UTIL_0.1.1.asp" -->
|
||||
230
Lib/RSExec.asp
Normal file
230
Lib/RSExec.asp
Normal file
@@ -0,0 +1,230 @@
|
||||
<%
|
||||
'=======================================================================
|
||||
'업 무 명 : KRI-common
|
||||
'모듈기능 : 서버 디비 연결자 설정
|
||||
'파 일 명 : Create RecordSet object
|
||||
' 사용할 페이지 에서 call
|
||||
' 사용이 끝나면 객체 반환 call RSClose(RecordSet이름)
|
||||
'작성일자 : 2004/10/09
|
||||
'작 성 자 : 김홍완
|
||||
'-----------------------------------------------------------------------
|
||||
'변경일자 변경자 변동내역
|
||||
'=======================================================================
|
||||
'
|
||||
'=======================================================================
|
||||
'Response.Expires = -1
|
||||
%>
|
||||
<!-- #include file="DBSrv.asp" -->
|
||||
<%
|
||||
'===========================================================================
|
||||
'함수명 : DBexec
|
||||
'INPUT : sSQL(실행할 Query 문장), DBTarget(각 데이타베이스 디바이스 접근 설정)
|
||||
'기능설명 : 단일 데이터 베이스 연결 객체 생성/실행
|
||||
'===========================================================================
|
||||
Function DBexec(sSQL,DBTarget)
|
||||
Dim DBCon, DBTgt
|
||||
On Error Resume Next
|
||||
|
||||
If LEN(sSQL) = 0 Then
|
||||
if fncRequestVariables("LOCAL_ADDR")="10.10.13.82" then
|
||||
Response.Write "<br><font size=2>에러스텝 1 : 실행할 SQL문을 입력하세요.</font><br>"
|
||||
else
|
||||
response.Redirect "/etc/error/error.asp?"
|
||||
end if
|
||||
response.end
|
||||
|
||||
Exit function
|
||||
End If
|
||||
|
||||
|
||||
Select Case DBTarget
|
||||
Case "kon" : DBTgt = DBConKon '메인 DB
|
||||
'Case "kon" : DBTgt = DBConKon '메인 DB Dev
|
||||
Case "capi" : DBTgt = DBConCapi 'CAPI
|
||||
Case "krc_urvey": DBTgt = DBConKrcSurvey 'KRC_Survey
|
||||
Case "hmcgmc" : DBTgt = DBConHmcGmc 'DBConHmcGmc
|
||||
Case Else
|
||||
if fncRequestVariables("LOCAL_ADDR")="10.10.13.82" then
|
||||
Response.Write "<br><font size=2>에러스텝 2 : 연결할 데이타베이스의 정확한 문자열을 입력하시오!</font><br>"
|
||||
else
|
||||
response.Redirect "/etc/error/error.asp"
|
||||
end if
|
||||
Response.End
|
||||
End Select
|
||||
|
||||
|
||||
'''response.write "<br>----------------"& DBTgt
|
||||
|
||||
|
||||
Set DBCon=Server.CreateObject("ADODB.Connection") 'DB에 연결
|
||||
DBCon.CursorLocation = 3 'client cursor
|
||||
'DBCon.CursorLocation = adUseClient
|
||||
DBCon.CommandTimeout = 0 ' select 쿼리 시간 무제한
|
||||
DBCon.Open DBTgt
|
||||
|
||||
if Err.number <> 0 Then
|
||||
if fncRequestVariables("LOCAL_ADDR")="10.10.13.82" then
|
||||
response.write "<br><font size=2>에러스텝 3 : DB Open Error!! 데이터베이스를 정상적으로 연결하지 못하였습니다.</font><br>"
|
||||
Response.Write "<br>" & sSql
|
||||
else
|
||||
response.Redirect "/etc/error/error.asp"
|
||||
end if
|
||||
Response.End
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
Set DBexec = DBCon.Execute(sSQL)
|
||||
|
||||
dim sErr
|
||||
If Err.number <> 0 Then
|
||||
err_source = replace(Err.Source,"'","''")
|
||||
err_description = replace(Err.description,"'","''")
|
||||
err_number = replace(Err.Number,"'","''")
|
||||
err_page = replace(fncRequestVariables("URL"),"'","''")
|
||||
|
||||
if fncRequestVariables("LOCAL_ADDR")="10.10.13.82" then
|
||||
sErr = "<TABLE cellSpacing=1 cellPadding=1 width='80%' border=1 align=center>"
|
||||
sErr = sErr & "<TR><TD width='12%' title='"&Err.description&"'><FONT SIZE=2>에러스텝 4</FONT></TD><TD><FONT SIZE=2>개체명이나 컬럼 혹은 인수값이 잘못되었습니다.</FONT></TD></TR>"
|
||||
sErr = sErr & "<TR><TD ><FONT SIZE=2>오류객체명</FONT></TD><TD><FONT SIZE=2>"&Err.Source&"</FONT></TD></TR>"
|
||||
sErr = sErr & "<TR><TD><FONT SIZE=2>오류설명</FONT></TD><TD><FONT SIZE=2>"&Err.description&"</FONT></TD></TR>"
|
||||
sErr = sErr & "<TR><TD><FONT SIZE=2>오류번호</FONT></TD><TD><FONT SIZE=2>"&Err.Number&"</FONT></TD></TR>"
|
||||
sErr = sErr & "<TR><TD><FONT SIZE=2>QUERY</FONT></TD><TD><FONT SIZE=2>"&sSQL&"</FONT></TD></TR>"
|
||||
sErr = sErr & "<TR><TD><FONT SIZE=2>에러페이지</FONT></TD><TD><FONT SIZE=2>"&err_page&"</FONT></TD></TR>"
|
||||
sErr = sErr & "<TR><TD><FONT SIZE=2>DB Target</FONT></TD><TD><FONT SIZE=2>"&DBTarget&"</FONT></TD></TR>"
|
||||
sErr = sErr & "</TABLE>"
|
||||
Response.Write sErr
|
||||
call DBExecClose(DBcon)
|
||||
else
|
||||
response.Redirect "/etc/error/error.asp"
|
||||
end if
|
||||
Response.End
|
||||
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
End function
|
||||
|
||||
'===========================================================================
|
||||
'함수명 : DBExecClose
|
||||
'INPUT : DBCon
|
||||
'기능설명 : 단일 데이터 베이스 연결 객체 소멸
|
||||
'===========================================================================
|
||||
Function DBExecClose(DBCon)
|
||||
If IsObject(DBCon) = True Then
|
||||
DBCon.Close
|
||||
Set DBCon = Nothing
|
||||
end if
|
||||
End Function
|
||||
|
||||
'===========================================================================
|
||||
'함수명 : RSexec
|
||||
'INPUT : rsName(RecordSet객체를위한Instance 이름),pSize(PageSize 선택)
|
||||
' cType : CursorType 설정
|
||||
' 0 : AdOpenForwardOnly(MoveNext만 지원)
|
||||
' 1 : AdOpenKeyset(변경 데이타는 볼 수 없음)
|
||||
' 2 : AdOpenDynamic(모든 방식의 커서지원)
|
||||
' 3 : AdOpenStatic(데이타 검색이나 레포트 생성시에 사용)
|
||||
' sSQL(실행할 Query 문장),DBTarget(각 데이타베이스 디바이스 접근 설정)
|
||||
'기능설명 : 레코드셋 객체 생성/실행
|
||||
'===========================================================================
|
||||
Function RSexec(rsName,pSize,cType,sSQL,DBTarget)
|
||||
|
||||
Dim globalDBCon, DBTgt
|
||||
On Error Resume Next
|
||||
|
||||
If LEN(sSQL) = 0 Then
|
||||
if fncRequestVariables("LOCAL_ADDR")="10.10.13.82" then
|
||||
Response.Write "<br><font size=2>에러스텝 1 : 실행할 SQL문을 입력하세요.</font><br>"
|
||||
else
|
||||
response.Redirect "/etc/error/error.asp"
|
||||
end if
|
||||
response.end
|
||||
Exit function
|
||||
End If
|
||||
|
||||
Select Case DBTarget
|
||||
Case "kon" : DBTgt = DBConKon '메인 DB
|
||||
'Case "kon" : DBTgt = DBConKon '메인 DB Dev
|
||||
Case "capi" : DBTgt = DBConCapi 'CAPI
|
||||
Case "krc_urvey": DBTgt = DBConKrcSurvey 'KRC_Survey
|
||||
'------------------------------------------------------------------------------------------------------
|
||||
Case Else
|
||||
if fncRequestVariables("LOCAL_ADDR")="10.10.13.82" then
|
||||
Response.Write "<br><font size=2>에러스텝 2B : 연결할 데이타베이스의 정확한 문자열을 입력하시오!</font><br>"
|
||||
else
|
||||
response.Redirect "/etc/error/error.asp"
|
||||
end if
|
||||
Response.End
|
||||
|
||||
End Select
|
||||
|
||||
If IsObject(globalDBCon) = False Then
|
||||
Set globalDBCon = Server.CreateObject("ADODB.Connection")
|
||||
globalDBCon.CursorLocation = 3 'client cursor
|
||||
'globalDBCon.CursorLocation = adUseClient
|
||||
globalDBCon.CommandTimeout = 0 ' select 쿼리 시간 무제한
|
||||
globalDBCon.Open DBTgt
|
||||
|
||||
if Err.number <> 0 Then
|
||||
if fncRequestVariables("LOCAL_ADDR")="10.10.13.82" then
|
||||
response.write "<br><font size=2>에러스텝 3 : DB Open Error!! 데이터베이스를 정상적으로 연결하지 못하였습니다.</font><br>"
|
||||
Response.Write "<br>" & sSql
|
||||
else
|
||||
response.Redirect "/etc/error/error.asp"
|
||||
end if
|
||||
Response.End
|
||||
Exit Function
|
||||
End If
|
||||
End If
|
||||
|
||||
Set rsName = Server.CreateObject("ADODB.RecordSet")
|
||||
|
||||
globalDBCon.CursorLocation = 3
|
||||
RSName.Open sSQL, globalDBCon, Ctype
|
||||
|
||||
If Err.number <> 0 Then
|
||||
err_source = replace(Err.Source,"'","''")
|
||||
err_description = replace(Err.description,"'","''")
|
||||
err_number = replace(Err.Number,"'","''")
|
||||
err_page = replace(fncRequestVariables("URL"),"'","''")
|
||||
|
||||
if fncRequestVariables("LOCAL_ADDR")="10.10.13.82" then
|
||||
sErr = "<TABLE cellSpacing=1 cellPadding=1 width='80%' border=1 align=center>"
|
||||
sErr = sErr & "<TR><TD width='12%' title='"&Err.description&"'><FONT SIZE=2>에러스텝 4B</FONT></TD><TD><FONT SIZE=2>개체명이나 컬럼 혹은 인수값이 잘못되었습니다.</FONT></TD></TR>"
|
||||
sErr = sErr & "<TR><TD ><FONT SIZE=2>오류객체명</FONT></TD><TD><FONT SIZE=2>"&Err.Source&"</FONT></TD></TR>"
|
||||
sErr = sErr & "<TR><TD><FONT SIZE=2>오류설명</FONT></TD><TD><FONT SIZE=2>"&Err.description&"</FONT></TD></TR>"
|
||||
sErr = sErr & "<TR><TD><FONT SIZE=2>오류번호</FONT></TD><TD><FONT SIZE=2>"&Err.Number&"</FONT></TD></TR>"
|
||||
sErr = sErr & "<TR><TD><FONT SIZE=2>QUERY</FONT></TD><TD><FONT SIZE=2>"&sSQL&"</FONT></TD></TR>"
|
||||
sErr = sErr & "<TR><TD><FONT SIZE=2>에러페이지</FONT></TD><TD><FONT SIZE=2>"&err_page&"</FONT></TD></TR>"
|
||||
sErr = sErr & "</TABLE>"
|
||||
Response.Write sErr
|
||||
call RSclose(rsName)
|
||||
else
|
||||
response.Redirect "/etc/error/error.asp"
|
||||
end if
|
||||
|
||||
Response.End
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
End Function
|
||||
|
||||
'===========================================================================
|
||||
'함수명 : RSClose
|
||||
'INPUT : rsName
|
||||
'기능설명 : 레코드셋 객체 소멸
|
||||
'===========================================================================
|
||||
Function RSClose(rsName)
|
||||
Dim globalDBCon
|
||||
|
||||
if IsObject(rsName) = True Then
|
||||
rsName.Close
|
||||
Set rsName = Nothing
|
||||
end if
|
||||
If IsObject(globalDBCon) = True Then
|
||||
globalDBCon.Close
|
||||
Set globalDBCon = Nothing
|
||||
End If
|
||||
End Function
|
||||
|
||||
%>
|
||||
193
Lib/SiteFunc.asp
Normal file
193
Lib/SiteFunc.asp
Normal file
@@ -0,0 +1,193 @@
|
||||
<%
|
||||
|
||||
'###########################################################################################
|
||||
'로그인 여부 체크 함수
|
||||
'return : void
|
||||
'###########################################################################################
|
||||
Function Login()
|
||||
If Session("name")="" Or Session("team")="" Then
|
||||
Response.Redirect "/logout.asp"
|
||||
End If
|
||||
End Function
|
||||
|
||||
Function Login_Ajax()
|
||||
If Session("name")="" Or Session("team")="" Then
|
||||
Login_Ajax = "timeout"
|
||||
End If
|
||||
End Function
|
||||
|
||||
'###########################################################################################
|
||||
'로그아웃
|
||||
'return : void
|
||||
'###########################################################################################
|
||||
Sub Logout()
|
||||
Session("ID")=""
|
||||
Session("userID")=""
|
||||
Session("Grade")=""
|
||||
Session("userName")=""
|
||||
Session.Contents.RemoveAll()
|
||||
Session.Abandon
|
||||
End Sub
|
||||
|
||||
'###########################################################################################
|
||||
'URL Redirect
|
||||
'return : void
|
||||
'###########################################################################################
|
||||
Function call_Url(url,msg)
|
||||
Response.Write "<html xmlns='http://www.w3.org/1999/xhtml'>" & vbCRLF
|
||||
Response.Write "<head>" & vbCrLF
|
||||
Response.Write "<title>" & PROGRAMTITLE & "</title>" & vbCrlf
|
||||
Response.Write "<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />" & vbCrlf
|
||||
Response.Write "</head>" & vbCrLF
|
||||
Response.Write "<body></body>" & vbCrLF
|
||||
Response.Write "<script src='//code.jquery.com/jquery-1.12.0.min.js'></script>" & vbCrLF
|
||||
Response.Write "<script language='javascript'>" & vbCrlf
|
||||
Response.Write "<!--" & vbCrlf
|
||||
Response.Write " $(document).ready(function(){" & vbCrlf
|
||||
if Trim(msg)<>"" Then
|
||||
Response.Write " alert('" & trim(msg) & "');" & vbCrlf
|
||||
end if
|
||||
Response.Write " location.replace('" & trim(url) & "');" & vbCrlf
|
||||
Response.Write " });" & vbCrlf
|
||||
Response.Write "//-->" & vbCrlf
|
||||
Response.Write "</script>" & vbCrlf
|
||||
Response.Write "</html>"
|
||||
End Function
|
||||
|
||||
'###########################################################################################
|
||||
'URL Redirect
|
||||
'return : void
|
||||
'###########################################################################################
|
||||
Function call_msg(msg)
|
||||
Response.Write "<html xmlns='http://www.w3.org/1999/xhtml'>" & vbCRLF
|
||||
Response.Write "<head>" & vbCrLF
|
||||
Response.Write "<title>" & SurveyTitle & "</title>" & vbCrlf
|
||||
Response.Write "<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />" & vbCrlf
|
||||
Response.Write "</head>" & vbCrLF
|
||||
Response.Write "<body></body>" & vbCrLF
|
||||
Response.Write "<script src='//code.jquery.com/jquery-1.12.0.min.js'></script>" & vbCrLF
|
||||
Response.Write "<script language='javascript'>" & vbCrlf
|
||||
Response.Write "<!--" & vbCrlf
|
||||
Response.Write " $(document).ready(function(){" & vbCrlf
|
||||
if Trim(msg)<>"" Then
|
||||
Response.Write " alert('" & trim(msg) & "');" & vbCrlf
|
||||
end if
|
||||
Response.Write " history.back();" & vbCrlf
|
||||
Response.Write " });" & vbCrlf
|
||||
Response.Write "//-->" & vbCrlf
|
||||
Response.Write "</script>" & vbCrlf
|
||||
Response.Write "</html>"
|
||||
End Function
|
||||
|
||||
'TEST ID 생성'
|
||||
Function RNDKEY(types)
|
||||
Dim str, strlen, r, i, ds, serialCode '사용되는 변수를 선언
|
||||
Dim IDKEY
|
||||
|
||||
str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" '랜덤으로 사용될 문자 또는 숫자
|
||||
|
||||
|
||||
strlen = 8 '랜덤으로 출력될 값의 자릿수 ex)해당 구문에서 10자리의 랜덤 값 출력
|
||||
|
||||
|
||||
Randomize '랜덤 초기화
|
||||
For i = 1 To strlen '위에 선언된 strlen만큼 랜덤 코드 생성
|
||||
r = Int((36 - 1 + 1) * Rnd + 1) ' 36은 str의 문자갯수
|
||||
|
||||
serialCode = serialCode + Mid(str,r,1)
|
||||
Next
|
||||
|
||||
IF types = "TEST" Then
|
||||
IDKEY = "TEST"&serialCode
|
||||
ELSE
|
||||
IDKEY = serialCode
|
||||
END IF
|
||||
RNDKEY = IDKEY
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
'###########################################################################################
|
||||
'데이터맵 파일 생성
|
||||
'return : void
|
||||
'###########################################################################################
|
||||
Function createDataMap(code)
|
||||
|
||||
Dim PSQL
|
||||
Dim params(0)
|
||||
Dim dbmapFile,mapStr,sourceStr
|
||||
Dim jCnt,xCnt
|
||||
Dim cVar,jsonObj
|
||||
|
||||
dbmapFile = "/Survey/Map/"&code&".map"
|
||||
mapStr = getVariableQuery(code,"")
|
||||
sourceStr = "[IDX],[IDKey],[Interviewer],[StartDate],[UpdateDate],[EndDate],[Page],[OutPage],[IPName],[ResType],"
|
||||
|
||||
WriteUTF_File dbmapFile,sourceStr & mapStr
|
||||
|
||||
Set jsonOBJ = Nothing
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
'###########################################################################################
|
||||
'" 을 ˝ 로 변경해줌 ASP 파일 아웃풋을 위해 처리
|
||||
'@resText : Text
|
||||
'return : String
|
||||
'###########################################################################################
|
||||
Function ConverTextForASP(resText)
|
||||
ConverTextForASP = Replace(resText,Chr(34),"˝")
|
||||
End Function
|
||||
|
||||
Function ConvertHtmlQuot(resText)
|
||||
resText = Replace(resText,"=" & Chr(34),"='")
|
||||
resText = Replace(resText,Chr(34)&">","'>")
|
||||
resText = Replace(resText,Chr(34)&" ","' ")
|
||||
resText = Replace(resText,Chr(34)&Chr(34),"""")
|
||||
resText = Replace(resText,Chr(34),""")
|
||||
resText = Replace(resText,vbCRLF,"<br>")
|
||||
ConvertHtmlQuot =resText
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
|
||||
Function ReadUTF8File(sFileName)
|
||||
Dim Stream, TextBuffer
|
||||
|
||||
Set Stream = Server.CreateObject("ADODB.Stream")
|
||||
With Stream
|
||||
.Charset = "utf-8"
|
||||
.Type = 2 'adTypeText
|
||||
.Open
|
||||
.LoadFromFile sFileName
|
||||
.Position = 0
|
||||
ReadUTF8File = .ReadText
|
||||
.Close
|
||||
End With
|
||||
|
||||
Set Stream = Nothing
|
||||
End Function
|
||||
|
||||
Function WriteUTF8File(sFileName, sText)
|
||||
Dim Stream
|
||||
|
||||
Set Stream = Server.CreateObject("ADODB.Stream")
|
||||
With Stream
|
||||
.Charset = "utf-8"
|
||||
.Type = 2 'adTypeText
|
||||
.Open
|
||||
.WriteText sText
|
||||
.SaveToFile sFileName, 2 'adSaveCreateOverWrite
|
||||
.Close
|
||||
End With
|
||||
|
||||
Set Stream = Nothing
|
||||
End Function
|
||||
|
||||
|
||||
%>
|
||||
217
Lib/XMLClass.asp
Normal file
217
Lib/XMLClass.asp
Normal file
@@ -0,0 +1,217 @@
|
||||
<%
|
||||
Class XMLClass
|
||||
Private m_DOM,nodeRoot,nodeItem,nodeMessage,nodeError,nodeAct,nodeActRet
|
||||
|
||||
'생성자
|
||||
Private Sub Class_Initialize
|
||||
Set m_DOM = Server.CreateObject("Microsoft.XMLDOM")
|
||||
m_DOM.async=true'"false"
|
||||
End Sub
|
||||
|
||||
'소멸자
|
||||
Private Sub Class_Terminate
|
||||
Set m_DOM = Nothing
|
||||
End Sub
|
||||
|
||||
'노드 갯수 알아내기
|
||||
Public Property Get NodeCount()
|
||||
Dim objRoot
|
||||
If m_DOM.ParseError.ErrorCode=0 Then
|
||||
Set objRoot = m_DOM.documentElement
|
||||
NodeCount = objRoot.childNodes.Length
|
||||
Else
|
||||
NodeCount = -1
|
||||
End IF
|
||||
End Property
|
||||
|
||||
'해당 태그 값 가져오기 중복인 경우 Index 기준으로 가져옴
|
||||
Public Property Get TagText(tagName,index)
|
||||
Dim Nodes
|
||||
|
||||
If m_DOM.ParseError.ErrorCode=0 Then
|
||||
Set Nodes = m_DOM.getElementsByTagName(tagName)
|
||||
If VarType(Nodes)<>0 And VarType(Nodes)<>1 Then
|
||||
If Nodes.Length>0 Then
|
||||
TagText = Nodes(index).Text
|
||||
Else
|
||||
TagText = ""
|
||||
End IF
|
||||
Else
|
||||
TagText = ""
|
||||
End IF
|
||||
Set Nodes = Nothing
|
||||
Else
|
||||
TagText = null
|
||||
End IF
|
||||
End Property
|
||||
|
||||
'해당 태그의 제일 처음 값을 가져옴
|
||||
Public Property Get TagValue(tagName)
|
||||
Dim tv
|
||||
tv = TagText(tagName,0)
|
||||
TagValue = Replace(Replace(tv,"<![CDATA[",""),"]]>","")
|
||||
End Property
|
||||
|
||||
'해당 노드를 가져옴
|
||||
Public Property Get Nodes(tagName)
|
||||
Set Nodes = m_DOM.getElemnetsByTagName(tagName)
|
||||
End Property
|
||||
|
||||
'노드에 값 변경하기
|
||||
'중복된 TAG가 있는 경우 첫번째 값만 변한다
|
||||
Public Sub SetValue(tagName,tagValue)
|
||||
Dim tValue
|
||||
|
||||
If InStr(tagValue,">")>0 Or InStr(tagValue,"<")>0 Then
|
||||
tValue = ConvertHTML(tagValue)
|
||||
Else
|
||||
tValue = tagValue
|
||||
End IF
|
||||
|
||||
With m_DOM
|
||||
Set nodeRoot = .DocumentElement
|
||||
Set nodeItem = .getElementsByTagName(tagName)
|
||||
|
||||
If VarType(nodeItem)<>0 And VarType(nodeItem)<>1 And nodeItem.Length<>0 Then
|
||||
nodeItem(0).Text = tValue
|
||||
Else
|
||||
Set nodeItem = nodeRoot.AppendChild(.CreateElement(tagName))
|
||||
nodeItem.Text = tValue
|
||||
End If
|
||||
End With
|
||||
|
||||
End Sub
|
||||
|
||||
'다른 서버의 XML 파일을 읽어옴
|
||||
Public Function LoadHTTP(url)
|
||||
With m_DOM
|
||||
.async = False
|
||||
.setProperty "ServerHTTPRequest",True
|
||||
LoadHTTP = .Load(url)
|
||||
End With
|
||||
End Function
|
||||
|
||||
'현재 서버의 XML 파일을 읽어옴
|
||||
Public Function Load(file)
|
||||
Load = LoadHDD(Server.MapPath(file))
|
||||
End Function
|
||||
|
||||
'현재 서버의 XML 파일을 읽어옴
|
||||
Public Function LoadHDD(file)
|
||||
With m_DOM
|
||||
.async = False
|
||||
LoadHDD = .Load(file)
|
||||
End With
|
||||
End Function
|
||||
|
||||
'현재 서버에 해당 XML 파일을 저장
|
||||
Public Function Save(file)
|
||||
SaveHDD Server.MapPath(file)
|
||||
End Function
|
||||
|
||||
Public Function SaveHDD(file)
|
||||
With m_DOM
|
||||
.async = False
|
||||
.Save file
|
||||
End With
|
||||
End Function
|
||||
|
||||
'Tag가 들어가는 HTML 내용을 추가하는 경우
|
||||
'변환해서 XML에 오류를 없애주는 경우
|
||||
Private Function ConvertHTML(strTxt)
|
||||
ConvertHTML = "<![CDATA[" & strTxt & "]]>"
|
||||
End Function
|
||||
|
||||
'// 받은 쿼리 데이터를 XML 형식으로 변환
|
||||
Public Function XmlQuery(Ar,Field)
|
||||
Dim nodeTitle,nodeName,nodeValue
|
||||
Dim key,title,value
|
||||
Dim i,x
|
||||
|
||||
With m_DOM
|
||||
|
||||
.async = False
|
||||
.appendChild(.createProcessingInstruction("xml","version=""1.0"" encoding=""utf-8"" "))
|
||||
|
||||
' 루트 생성
|
||||
Set nodeRoot = .CreateElement("ITEMS")
|
||||
.appendChild(nodeRoot)
|
||||
|
||||
If IsArray(Ar) Then
|
||||
For i = 0 To UBound(Ar,2)
|
||||
Set nodeItem = nodeRoot.AppendChild(.CreateElement("ITEM"))
|
||||
|
||||
x = 0
|
||||
For Each key In Split(Field,",")
|
||||
Set nodeName = nodeItem.AppendChild(.CreateElement(key))
|
||||
|
||||
value = Ar(x,i)
|
||||
If Not IsNull(value) Then
|
||||
nodeName.Text = .createCDATASection(value).text
|
||||
End If
|
||||
x = x + 1
|
||||
Next
|
||||
Next
|
||||
End If
|
||||
|
||||
End With
|
||||
|
||||
End Function
|
||||
|
||||
'빈 XML 파일 만들기
|
||||
Public Function CreateXML(Ar)
|
||||
Dim nTitle,nName
|
||||
Dim datas,iCnt,xCnt
|
||||
Dim key
|
||||
|
||||
With m_DOM
|
||||
.async = False
|
||||
.appendChild(.createProcessingInstruction("xml","version=""1.0"" encoding=""utf-8"" "))
|
||||
|
||||
Set nodeRoot = .CreateElement("ITEMS")
|
||||
.appendChild(nodeRoot)
|
||||
|
||||
If IsArray(Ar) Then
|
||||
For iCnt=0 To UBound(Ar)
|
||||
If VarType(Ar(iCnt))<>0 And VarType(Ar(iCnt))<>1 Then
|
||||
Set NodeItem = nodeRoot.AppendChild(.CreateElement(Ar(iCnt)))
|
||||
End IF
|
||||
Next
|
||||
Else
|
||||
For Each key In Split(Ar,",")
|
||||
Set NodeItem = nodeRoot.AppendChild(.CreateElement(key))
|
||||
Next
|
||||
End IF
|
||||
|
||||
End With
|
||||
|
||||
End Function
|
||||
|
||||
'// 모든 에러 메세지 출력
|
||||
Public Function XmlError(ErrStr)
|
||||
Dim textMessage,textError
|
||||
|
||||
textMessage = ""
|
||||
With m_DOM
|
||||
|
||||
.async = False
|
||||
.appendChild(.createProcessingInstruction("xml","version=""1.0"" encoding=""utf-8"" "))
|
||||
|
||||
Set nodeRoot = .AppendChild(objXml.CreateElement("root_data"))
|
||||
Set nodeItem = nodeRoot.AppendChild(objXml.CreateElement("item"))
|
||||
Set nodeMessage = nodeItem.AppendChild(objXml.CreateElement("message"))
|
||||
Set nodeError = nodeItem.AppendChild(objXml.CreateElement("error"))
|
||||
|
||||
textMessage = "에러 발생" & ErrStr
|
||||
textError = 1
|
||||
|
||||
nodeMessage.Text = .createCDATASection(textMessage).text
|
||||
nodeError.Text = textError
|
||||
|
||||
End With
|
||||
End Function
|
||||
|
||||
End Class
|
||||
|
||||
|
||||
%>
|
||||
263
Lib/aspJSON1.17.asp
Normal file
263
Lib/aspJSON1.17.asp
Normal file
@@ -0,0 +1,263 @@
|
||||
<%
|
||||
'Februari 2014 - Version 1.17 by Gerrit van Kuipers
|
||||
Class aspJSON
|
||||
Public data
|
||||
Private p_JSONstring
|
||||
private aj_in_string, aj_in_escape, aj_i_tmp, aj_char_tmp, aj_s_tmp, aj_line_tmp, aj_line, aj_lines, aj_currentlevel, aj_currentkey, aj_currentvalue, aj_newlabel, aj_XmlHttp, aj_RegExp, aj_colonfound
|
||||
|
||||
Private Sub Class_Initialize()
|
||||
Set data = Collection()
|
||||
|
||||
Set aj_RegExp = new regexp
|
||||
aj_RegExp.Pattern = "\s{0,}(\S{1}[\s,\S]*\S{1})\s{0,}"
|
||||
aj_RegExp.Global = False
|
||||
aj_RegExp.IgnoreCase = True
|
||||
aj_RegExp.Multiline = True
|
||||
End Sub
|
||||
|
||||
Private Sub Class_Terminate()
|
||||
Set data = Nothing
|
||||
Set aj_RegExp = Nothing
|
||||
End Sub
|
||||
|
||||
Public Sub loadJSON(inputsource)
|
||||
inputsource = aj_MultilineTrim(inputsource)
|
||||
If Len(inputsource) = 0 Then Err.Raise 1, "loadJSON Error", "No data to load."
|
||||
select case Left(inputsource, 1)
|
||||
case "{", "["
|
||||
case else
|
||||
Set aj_XmlHttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
|
||||
aj_XmlHttp.open "GET", inputsource, False
|
||||
aj_XmlHttp.setRequestHeader "Content-Type", "text/json"
|
||||
aj_XmlHttp.setRequestHeader "CharSet", "UTF-8"
|
||||
aj_XmlHttp.Send
|
||||
|
||||
inputsource = aj_XmlHttp.responseText
|
||||
set aj_XmlHttp = Nothing
|
||||
end select
|
||||
|
||||
p_JSONstring = CleanUpJSONstring(inputsource)
|
||||
aj_lines = Split(p_JSONstring, Chr(13) & Chr(10))
|
||||
|
||||
Dim level(99)
|
||||
aj_currentlevel = 1
|
||||
Set level(aj_currentlevel) = data
|
||||
For Each aj_line In aj_lines
|
||||
aj_currentkey = ""
|
||||
aj_currentvalue = ""
|
||||
If Instr(aj_line, ":") > 0 Then
|
||||
aj_in_string = False
|
||||
aj_in_escape = False
|
||||
aj_colonfound = False
|
||||
For aj_i_tmp = 1 To Len(aj_line)
|
||||
If aj_in_escape Then
|
||||
aj_in_escape = False
|
||||
Else
|
||||
Select Case Mid(aj_line, aj_i_tmp, 1)
|
||||
Case """"
|
||||
aj_in_string = Not aj_in_string
|
||||
Case ":"
|
||||
If Not aj_in_escape And Not aj_in_string Then
|
||||
aj_currentkey = Left(aj_line, aj_i_tmp - 1)
|
||||
aj_currentvalue = Mid(aj_line, aj_i_tmp + 1)
|
||||
aj_colonfound = True
|
||||
Exit For
|
||||
End If
|
||||
Case "\"
|
||||
aj_in_escape = True
|
||||
End Select
|
||||
End If
|
||||
Next
|
||||
if aj_colonfound then
|
||||
aj_currentkey = aj_Strip(aj_JSONDecode(aj_currentkey), """")
|
||||
If Not level(aj_currentlevel).exists(aj_currentkey) Then level(aj_currentlevel).Add aj_currentkey, ""
|
||||
end if
|
||||
End If
|
||||
If right(aj_line,1) = "{" Or right(aj_line,1) = "[" Then
|
||||
If Len(aj_currentkey) = 0 Then aj_currentkey = level(aj_currentlevel).Count
|
||||
Set level(aj_currentlevel).Item(aj_currentkey) = Collection()
|
||||
Set level(aj_currentlevel + 1) = level(aj_currentlevel).Item(aj_currentkey)
|
||||
aj_currentlevel = aj_currentlevel + 1
|
||||
aj_currentkey = ""
|
||||
ElseIf right(aj_line,1) = "}" Or right(aj_line,1) = "]" or right(aj_line,2) = "}," Or right(aj_line,2) = "]," Then
|
||||
aj_currentlevel = aj_currentlevel - 1
|
||||
ElseIf Len(Trim(aj_line)) > 0 Then
|
||||
if Len(aj_currentvalue) = 0 Then aj_currentvalue = aj_line
|
||||
aj_currentvalue = getJSONValue(aj_currentvalue)
|
||||
|
||||
If Len(aj_currentkey) = 0 Then aj_currentkey = level(aj_currentlevel).Count
|
||||
level(aj_currentlevel).Item(aj_currentkey) = aj_currentvalue
|
||||
End If
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Public Function Collection()
|
||||
set Collection = Server.CreateObject("Scripting.Dictionary")
|
||||
End Function
|
||||
|
||||
Public Function AddToCollection(dictobj)
|
||||
if TypeName(dictobj) <> "Dictionary" then Err.Raise 1, "AddToCollection Error", "Not a collection."
|
||||
aj_newlabel = dictobj.Count
|
||||
dictobj.Add aj_newlabel, Collection()
|
||||
set AddToCollection = dictobj.item(aj_newlabel)
|
||||
end function
|
||||
|
||||
Private Function CleanUpJSONstring(aj_originalstring)
|
||||
aj_originalstring = Replace(aj_originalstring, Chr(13) & Chr(10), "")
|
||||
aj_originalstring = Mid(aj_originalstring, 2, Len(aj_originalstring) - 2)
|
||||
aj_in_string = False : aj_in_escape = False : aj_s_tmp = ""
|
||||
For aj_i_tmp = 1 To Len(aj_originalstring)
|
||||
aj_char_tmp = Mid(aj_originalstring, aj_i_tmp, 1)
|
||||
If aj_in_escape Then
|
||||
aj_in_escape = False
|
||||
aj_s_tmp = aj_s_tmp & aj_char_tmp
|
||||
Else
|
||||
Select Case aj_char_tmp
|
||||
Case "\" : aj_s_tmp = aj_s_tmp & aj_char_tmp : aj_in_escape = True
|
||||
Case """" : aj_s_tmp = aj_s_tmp & aj_char_tmp : aj_in_string = Not aj_in_string
|
||||
Case "{", "["
|
||||
aj_s_tmp = aj_s_tmp & aj_char_tmp & aj_InlineIf(aj_in_string, "", Chr(13) & Chr(10))
|
||||
Case "}", "]"
|
||||
aj_s_tmp = aj_s_tmp & aj_InlineIf(aj_in_string, "", Chr(13) & Chr(10)) & aj_char_tmp
|
||||
Case "," : aj_s_tmp = aj_s_tmp & aj_char_tmp & aj_InlineIf(aj_in_string, "", Chr(13) & Chr(10))
|
||||
Case Else : aj_s_tmp = aj_s_tmp & aj_char_tmp
|
||||
End Select
|
||||
End If
|
||||
'Response.Write aj_s_tmp & "<BR>"
|
||||
Next
|
||||
|
||||
CleanUpJSONstring = ""
|
||||
aj_s_tmp = split(aj_s_tmp, Chr(13) & Chr(10))
|
||||
For Each aj_line_tmp In aj_s_tmp
|
||||
aj_line_tmp = replace(replace(aj_line_tmp, chr(10), ""), chr(13), "")
|
||||
CleanUpJSONstring = CleanUpJSONstring & aj_Trim(aj_line_tmp) & Chr(13) & Chr(10)
|
||||
Next
|
||||
End Function
|
||||
|
||||
Private Function getJSONValue(ByVal val)
|
||||
val = Trim(val)
|
||||
If Left(val,1) = ":" Then val = Mid(val, 2)
|
||||
If Right(val,1) = "," Then val = Left(val, Len(val) - 1)
|
||||
val = Trim(val)
|
||||
|
||||
Select Case val
|
||||
Case "true" : getJSONValue = True
|
||||
Case "false" : getJSONValue = False
|
||||
Case "null" : getJSONValue = Null
|
||||
Case Else
|
||||
If (Instr(val, """") = 0) Then
|
||||
If IsNumeric(val) Then
|
||||
getJSONValue = CDbl(val)
|
||||
Else
|
||||
getJSONValue = val
|
||||
End If
|
||||
Else
|
||||
If Left(val,1) = """" Then val = Mid(val, 2)
|
||||
If Right(val,1) = """" Then val = Left(val, Len(val) - 1)
|
||||
getJSONValue = aj_JSONDecode(Trim(val))
|
||||
End If
|
||||
End Select
|
||||
End Function
|
||||
|
||||
Private JSONoutput_level
|
||||
Public Function JSONoutput()
|
||||
dim wrap_dicttype, aj_label
|
||||
JSONoutput_level = 1
|
||||
wrap_dicttype = "[]"
|
||||
For Each aj_label In data
|
||||
If Not aj_IsInt(aj_label) Then wrap_dicttype = "{}"
|
||||
Next
|
||||
JSONoutput = Left(wrap_dicttype, 1) & Chr(13) & Chr(10) & GetDict(data) & Right(wrap_dicttype, 1)
|
||||
End Function
|
||||
|
||||
Private Function GetDict(objDict)
|
||||
dim aj_item, aj_keyvals, aj_label, aj_dicttype
|
||||
For Each aj_item In objDict
|
||||
Select Case TypeName(objDict.Item(aj_item))
|
||||
Case "Dictionary"
|
||||
GetDict = GetDict & Space(JSONoutput_level * 4)
|
||||
|
||||
aj_dicttype = "[]"
|
||||
For Each aj_label In objDict.Item(aj_item).Keys
|
||||
If Not aj_IsInt(aj_label) Then aj_dicttype = "{}"
|
||||
Next
|
||||
If aj_IsInt(aj_item) Then
|
||||
GetDict = GetDict & (Left(aj_dicttype,1) & Chr(13) & Chr(10))
|
||||
Else
|
||||
GetDict = GetDict & ("""" & aj_JSONEncode(aj_item) & """" & ": " & Left(aj_dicttype,1) & Chr(13) & Chr(10))
|
||||
End If
|
||||
JSONoutput_level = JSONoutput_level + 1
|
||||
|
||||
aj_keyvals = objDict.Keys
|
||||
GetDict = GetDict & (GetSubDict(objDict.Item(aj_item)) & Space(JSONoutput_level * 4) & Right(aj_dicttype,1) & aj_InlineIf(aj_item = aj_keyvals(objDict.Count - 1),"" , ",") & Chr(13) & Chr(10))
|
||||
Case Else
|
||||
aj_keyvals = objDict.Keys
|
||||
GetDict = GetDict & (Space(JSONoutput_level * 4) & aj_InlineIf(aj_IsInt(aj_item), "", """" & aj_JSONEncode(aj_item) & """: ") & WriteValue(objDict.Item(aj_item)) & aj_InlineIf(aj_item = aj_keyvals(objDict.Count - 1),"" , ",") & Chr(13) & Chr(10))
|
||||
End Select
|
||||
Next
|
||||
End Function
|
||||
|
||||
Private Function aj_IsInt(val)
|
||||
aj_IsInt = (TypeName(val) = "Integer" Or TypeName(val) = "Long")
|
||||
End Function
|
||||
|
||||
Private Function GetSubDict(objSubDict)
|
||||
GetSubDict = GetDict(objSubDict)
|
||||
JSONoutput_level= JSONoutput_level -1
|
||||
End Function
|
||||
|
||||
Private Function WriteValue(ByVal val)
|
||||
Select Case TypeName(val)
|
||||
Case "Double", "Integer", "Long": WriteValue = val
|
||||
Case "Null" : WriteValue = "null"
|
||||
Case "Boolean" : WriteValue = aj_InlineIf(val, "true", "false")
|
||||
Case Else : WriteValue = """" & aj_JSONEncode(val) & """"
|
||||
End Select
|
||||
End Function
|
||||
|
||||
Private Function aj_JSONEncode(ByVal val)
|
||||
val = Replace(val, "\", "\\")
|
||||
val = Replace(val, """", "\""")
|
||||
'val = Replace(val, "/", "\/")
|
||||
val = Replace(val, Chr(8), "\b")
|
||||
val = Replace(val, Chr(12), "\f")
|
||||
val = Replace(val, Chr(10), "\n")
|
||||
val = Replace(val, Chr(13), "\r")
|
||||
val = Replace(val, Chr(9), "\t")
|
||||
aj_JSONEncode = Trim(val)
|
||||
End Function
|
||||
|
||||
Private Function aj_JSONDecode(ByVal val)
|
||||
val = Replace(val, "\""", """")
|
||||
val = Replace(val, "\\", "\")
|
||||
val = Replace(val, "\/", "/")
|
||||
val = Replace(val, "\b", Chr(8))
|
||||
val = Replace(val, "\f", Chr(12))
|
||||
val = Replace(val, "\n", Chr(10))
|
||||
val = Replace(val, "\r", Chr(13))
|
||||
val = Replace(val, "\t", Chr(9))
|
||||
aj_JSONDecode = Trim(val)
|
||||
End Function
|
||||
|
||||
Private Function aj_InlineIf(condition, returntrue, returnfalse)
|
||||
If condition Then aj_InlineIf = returntrue Else aj_InlineIf = returnfalse
|
||||
End Function
|
||||
|
||||
Private Function aj_Strip(ByVal val, stripper)
|
||||
If Left(val, 1) = stripper Then val = Mid(val, 2)
|
||||
If Right(val, 1) = stripper Then val = Left(val, Len(val) - 1)
|
||||
aj_Strip = val
|
||||
End Function
|
||||
|
||||
Private Function aj_MultilineTrim(TextData)
|
||||
aj_MultilineTrim = aj_RegExp.Replace(TextData, "$1")
|
||||
End Function
|
||||
|
||||
private function aj_Trim(val)
|
||||
aj_Trim = Trim(val)
|
||||
Do While Left(aj_Trim, 1) = Chr(9) : aj_Trim = Mid(aj_Trim, 2) : Loop
|
||||
Do While Right(aj_Trim, 1) = Chr(9) : aj_Trim = Left(aj_Trim, Len(aj_Trim) - 1) : Loop
|
||||
aj_Trim = Trim(aj_Trim)
|
||||
end function
|
||||
End Class
|
||||
%>
|
||||
412
Lib/freeASPUpload.asp
Normal file
412
Lib/freeASPUpload.asp
Normal file
@@ -0,0 +1,412 @@
|
||||
<%
|
||||
' For examples, documentation, and your own free copy, go to:
|
||||
' http://www.freeaspupload.net
|
||||
' Note: You can copy and use this script for free and you can make changes
|
||||
' to the code, but you cannot remove the above comment.
|
||||
|
||||
'Changes:
|
||||
'Aug 2, 2005: Add support for checkboxes and other input elements with multiple values
|
||||
'Jan 6, 2009: Lars added ASP_CHUNK_SIZE
|
||||
'Sep 3, 2010: Enforce UTF-8 everywhere; new function to convert byte array to unicode string
|
||||
|
||||
'const DEFAULT_ASP_CHUNK_SIZE = 200000
|
||||
|
||||
'const adModeReadWrite = 3
|
||||
'const adTypeBinary = 1
|
||||
'const adTypeText = 2
|
||||
'const adSaveCreateOverWrite = 2
|
||||
|
||||
Class FreeASPUpload
|
||||
Public UploadedFiles
|
||||
Public FormElements
|
||||
|
||||
Private VarArrayBinRequest
|
||||
Private StreamRequest
|
||||
Private uploadedYet
|
||||
Private internalChunkSize
|
||||
|
||||
Private adModeReadWrite
|
||||
Private adTypeBinary
|
||||
Private adTypeText
|
||||
Private adSaveCreateOverWrite
|
||||
|
||||
Private Sub Class_Initialize()
|
||||
Set UploadedFiles = Server.CreateObject("Scripting.Dictionary")
|
||||
Set FormElements = Server.CreateObject("Scripting.Dictionary")
|
||||
Set StreamRequest = Server.CreateObject("ADODB.Stream")
|
||||
StreamRequest.Type = 2'adTypeText
|
||||
StreamRequest.Open
|
||||
uploadedYet = false
|
||||
internalChunkSize = 304857600
|
||||
|
||||
adModeReadWrite = 3
|
||||
adTypeBinary = 1
|
||||
adTypeText = 2
|
||||
adSaveCreateOverWrite = 2
|
||||
End Sub
|
||||
|
||||
Private Sub Class_Terminate()
|
||||
If IsObject(UploadedFiles) Then
|
||||
UploadedFiles.RemoveAll()
|
||||
Set UploadedFiles = Nothing
|
||||
End If
|
||||
If IsObject(FormElements) Then
|
||||
FormElements.RemoveAll()
|
||||
Set FormElements = Nothing
|
||||
End If
|
||||
StreamRequest.Close
|
||||
Set StreamRequest = Nothing
|
||||
End Sub
|
||||
|
||||
Public Property Get Form(sIndex)
|
||||
Form = ""
|
||||
If FormElements.Exists(LCase(sIndex)) Then Form = FormElements.Item(LCase(sIndex))
|
||||
End Property
|
||||
|
||||
Public Property Get Files()
|
||||
Files = UploadedFiles.Items
|
||||
End Property
|
||||
|
||||
Public Property Get Exists(sIndex)
|
||||
Exists = false
|
||||
If FormElements.Exists(LCase(sIndex)) Then Exists = true
|
||||
End Property
|
||||
|
||||
Public Property Get FileExists(sIndex)
|
||||
FileExists = false
|
||||
if UploadedFiles.Exists(LCase(sIndex)) then FileExists = true
|
||||
End Property
|
||||
|
||||
Public Property Get chunkSize()
|
||||
chunkSize = internalChunkSize
|
||||
End Property
|
||||
|
||||
Public Property Let chunkSize(sz)
|
||||
internalChunkSize = sz
|
||||
End Property
|
||||
|
||||
'Calls Upload to extract the data from the binary request and then saves the uploaded files
|
||||
Public Sub Save(path)
|
||||
Dim streamFile, fileItem, filePath
|
||||
|
||||
if Right(path, 1) <> "\" then path = path & "\"
|
||||
|
||||
if not uploadedYet then Upload
|
||||
|
||||
For Each fileItem In UploadedFiles.Items
|
||||
filePath = path & fileItem.FileName
|
||||
Set streamFile = Server.CreateObject("ADODB.Stream")
|
||||
streamFile.Type = adTypeBinary
|
||||
streamFile.Open
|
||||
StreamRequest.Position=fileItem.Start
|
||||
StreamRequest.CopyTo streamFile, fileItem.Length
|
||||
streamFile.SaveToFile filePath, adSaveCreateOverWrite
|
||||
streamFile.close
|
||||
Set streamFile = Nothing
|
||||
fileItem.Path = filePath
|
||||
Next
|
||||
End Sub
|
||||
|
||||
public sub SaveOne(path, num, byref outFileName, byref outLocalFileName)
|
||||
Dim streamFile, fileItems, fileItem, fs
|
||||
|
||||
set fs = Server.CreateObject("Scripting.FileSystemObject")
|
||||
if Right(path, 1) <> "\" then path = path & "\"
|
||||
|
||||
if not uploadedYet then Upload
|
||||
if UploadedFiles.Count > 0 then
|
||||
fileItems = UploadedFiles.Items
|
||||
set fileItem = fileItems(num)
|
||||
|
||||
outFileName = fileItem.FileName
|
||||
outLocalFileName = GetFileName(path, outFileName)
|
||||
|
||||
Set streamFile = Server.CreateObject("ADODB.Stream")
|
||||
streamFile.Type = adTypeBinary
|
||||
streamFile.Open
|
||||
StreamRequest.Position = fileItem.Start
|
||||
StreamRequest.CopyTo streamFile, fileItem.Length
|
||||
streamFile.SaveToFile path & outLocalFileName, adSaveCreateOverWrite
|
||||
streamFile.close
|
||||
Set streamFile = Nothing
|
||||
fileItem.Path = path & filename
|
||||
end if
|
||||
end sub
|
||||
|
||||
Public Function SaveBinRequest(path) ' For debugging purposes
|
||||
StreamRequest.SaveToFile path & "\debugStream.bin", 2
|
||||
End Function
|
||||
|
||||
Public Sub DumpData() 'only works if files are plain text
|
||||
Dim i, aKeys, f
|
||||
response.write "Form Items:<br>"
|
||||
aKeys = FormElements.Keys
|
||||
For i = 0 To FormElements.Count -1 ' Iterate the array
|
||||
response.write aKeys(i) & " = " & FormElements.Item(aKeys(i)) & "<BR>"
|
||||
Next
|
||||
response.write "Uploaded Files:<br>"
|
||||
For Each f In UploadedFiles.Items
|
||||
response.write "Name: " & f.FileName & "<br>"
|
||||
response.write "Type: " & f.ContentType & "<br>"
|
||||
response.write "Start: " & f.Start & "<br>"
|
||||
response.write "Size: " & f.Length & "<br>"
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Public Sub Upload()
|
||||
Dim nCurPos, nDataBoundPos, nLastSepPos
|
||||
Dim nPosFile, nPosBound
|
||||
Dim sFieldName, osPathSep, auxStr
|
||||
Dim readBytes, readLoop, tmpBinRequest
|
||||
|
||||
'RFC1867 Tokens
|
||||
Dim vDataSep
|
||||
Dim tNewLine, tDoubleQuotes, tTerm, tFilename, tName, tContentDisp, tContentType
|
||||
tNewLine = String2Byte(Chr(13))
|
||||
tDoubleQuotes = String2Byte(Chr(34))
|
||||
tTerm = String2Byte("--")
|
||||
tFilename = String2Byte("filename=""")
|
||||
tName = String2Byte("name=""")
|
||||
tContentDisp = String2Byte("Content-Disposition")
|
||||
tContentType = String2Byte("Content-Type:")
|
||||
|
||||
uploadedYet = true
|
||||
|
||||
on error resume next
|
||||
' Copy binary request to a byte array, on which functions like InstrB and others can be used to search for separation tokens
|
||||
readBytes = internalChunkSize
|
||||
VarArrayBinRequest = Request.BinaryRead(readBytes)
|
||||
VarArrayBinRequest = midb(VarArrayBinRequest, 1, lenb(VarArrayBinRequest))
|
||||
Do Until readBytes < 1
|
||||
tmpBinRequest = Request.BinaryRead(readBytes)
|
||||
if readBytes > 0 then
|
||||
VarArrayBinRequest = VarArrayBinRequest & midb(tmpBinRequest, 1, lenb(tmpBinRequest))
|
||||
end if
|
||||
Loop
|
||||
StreamRequest.WriteText(VarArrayBinRequest)
|
||||
StreamRequest.Flush()
|
||||
if Err.Number <> 0 then
|
||||
response.write "<br><br><B>System reported this error:</B><p>"
|
||||
response.write Err.Description & "<p>"
|
||||
response.write "The most likely cause for this error is the incorrect setup of AspMaxRequestEntityAllowed in IIS MetaBase. Please see instructions in the <A HREF='http://www.freeaspupload.net/freeaspupload/requirements.asp'>requirements page of freeaspupload.net</A>.<p>"
|
||||
Exit Sub
|
||||
end if
|
||||
on error goto 0 'reset error handling
|
||||
|
||||
nCurPos = FindToken(tNewLine,1) 'Note: nCurPos is 1-based (and so is InstrB, MidB, etc)
|
||||
|
||||
If nCurPos <= 1 Then Exit Sub
|
||||
|
||||
'vDataSep is a separator like -----------------------------21763138716045
|
||||
vDataSep = MidB(VarArrayBinRequest, 1, nCurPos-1)
|
||||
|
||||
'Start of current separator
|
||||
nDataBoundPos = 1
|
||||
|
||||
'Beginning of last line
|
||||
nLastSepPos = FindToken(vDataSep & tTerm, 1)
|
||||
|
||||
Do Until nDataBoundPos = nLastSepPos
|
||||
|
||||
nCurPos = SkipToken(tContentDisp, nDataBoundPos)
|
||||
nCurPos = SkipToken(tName, nCurPos)
|
||||
sFieldName = ExtractField(tDoubleQuotes, nCurPos)
|
||||
|
||||
nPosFile = FindToken(tFilename, nCurPos)
|
||||
nPosBound = FindToken(vDataSep, nCurPos)
|
||||
|
||||
If nPosFile <> 0 And nPosFile < nPosBound Then
|
||||
Dim oUploadFile
|
||||
Set oUploadFile = New UploadedFile
|
||||
|
||||
nCurPos = SkipToken(tFilename, nCurPos)
|
||||
auxStr = ExtractField(tDoubleQuotes, nCurPos)
|
||||
' We are interested only in the name of the file, not the whole path
|
||||
' Path separator is \ in windows, / in UNIX
|
||||
' While IE seems to put the whole pathname in the stream, Mozilla seem to
|
||||
' only put the actual file name, so UNIX paths may be rare. But not impossible.
|
||||
osPathSep = "\"
|
||||
if InStr(auxStr, osPathSep) = 0 then osPathSep = "/"
|
||||
oUploadFile.FileName = Right(auxStr, Len(auxStr)-InStrRev(auxStr, osPathSep))
|
||||
|
||||
if (Len(oUploadFile.FileName) > 0) then 'File field not left empty
|
||||
nCurPos = SkipToken(tContentType, nCurPos)
|
||||
|
||||
auxStr = ExtractField(tNewLine, nCurPos)
|
||||
' NN on UNIX puts things like this in the stream:
|
||||
' ?? python py type=?? python application/x-python
|
||||
oUploadFile.ContentType = Right(auxStr, Len(auxStr)-InStrRev(auxStr, " "))
|
||||
nCurPos = FindToken(tNewLine, nCurPos) + 4 'skip empty line
|
||||
|
||||
oUploadFile.Start = nCurPos+1
|
||||
oUploadFile.Length = FindToken(vDataSep, nCurPos) - 2 - nCurPos
|
||||
|
||||
If oUploadFile.Length > 0 Then UploadedFiles.Add LCase(sFieldName), oUploadFile
|
||||
End If
|
||||
Else
|
||||
Dim nEndOfData, fieldValueUniStr
|
||||
nCurPos = FindToken(tNewLine, nCurPos) + 4 'skip empty line
|
||||
nEndOfData = FindToken(vDataSep, nCurPos) - 2
|
||||
fieldValueuniStr = ConvertUtf8BytesToString(nCurPos, nEndOfData-nCurPos)
|
||||
If Not FormElements.Exists(LCase(sFieldName)) Then
|
||||
FormElements.Add LCase(sFieldName), fieldValueuniStr
|
||||
else
|
||||
FormElements.Item(LCase(sFieldName))= FormElements.Item(LCase(sFieldName)) & ", " & fieldValueuniStr
|
||||
end if
|
||||
|
||||
End If
|
||||
|
||||
'Advance to next separator
|
||||
nDataBoundPos = FindToken(vDataSep, nCurPos)
|
||||
Loop
|
||||
End Sub
|
||||
|
||||
Private Function SkipToken(sToken, nStart)
|
||||
SkipToken = InstrB(nStart, VarArrayBinRequest, sToken)
|
||||
If SkipToken = 0 then
|
||||
Response.write "Error in parsing uploaded binary request. The most likely cause for this error is the incorrect setup of AspMaxRequestEntityAllowed in IIS MetaBase. Please see instructions in the <A HREF='http://www.freeaspupload.net/freeaspupload/requirements.asp'>requirements page of freeaspupload.net</A>.<p>"
|
||||
Response.End
|
||||
end if
|
||||
SkipToken = SkipToken + LenB(sToken)
|
||||
End Function
|
||||
|
||||
Private Function FindToken(sToken, nStart)
|
||||
FindToken = InstrB(nStart, VarArrayBinRequest, sToken)
|
||||
End Function
|
||||
|
||||
Private Function ExtractField(sToken, nStart)
|
||||
Dim nEnd
|
||||
nEnd = InstrB(nStart, VarArrayBinRequest, sToken)
|
||||
If nEnd = 0 then
|
||||
Response.write "Error in parsing uploaded binary request."
|
||||
Response.End
|
||||
end if
|
||||
ExtractField = ConvertUtf8BytesToString(nStart, nEnd-nStart)
|
||||
End Function
|
||||
|
||||
'String to byte string conversion
|
||||
Private Function String2Byte(sString)
|
||||
Dim i
|
||||
For i = 1 to Len(sString)
|
||||
String2Byte = String2Byte & ChrB(AscB(Mid(sString,i,1)))
|
||||
Next
|
||||
End Function
|
||||
|
||||
Private Function ConvertUtf8BytesToString(start, length)
|
||||
StreamRequest.Position = 0
|
||||
|
||||
Dim objStream
|
||||
Dim strTmp
|
||||
|
||||
' init stream
|
||||
Set objStream = Server.CreateObject("ADODB.Stream")
|
||||
objStream.Charset = "utf-8"
|
||||
objStream.Mode = adModeReadWrite
|
||||
objStream.Type = adTypeBinary
|
||||
objStream.Open
|
||||
|
||||
' write bytes into stream
|
||||
StreamRequest.Position = start+1
|
||||
StreamRequest.CopyTo objStream, length
|
||||
objStream.Flush
|
||||
|
||||
' rewind stream and read text
|
||||
objStream.Position = 0
|
||||
objStream.Type = adTypeText
|
||||
strTmp = objStream.ReadText
|
||||
|
||||
' close up and return
|
||||
objStream.Close
|
||||
Set objStream = Nothing
|
||||
ConvertUtf8BytesToString = strTmp
|
||||
End Function
|
||||
End Class
|
||||
|
||||
Class UploadedFile
|
||||
Public ContentType
|
||||
Public Start
|
||||
Public Length
|
||||
Public Path
|
||||
Private nameOfFile
|
||||
|
||||
' Need to remove characters that are valid in UNIX, but not in Windows
|
||||
Public Property Let FileName(fN)
|
||||
nameOfFile = fN
|
||||
nameOfFile = SubstNoReg(nameOfFile, "\", "_")
|
||||
nameOfFile = SubstNoReg(nameOfFile, "/", "_")
|
||||
nameOfFile = SubstNoReg(nameOfFile, ":", "_")
|
||||
nameOfFile = SubstNoReg(nameOfFile, "*", "_")
|
||||
nameOfFile = SubstNoReg(nameOfFile, "?", "_")
|
||||
nameOfFile = SubstNoReg(nameOfFile, """", "_")
|
||||
nameOfFile = SubstNoReg(nameOfFile, "<", "_")
|
||||
nameOfFile = SubstNoReg(nameOfFile, ">", "_")
|
||||
nameOfFile = SubstNoReg(nameOfFile, "|", "_")
|
||||
End Property
|
||||
|
||||
Public Property Get FileName()
|
||||
FileName = nameOfFile
|
||||
End Property
|
||||
|
||||
'Public Property Get FileN()ame
|
||||
End Class
|
||||
|
||||
|
||||
' Does not depend on RegEx, which is not available on older VBScript
|
||||
' Is not recursive, which means it will not run out of stack space
|
||||
Function SubstNoReg(initialStr, oldStr, newStr)
|
||||
Dim currentPos, oldStrPos, skip
|
||||
If IsNull(initialStr) Or Len(initialStr) = 0 Then
|
||||
SubstNoReg = ""
|
||||
ElseIf IsNull(oldStr) Or Len(oldStr) = 0 Then
|
||||
SubstNoReg = initialStr
|
||||
Else
|
||||
If IsNull(newStr) Then newStr = ""
|
||||
currentPos = 1
|
||||
oldStrPos = 0
|
||||
SubstNoReg = ""
|
||||
skip = Len(oldStr)
|
||||
Do While currentPos <= Len(initialStr)
|
||||
oldStrPos = InStr(currentPos, initialStr, oldStr)
|
||||
If oldStrPos = 0 Then
|
||||
SubstNoReg = SubstNoReg & Mid(initialStr, currentPos, Len(initialStr) - currentPos + 1)
|
||||
currentPos = Len(initialStr) + 1
|
||||
Else
|
||||
SubstNoReg = SubstNoReg & Mid(initialStr, currentPos, oldStrPos - currentPos) & newStr
|
||||
currentPos = oldStrPos + skip
|
||||
End If
|
||||
Loop
|
||||
End If
|
||||
End Function
|
||||
|
||||
Function GetFileName(strSaveToPath, FileName)
|
||||
'This function is used when saving a file to check there is not already a file with the same name so that you don't overwrite it.
|
||||
'It adds numbers to the filename e.g. file.gif becomes file1.gif becomes file2.gif and so on.
|
||||
'It keeps going until it returns a filename that does not exist.
|
||||
'You could just create a filename from the ID field but that means writing the record - and it still might exist!
|
||||
'N.B. Requires strSaveToPath variable to be available - and containing the path to save to
|
||||
Dim Counter
|
||||
Dim Flag
|
||||
Dim strTempFileName
|
||||
Dim FileExt
|
||||
Dim NewFullPath
|
||||
dim objFSO, p
|
||||
Set objFSO = CreateObject("Scripting.FileSystemObject")
|
||||
Counter = 0
|
||||
p = instrrev(FileName, ".")
|
||||
FileExt = mid(FileName, p+1)
|
||||
strTempFileName = left(FileName, p-1)
|
||||
NewFullPath = strSaveToPath & "\" & FileName
|
||||
Flag = False
|
||||
|
||||
Do Until Flag = True
|
||||
If objFSO.FileExists(NewFullPath) = False Then
|
||||
Flag = True
|
||||
GetFileName = Mid(NewFullPath, InstrRev(NewFullPath, "\") + 1)
|
||||
Else
|
||||
Counter = Counter + 1
|
||||
NewFullPath = strSaveToPath & "\" & strTempFileName & Counter & "." & FileExt
|
||||
End If
|
||||
Loop
|
||||
End Function
|
||||
|
||||
%>
|
||||
509
Lib/func.asp
Normal file
509
Lib/func.asp
Normal file
@@ -0,0 +1,509 @@
|
||||
<%
|
||||
'=======================================================================
|
||||
'업 무 명 : K-ON common
|
||||
'모듈기능 : 공통 함수 정의
|
||||
'파 일 명 : Func.asp
|
||||
'작성일자 : 2020-08-24
|
||||
'작 성 자 : 김홍완
|
||||
'-----------------------------------------------------------------------
|
||||
'변경일자 변경자 변동내역
|
||||
'=======================================================================
|
||||
'2020-08-24 김홍완 date_db(), date_time() 추가
|
||||
'=======================================================================
|
||||
'Response.Expires = -1
|
||||
%>
|
||||
<%
|
||||
'//-- date_db(), date_time()
|
||||
dim v_datetime, v_day, v_hour, v_minute, v_month, v_second, v_year, mLen, dLen
|
||||
|
||||
|
||||
'###########################################################################################
|
||||
'URL Redirect
|
||||
'###########################################################################################
|
||||
Function call_Url(url,msg)
|
||||
Response.Write "<html xmlns='http://www.w3.org/1999/xhtml'>" & vbCRLF
|
||||
Response.Write "<head>" & vbCrLF
|
||||
Response.Write "<title>" & SurveyTitle & "</title>" & vbCrlf
|
||||
Response.Write "<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />" & vbCrlf
|
||||
Response.Write "</head>" & vbCrLF
|
||||
Response.Write "<script language='javascript'>" & vbCrlf
|
||||
Response.Write "<!--" & vbCrlf
|
||||
|
||||
if Trim(msg)<>"" Then
|
||||
Response.Write " alert('" & trim(msg) & "');" & vbCrlf
|
||||
end if
|
||||
|
||||
Response.Write " location.replace('" & trim(url) & "');" & vbCrlf
|
||||
|
||||
Response.Write "//-->" & vbCrlf
|
||||
Response.Write "</script>" & vbCrlf
|
||||
Response.Write "</html>"
|
||||
End Function
|
||||
|
||||
|
||||
Function LoadSkin(fnName)
|
||||
|
||||
Dim objStream
|
||||
Set objStream = CreateObject("ADODB.Stream")
|
||||
With objStream
|
||||
.Charset = "utf-8"
|
||||
.Type=2
|
||||
.mode=3
|
||||
.Open
|
||||
.loadfromfile Server.Mappath(fnName)
|
||||
LoadSkin=.readtext
|
||||
.Close
|
||||
End With
|
||||
|
||||
Set objStream = Nothing
|
||||
|
||||
End Function
|
||||
|
||||
'###########################################################################################
|
||||
'메일 발송
|
||||
'###########################################################################################
|
||||
Function MailSend(FromStr,ToStr,Subject,BodyStr)
|
||||
Dim objMail,iConf
|
||||
|
||||
Set objMail=server.CreateObject("CDO.Message")
|
||||
Set iConf = objMail.Configuration
|
||||
With iConf.Fields
|
||||
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") =2
|
||||
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") =MAIL_SV
|
||||
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") =25
|
||||
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") =1
|
||||
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") =MAIL_ID
|
||||
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") =MAIL_PW
|
||||
.Update
|
||||
End with
|
||||
|
||||
objMail.To = ToStr
|
||||
objMail.From = FromStr
|
||||
objmail.Subject = Subject
|
||||
|
||||
objmail.htmlBody = BodyStr
|
||||
objMail.BodyPart.Charset="utf-8"
|
||||
objMail.Send
|
||||
|
||||
Set objMail = Nothing
|
||||
End Function
|
||||
|
||||
'###########################################################################################
|
||||
'CDO 메일 발송
|
||||
'###########################################################################################
|
||||
Function CMailSend(FromStr,ToStr,Subject,BodyStr)
|
||||
Dim objMail,iConf
|
||||
|
||||
Set objMail=server.CreateObject("CDO.Message")
|
||||
Set iConf = objMail.Configuration
|
||||
With iConf.Fields
|
||||
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1
|
||||
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="localhost"
|
||||
.item("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory") = "C:\inetpub\mailroot\pickup"
|
||||
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") =25
|
||||
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 30
|
||||
.Update
|
||||
End with
|
||||
|
||||
objMail.To = ToStr
|
||||
objMail.From = FromStr
|
||||
objmail.Subject = Subject
|
||||
|
||||
objmail.htmlBody = BodyStr
|
||||
objMail.BodyPart.Charset="utf-8"
|
||||
objMail.Send
|
||||
|
||||
Set objMail = Nothing
|
||||
End Function
|
||||
|
||||
'###########################################################################################
|
||||
'랜덤 난수 발생
|
||||
'###########################################################################################
|
||||
Function RandomNum(start,limit)
|
||||
Dim Val,MyValue
|
||||
|
||||
if Not IsNumeric(start) Or Not IsNumeric(limit) then
|
||||
RandomNum = 0
|
||||
Exit Function
|
||||
end if
|
||||
|
||||
Randomize
|
||||
MyValue = Int(limit * Rnd) + start
|
||||
|
||||
RandomNum=MyValue
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
'###########################################################################################
|
||||
'에러 메일 발송
|
||||
'###########################################################################################
|
||||
Private Sub ErrorMail(er)
|
||||
Dim ErrBody
|
||||
ErrBody = LoadSkin("./SKIN/Error.htm")
|
||||
ErrBody = Replace(ErrBody,"##PROJECTTITLE##",SURVEYTITLE)
|
||||
ErrBody = Replace(ErrBody,"##PROJECTCODE##",PROJECTCODE)
|
||||
ErrBody = Replace(ErrBody,"##PAGE##",Request.Form("PageName"))
|
||||
ErrBody = Replace(ErrBody,"##ERKEY##",Request.Form("IDKey"))
|
||||
ErrBody = Replace(ErrBody,"##CODE##",er.Description)
|
||||
ErrBody = Replace(ErrBody,"##NUMBER##",er.Number)
|
||||
|
||||
MailSend "system@survey.kr","wmkim@trendmr.com;ehlee@trendmr.com;" & ERROREMAIL ,"Error Message",ErrBody
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
'###########################################################################################
|
||||
'makeItem
|
||||
'###########################################################################################
|
||||
'사용방법
|
||||
'Call QuestionMultiCNT(VARS,CODES,QUESTION,3,2,HTMLSCRIPT,JSCRIPT)
|
||||
'HTMLSCRIPT = Replace(HTMLSCRIPT,"[$_STITEM_$]",makeItem("Front_1_A.jpg,Front_1_B.jpg,Front_1_C.jpg,Front_1_D.jpg",getXValue("MQ1"),"LIKE"))
|
||||
|
||||
Function makeItem(IMAGES,SELNUM,TEXT)
|
||||
|
||||
Dim TableBody,ImageArray,tCount,Twidth
|
||||
TableBody = ""
|
||||
ImageArray = Split(IMAGES,",")
|
||||
TWidth = FormatNumber(CDbl(100/(UBound(ImageArray)+1)),2)
|
||||
|
||||
TableBody = TableBody & "<table id='V_table' class='attab01' cellpadding='0' cellspacing='0' border='0'>" & vbCrLF
|
||||
TableBody = TableBody & "<colgroup>" & vbCrLF
|
||||
For tCount=0 To UBound(ImageArray)
|
||||
TableBody = TableBody & " <col width="""&TWidth&"%""/>" & vbCrLF
|
||||
Next
|
||||
TableBody = TableBody & "</colgroup>" & vbCrLF
|
||||
TableBody = TableBody & "<tr>" & vbCrLF
|
||||
For tCount=0 To UBound(ImageArray)
|
||||
TableBody = TableBody & "<th style='text-align:center;background:#fff;'>"&vbCrLF
|
||||
TableBody = TableBody & " <img src=""./media/"&ImageArray(tCount)&""" alt=''/>"&vbCrLF
|
||||
TableBody = TableBody & "</th>"&vbCrLF
|
||||
Next
|
||||
TableBody = TableBody & "</tr>" & vbCrLF
|
||||
TableBody = TableBody & "<tr>" & vbCrLF
|
||||
For tCount=0 To UBound(ImageArray)
|
||||
TableBody = TableBody & "<td style='text-align:center;background:#fff;'>"&vbCrLF
|
||||
If (tCount+1)=CInt(SELNUM) Then
|
||||
TableBody = TableBody & " <b><font color='red'>" & TEXT & "</font></b>"&vbCrLF
|
||||
Else
|
||||
TableBody = TableBody & " " & vbCrLF
|
||||
End IF
|
||||
TableBody = TableBody & "</td>"&vbCrLF
|
||||
Next
|
||||
TableBody = TableBody & "</tr>" & vbCrLF
|
||||
TableBody = TableBody & "</table>"&vbCrLF
|
||||
makeItem = TableBody
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
Function makeItem2(IMAGES,SELNUM,TEXT,COL)
|
||||
|
||||
Dim TableBody,ImageArray,tCount,Twidth
|
||||
Dim EStr,DStr,XStr,mxCOL,colCnt
|
||||
|
||||
mxCOL = CLng(COL)
|
||||
colCnt=1
|
||||
|
||||
TableBody = ""
|
||||
ImageArray = Split(IMAGES,",")
|
||||
TWidth = FormatNumber(CDbl(100/CLng(COL)),2)
|
||||
|
||||
TableBody = TableBody & "<table id='V_table' class='attab01' cellpadding='0' cellspacing='0' border='0'>" & vbCrLF
|
||||
TableBody = TableBody & "<colgroup>" & vbCrLF
|
||||
For tCount=1 To CLng(COL)
|
||||
TableBody = TableBody & " <col width="""&TWidth&"%""/>" & vbCrLF
|
||||
Next
|
||||
TableBody = TableBody & "</colgroup>" & vbCrLF
|
||||
' TableBody = TableBody & "<tr>" & vbCrLF
|
||||
|
||||
DStr = ""
|
||||
EStr = ""
|
||||
|
||||
For tCount=0 To UBound(ImageArray)
|
||||
|
||||
EStr = EStr & "<th style='text-align:center;background:#fff;'>"&vbCrLF
|
||||
EStr = EStr & " <img src=""./media/"&ImageArray(tCount)&""" alt=''/>"&vbCrLF
|
||||
EStr = EStr & "</th>"&vbCrLF
|
||||
|
||||
DStr = DStr & "<td style='text-align:center;background:#fff;'>"&vbCrLF
|
||||
If (tCount+1)=CInt(SELNUM) Then
|
||||
DStr = DStr & " <b><font color='red'>" & TEXT & "</font></b>"&vbCrLF
|
||||
Else
|
||||
DStr = DStr & " " & vbCrLF
|
||||
End IF
|
||||
DStr = DStr & "</td>"&vbCrLF
|
||||
|
||||
If colCnt=mxCOL Then
|
||||
XSTR = XSTR & " <tr>" & vbCRLF
|
||||
XSTR = XSTR & EStr
|
||||
XSTR = XSTR & " </tr>" & vbCRLF
|
||||
XSTR = XSTR & " <tr>" & vbCRLF
|
||||
XSTR = XSTR & DStr
|
||||
XSTR = XSTR & " </tr>" & vbCRLF
|
||||
ESTR = ""
|
||||
DSTR = ""
|
||||
colCnt=1
|
||||
Else
|
||||
colCnt=colCnt+1
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
If ESTR<>"" AND DSTR<>"" Then
|
||||
XSTR = XSTR & " <tr>" & vbCRLF
|
||||
XSTR = XSTR & EStr & DSTR
|
||||
XSTR = XSTR & " </tr>" & vbCRLF
|
||||
End If
|
||||
|
||||
TableBody = TableBody & XStr
|
||||
TableBody = TableBody & "<tr>" & vbCrLF
|
||||
|
||||
For tCount=0 To UBound(ImageArray)
|
||||
Next
|
||||
|
||||
' TableBody = TableBody & "</tr>" & vbCrLF
|
||||
TableBody = TableBody & "</table>"&vbCrLF
|
||||
makeItem2 = TableBody
|
||||
|
||||
End Function
|
||||
|
||||
'##############################################################################
|
||||
'#http:체크
|
||||
'##############################################################################
|
||||
Function checkHTTP(linkStr)
|
||||
If Left(linkStr,7)="http://" Then
|
||||
checkHTTP = linkStr
|
||||
Else
|
||||
checkHTTP = "http://" & linkStr
|
||||
End If
|
||||
|
||||
End Function
|
||||
|
||||
'###########################################################################################
|
||||
'DB 날짜 형식대로 ASP로 출력하기
|
||||
'###########################################################################################
|
||||
Function ConvertDBDate(dates)
|
||||
Dim yy,mm,dd,hh,mi,se
|
||||
yy = year(dates)
|
||||
mm = right("0" & month(dates),2)
|
||||
dd = right("0" & day(dates),2)
|
||||
hh = right("0" & hour(dates),2)
|
||||
mi = right("0" & minute(dates),2)
|
||||
se = right("0" & second(dates),2)
|
||||
|
||||
ConvertDBDate = yy & "-" & mm & "-" & dd & " " & hh & ":" & mi & ":" & se
|
||||
|
||||
End Function
|
||||
|
||||
'###########################################################################################
|
||||
'ADODB Recordset to CSV
|
||||
'###########################################################################################
|
||||
Sub Write_CSV_From_Recordset(RS)
|
||||
|
||||
'
|
||||
' Export Recordset to CSV
|
||||
' http://salman-w.blogspot.com/2009/07/export-recordset-data-to-csv-using.html
|
||||
'
|
||||
' This sub-routine Response.Writes the content of an ADODB.RECORDSET in CSV format
|
||||
' The function closely follows the recommendations described in RFC 4180:
|
||||
' Common Format and MIME Type for Comma-Separated Values (CSV) Files
|
||||
' http://tools.ietf.org/html/rfc4180
|
||||
'
|
||||
' @RS: A reference to an open ADODB.RECORDSET object
|
||||
'
|
||||
|
||||
if RS.EOF then
|
||||
|
||||
'
|
||||
' There is no data to be written
|
||||
'
|
||||
exit sub
|
||||
|
||||
end if
|
||||
|
||||
dim RX
|
||||
set RX = new RegExp
|
||||
RX.Pattern = "\r|\n|,|"""
|
||||
|
||||
dim i
|
||||
dim Field
|
||||
dim Separator
|
||||
|
||||
'
|
||||
' Writing the header row (header row contains field names)
|
||||
'
|
||||
|
||||
Separator = ""
|
||||
for i = 0 to RS.Fields.Count - 1
|
||||
Field = RS.Fields(i).Name
|
||||
if RX.Test(Field) then
|
||||
'
|
||||
' According to recommendations:
|
||||
' - Fields that contain CR/LF, Comma or Double-quote should be enclosed in double-quotes
|
||||
' - Double-quote itself must be escaped by preceeding with another double-quote
|
||||
'
|
||||
Field = """" & Replace(Field, """", """""") & """"
|
||||
end if
|
||||
Response.Write Separator & Field
|
||||
Separator = ","
|
||||
next
|
||||
Response.Write vbNewLine
|
||||
|
||||
'
|
||||
' Writing the data rows
|
||||
'
|
||||
|
||||
do until RS.EOF
|
||||
Separator = ""
|
||||
for i = 0 to RS.Fields.Count - 1
|
||||
'
|
||||
' Note the concatenation with empty string below
|
||||
' This assures that NULL values are converted to empty string
|
||||
'
|
||||
Field = RS.Fields(i).Value & ""
|
||||
if RX.Test(Field) then
|
||||
Field = """" & Replace(Field, """", """""") & """"
|
||||
Field = Replace(Field,vbCrLF," ")
|
||||
end If
|
||||
If isNumeric(Field) Then
|
||||
'Response.Write Separator & Chr(34) & "'" & Field & Chr(34)
|
||||
Response.Write Separator & Chr(34) & Field & Chr(34)
|
||||
Else
|
||||
Response.Write Separator & Chr(34) & Field & Chr(34)
|
||||
End IF
|
||||
Separator = ","
|
||||
next
|
||||
Response.Write vbNewLine
|
||||
RS.MoveNext
|
||||
loop
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Function URLDecode(Expression)
|
||||
Dim strSource, strTemp, strResult, strchr
|
||||
Dim lngPos, AddNum, IFKor
|
||||
|
||||
strSource = Replace(Expression, "+", " ")
|
||||
For lngPos = 1 To Len(strSource)
|
||||
AddNum = 2
|
||||
strTemp = Mid(strSource, lngPos, 1)
|
||||
|
||||
If strTemp = "%" Then
|
||||
If lngPos + AddNum < Len(strSource) + 1 Then
|
||||
strchr = CInt("&H" & Mid(strSource, lngPos + 1, AddNum))
|
||||
|
||||
If strchr > 130 Then
|
||||
AddNum = 5
|
||||
IFKor = Mid(strSource, lngPos + 1, AddNum)
|
||||
IFKor = Replace(IFKor, "%", "")
|
||||
strchr = CInt("&H" & IFKor )
|
||||
End If
|
||||
|
||||
strResult = strResult & Chr(strchr)
|
||||
lngPos = lngPos + AddNum
|
||||
End If
|
||||
Else
|
||||
strResult = strResult & strTemp
|
||||
End If
|
||||
Next
|
||||
URLDecode = strResult
|
||||
End Function
|
||||
|
||||
'======================================================
|
||||
' 사용할때,, getRefererPage 함수를 호출하면 이전 페이지 이름만 리턴합니다.
|
||||
' Response.Write("refererValue : " & getRefererPage & "<br>")
|
||||
'======================================================
|
||||
Function getRefererPage
|
||||
|
||||
Dim refererValue, chkPos
|
||||
|
||||
' 호출한 페이지값을 받습니다.
|
||||
refererValue = Request.ServerVariables("HTTP_REFERER")
|
||||
' 호출한 페이지 값이 없을 경우
|
||||
IF Len(refererValue) = 0 Then
|
||||
getRefererPage = ""
|
||||
Exit Function
|
||||
End IF
|
||||
|
||||
' 문자열에서 마지막 '/'값의 위치를 찾습니다. Text비교
|
||||
chkPos = InstrRev(refererValue, "/", -1, 1)
|
||||
' 마지막 '/'값을 찾은 위치에서 마지막까지의 문자열만 추출합니다.
|
||||
refererValue = Right( refererValue, Len(refererValue) - chkPos )
|
||||
|
||||
' 추출한 페이지이름을 리턴합니다.
|
||||
getRefererPage = refererValue
|
||||
|
||||
End Function
|
||||
|
||||
'===========================================================================
|
||||
'함수명 : date_db
|
||||
'INPUT :
|
||||
'기능설명 : System DATE -> yyyy-mm-dd
|
||||
'===========================================================================
|
||||
Function date_db()
|
||||
v_year = year(now())
|
||||
mLen = Len(month(now()))
|
||||
If mLen <> 2 Then
|
||||
v_month = "0" + Cstr(month(now()))
|
||||
Else
|
||||
v_month = Cstr(month(now()))
|
||||
End If
|
||||
dLen = Len(day(now()))
|
||||
If dLen <> 2 Then
|
||||
v_day = "0" + Cstr(day(now()))
|
||||
Else
|
||||
v_day = Cstr(day(now()))
|
||||
End If
|
||||
date_db = Cstr(v_year) + "-" + Cstr(v_month) + "-" + Cstr(v_day)
|
||||
End Function
|
||||
|
||||
'===========================================================================
|
||||
'함수명 : date_time
|
||||
'INPUT :
|
||||
'기능설명 : System DATE -> yyyymmddhhmmss
|
||||
'===========================================================================
|
||||
Function date_time()
|
||||
v_year = year(date)
|
||||
v_month = month(date)
|
||||
if v_month < 10 then v_month = "0" & v_month
|
||||
v_day = day(date)
|
||||
if v_day < 10 then v_day = "0" & v_day
|
||||
v_hour = hour(time)
|
||||
if v_hour < 10 then v_hour = "0" & v_hour
|
||||
v_minute = minute(time)
|
||||
if v_minute < 10 then v_minute = "0" & v_minute
|
||||
v_second = second(time)
|
||||
if v_second < 10 then v_second = "0" & v_second
|
||||
v_datetime = v_year&v_month&v_day&v_hour&v_minute&v_second
|
||||
date_time = v_datetime
|
||||
End Function
|
||||
|
||||
'===========================================================================
|
||||
'함수명 : fncRequestVariables
|
||||
'INPUT : Request명
|
||||
'기능설명 :
|
||||
'===========================================================================
|
||||
function fncRequestVariables(varParam)
|
||||
Dim p
|
||||
p = ""
|
||||
if ucase(varParam) = "REMOTE_ADDR" then '리모트 ip 가져와서리
|
||||
p = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
|
||||
if p = "" then
|
||||
p = Request.ServerVariables("HTTP_CLIENT_IP")
|
||||
if p = "" then '암것도 없으면 ......
|
||||
p = Request.ServerVariables(varParam) 'REMOTE_ADDR 다시 받고
|
||||
end if
|
||||
else
|
||||
'if p = "119.67.93.000" then
|
||||
' p = "211.58.239.000"
|
||||
'end if
|
||||
end if
|
||||
else
|
||||
p = Request.ServerVariables(varParam) '나머지 서버 변수는 그냥사용
|
||||
end if
|
||||
fncRequestVariables = p
|
||||
end function
|
||||
|
||||
%>
|
||||
21
Lib/infiles/Reporting_config.asp
Normal file
21
Lib/infiles/Reporting_config.asp
Normal file
@@ -0,0 +1,21 @@
|
||||
<%
|
||||
Option ExPlicit
|
||||
Dim SV_NAME : SV_NAME = "1.235.195.34"
|
||||
Dim DB_NAME : DB_NAME = "new_cati"
|
||||
Dim UID : UID = "sa"
|
||||
Dim PWD : PWD = "krco#51304"
|
||||
|
||||
Dim SV_NAME1 : SV_NAME1 = "1.235.195.34"
|
||||
Dim DB_NAME1 : DB_NAME1 = "krc_survey"
|
||||
Dim UID1 : UID1 = "sa"
|
||||
Dim PWD1 : PWD1 = "krco#51304"
|
||||
dim ksurvey, ksurvey2, DBopener
|
||||
|
||||
'ksurvey = "Provider=SQLOLEDB;Server=1.235.195.34;Initial Catalog="&DB_NAME1&";uid="&UID1&";pwd="&PWD1&";" 'krc_survey db
|
||||
ksurvey2 = "Provider=SQLOLEDB;Server="&SV_NAME1&";Initial Catalog="&DB_NAME1&";uid="&UID1&";pwd="&PWD1&";" 'report db
|
||||
|
||||
|
||||
ksurvey = "Provider=SQLOLEDB;Server="&SV_NAME&";Initial Catalog="&DB_NAME&";uid="&UID&";pwd="&PWD&";" 'cati db
|
||||
|
||||
'ksurvey = "Provider=SQLOLEDB;Server="&SV_NAME1&";Initial Catalog="&DB_NAME1&";uid=sa;pwd=dudgus25;" 'krc_survey db
|
||||
%>
|
||||
75
Lib/infiles/basic.css
Normal file
75
Lib/infiles/basic.css
Normal file
@@ -0,0 +1,75 @@
|
||||
body,td,tr,input {
|
||||
font-family: '맑은 고딕', 'Malgun Gothic', verdana;
|
||||
font-size: 12px;
|
||||
line-height: 140%;
|
||||
}
|
||||
|
||||
.body {
|
||||
font-family: '맑은 고딕', 'Malgun Gothic', verdana;
|
||||
font-size: 12px;
|
||||
border: 0px;
|
||||
margin-left: 0px;
|
||||
line-height: 140%;
|
||||
}
|
||||
|
||||
.td {
|
||||
font-family: '맑은 고딕', 'Malgun Gothic', verdana;
|
||||
font-size: 12px;
|
||||
line-height: 140%;
|
||||
}
|
||||
|
||||
.input,textarea {
|
||||
font-family: '맑은 고딕', 'Malgun Gothic', verdana;
|
||||
font-size: 12px;
|
||||
border-width:1px;
|
||||
background-color:#F0F3F5;
|
||||
color:black;
|
||||
border-color:black;
|
||||
}
|
||||
|
||||
.tableWline {
|
||||
background-image: url(http://sendmail.randr.co.kr/img/etc/table_point1.gif);
|
||||
background-attachment:fixed;
|
||||
background-repeat: repeat-x;
|
||||
}
|
||||
|
||||
.tableHline {
|
||||
background-image: url(http://sendmail.randr.co.kr/img/etc/table_point2.gif);
|
||||
background-attachment: fixed;
|
||||
background-repeat: repeat-y;
|
||||
}
|
||||
|
||||
a:link {color:blue; text-decoration:none}
|
||||
a:visited {text-decoration : none; COLOR: #0000ff}
|
||||
a:active text-decoration : none; COLOR: #0000ff}
|
||||
a:hover {text-decoration : underline:none; COLOR: #CC0000}
|
||||
|
||||
.stTable {font-family: '맑은 고딕', 'Malgun Gothic', verdana;font-size:12px;line-height:120%;border-style: ridge; padding-left: 1; padding-right: 1; padding-top: 1;
|
||||
padding-bottom: 1 }
|
||||
|
||||
|
||||
.tinput { font-family: '맑은 고딕', 'Malgun Gothic', verdana; font-size:12px; background-color: #ECE1F7; border: 1px solid #8484FF;margin-left:2px; }
|
||||
.tnuminput { font-family: '맑은 고딕', 'Malgun Gothic', verdana; font-size:12px; background-color: #ECE1F7; border: 1px solid #8484FF;margin-left:2px;text-align:right;margin-right:2px; }
|
||||
|
||||
.tbutton { font-family: '맑은 고딕', 'Malgun Gothic', verdana;font-size:12px;boder:1px; border-color:gray; height:20px;border-width:1px;
|
||||
background-color:#000000;color:white;
|
||||
|
||||
|
||||
}
|
||||
|
||||
.trightvline {border-right-style:solid;border-right-color:white;border-right-width:1px; }
|
||||
|
||||
|
||||
.tbbottomline {border-bottom-style:dotted;border-bottom-color:#e2e2e2;border-bottom-width:1px;line-height:120%; }
|
||||
|
||||
.tbbottomline2 {border-bottom-color:#120000;border-left-width:1px;border-right-width:1px;border-top-width:1px; border-bottom-style:dashed;border-bottom-width:1px;}
|
||||
|
||||
/* ------- */
|
||||
.post_write {padding-left: 5px; }
|
||||
|
||||
#id_background {background:#fff url(http://static.naver.com/common/login/bg_login_id_main_4.gif) no-repeat 0px 0px;}
|
||||
#pwd_background {background:#fff url(/mainimages/loginpwd.gif) no-repeat 0px 0px;}
|
||||
.input_text{display:block; position:relative; border:1px solid #bebebe; width:98px; height:16px; color:#F0F3F5; *margin:-1px 0; padding:4px 2px 0 2px; font-size:12px; vertical-align:top;}
|
||||
|
||||
.uid {background:#fff url(http://static.naver.com/common/login/bg_login_id_main_4.gif) no-repeat 0px 0px;}
|
||||
.upw {background:#fff url(http://static.naver.com/common/login/bg_login_pw_main_4.gif) no-repeat 0px 0px;}
|
||||
108
Lib/infiles/basic_table.css
Normal file
108
Lib/infiles/basic_table.css
Normal file
@@ -0,0 +1,108 @@
|
||||
html, body, form, fieldset, h1, h2, h3, h4, h5, h6, p, pre, blockquote, ul, ol, dl, address {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
body {
|
||||
font:80%/150% "Trebuchet MS",Verdana,Arial,Helvetica,sans-serif;
|
||||
}
|
||||
p {
|
||||
text-align:center;
|
||||
}
|
||||
a:link {
|
||||
color:#d42945;
|
||||
text-decoration:none;
|
||||
border-bottom:1px dotted #ffbac8;
|
||||
}
|
||||
a:visited {
|
||||
color:#d42945;
|
||||
border-bottom:none;
|
||||
text-decoration:none;
|
||||
}
|
||||
a:hover,
|
||||
a:focus {
|
||||
color:#f03b58;
|
||||
border-bottom:1px solid #f03b58;
|
||||
text-decoration:none;
|
||||
}
|
||||
table a,
|
||||
table a:link,
|
||||
table a:visited {
|
||||
border:none;
|
||||
}
|
||||
|
||||
img {
|
||||
border:0;
|
||||
margin-top:.5em;
|
||||
}
|
||||
table {
|
||||
/*width:95%;*/
|
||||
border-top:1px solid #e5eff8;
|
||||
border-right:1px solid #e5eff8;
|
||||
margin:1em auto;
|
||||
border-collapse:collapse;
|
||||
}
|
||||
caption {
|
||||
color: #9ba9b4;
|
||||
font-size:.94em;
|
||||
letter-spacing:.1em;
|
||||
margin:1em 0 0 0;
|
||||
padding:0;
|
||||
caption-side:top;
|
||||
text-align:center;
|
||||
}
|
||||
tr.odd td {
|
||||
background:#f7fbff
|
||||
/*background:#CDECFA*/
|
||||
}
|
||||
tr.odd .column1{
|
||||
background:#f4f9fe;
|
||||
}
|
||||
.column1 {
|
||||
background:#f9fcfe;
|
||||
}
|
||||
td {
|
||||
color:#678197;
|
||||
border-bottom:1px solid #e5eff8;
|
||||
border-left:1px solid #e5eff8;
|
||||
padding:.3em 1em;
|
||||
/*text-align:center;*/
|
||||
}
|
||||
th {
|
||||
font-weight:normal;
|
||||
color: #678197;
|
||||
/*text-align:left;*/
|
||||
border-bottom: 1px solid #e5eff8;
|
||||
border-left:1px solid #e5eff8;
|
||||
padding:.3em 1em;
|
||||
}
|
||||
thead th {
|
||||
/*background:#f4f9fe;*/
|
||||
background:#E3EDF8;
|
||||
|
||||
/*text-align:center;*/
|
||||
/*font:bold 1.0em/2em "Century Gothic","Trebuchet MS",Arial,Helvetica,sans-serif;*/
|
||||
font: 1.0em "Century Gothic","Trebuchet MS",Arial,Helvetica,sans-serif;
|
||||
color:#66a3d3
|
||||
}
|
||||
thead td {
|
||||
|
||||
}
|
||||
tfoot th {
|
||||
/*text-align:center;*/
|
||||
background:#f4f9fe;
|
||||
}
|
||||
tfoot th strong {
|
||||
font:bold 1.2em "Century Gothic","Trebuchet MS",Arial,Helvetica,sans-serif;
|
||||
margin:.5em .5em .5em 0;
|
||||
color:#66a3d3;
|
||||
}
|
||||
tfoot th em {
|
||||
color:#f03b58;
|
||||
font-weight: bold;
|
||||
font-size: 1.1em;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
|
||||
.bt{ font-face:????u;font-size:12px;boder:1px; border-color:gray; height:20px;border-width:1px; background-color:#5a5a5a;color:white;}
|
||||
208
Lib/infiles/db_comm.asp
Normal file
208
Lib/infiles/db_comm.asp
Normal file
@@ -0,0 +1,208 @@
|
||||
<!--METADATA TYPE= "typelib" NAME= "ADODB Type Library" FILE="C:\Program Files\Common Files\SYSTEM\ADO\msado15.dll" -->
|
||||
<%
|
||||
Class clsDBcomm
|
||||
Private DefaultConnection
|
||||
|
||||
private sub Class_Initialize()
|
||||
Set DefaultConnection = Nothing
|
||||
End Sub
|
||||
|
||||
|
||||
'===================================
|
||||
' SQL Query를 실행하고, RecordSet을 반환한다.
|
||||
'===================================
|
||||
Public Function ExecSQLReturnRS(strSQL, params, connectionString, dbstr)
|
||||
If IsObject(connectionString) Then
|
||||
If connectionString is Nothing Then
|
||||
If DefaultConnection is Nothing Then
|
||||
Set DefaultConnection = CreateObject("ADODB.Connection")
|
||||
DefaultConnection.Open dbstr
|
||||
End If
|
||||
Set connectionString = DefaultConnection
|
||||
End If
|
||||
End If
|
||||
dim rs, cmd
|
||||
Set rs = CreateObject("ADODB.RecordSet")
|
||||
Set cmd = CreateObject("ADODB.Command")
|
||||
|
||||
cmd.ActiveConnection = connectionString
|
||||
cmd.CommandText = strSQL
|
||||
cmd.CommandType = adCmdText
|
||||
Set cmd = collectParams(cmd, params)
|
||||
rs.CursorLocation = adUseClient
|
||||
'response.Write strSQL & vbcrlf
|
||||
' READ ONLY
|
||||
rs.Open cmd, , adOpenStatic, adLockReadOnly
|
||||
|
||||
Set cmd.ActiveConnection = Nothing
|
||||
Set cmd = Nothing
|
||||
Set rs.ActiveConnection = Nothing
|
||||
|
||||
Set ExecSQLReturnRS = rs
|
||||
End Function
|
||||
|
||||
'===================================
|
||||
' SQL Query를 실행하고 UPDATE 실행
|
||||
'===================================
|
||||
Public Function ExecSQLReturnRS2(strSQL, params, connectionString, dbstr)
|
||||
If IsObject(connectionString) Then
|
||||
If connectionString is Nothing Then
|
||||
If DefaultConnection is Nothing Then
|
||||
Set DefaultConnection = CreateObject("ADODB.Connection")
|
||||
DefaultConnection.Open dbstr
|
||||
End If
|
||||
Set connectionString = DefaultConnection
|
||||
End If
|
||||
End If
|
||||
dim rs
|
||||
Set rs = CreateObject("ADODB.RecordSet")
|
||||
' Set cmd = CreateObject("ADODB.Command")
|
||||
'
|
||||
' cmd.ActiveConnection = connectionString
|
||||
' cmd.CommandText = strSQL
|
||||
' cmd.CommandType = adCmdText
|
||||
' Set cmd = collectParams(cmd, params)
|
||||
'
|
||||
rs.CursorLocation = adUseClient
|
||||
|
||||
' READ UPATE
|
||||
rs.Open strSQL, connectionString, adOpenStatic, adLockPessimistic
|
||||
|
||||
|
||||
' Set cmd.ActiveConnection = Nothing
|
||||
' Set cmd = Nothing
|
||||
' Set rs.ActiveConnection = Nothing
|
||||
|
||||
Set ExecSQLReturnRS2 = rs
|
||||
End Function
|
||||
|
||||
|
||||
'===================================
|
||||
' SQL Query를 실행 (Rs 반환없음)
|
||||
'===================================
|
||||
Public Sub ExecSQL(strSQL,params,connectionString, dbstr)
|
||||
If IsObject(connectionString) Then
|
||||
If connectionString is Nothing Then
|
||||
If DefaultConnection is Nothing Then
|
||||
Set DefaultConnection = CreateObject("ADODB.Connection")
|
||||
DefaultConnection.Open dbstr
|
||||
End If
|
||||
Set connectionString = DefaultConnection
|
||||
End If
|
||||
End If
|
||||
|
||||
dim cmd
|
||||
Set cmd = CreateObject("ADODB.Command")
|
||||
|
||||
cmd.ActiveConnection = connectionString
|
||||
cmd.CommandText = strSQL
|
||||
cmd.CommandType = adCmdText
|
||||
Set cmd = collectParams(cmd, params)
|
||||
|
||||
cmd.Execute , , adExecuteNoRecords
|
||||
|
||||
Set cmd.ActiveConnection = Nothing
|
||||
Set cmd = Nothing
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
|
||||
'+++++++++++++++++++
|
||||
|
||||
|
||||
|
||||
'---------------------------------------------------
|
||||
' 트랜잭션을 시작하고, Connetion 개체를 반환한다.
|
||||
'---------------------------------------------------
|
||||
Public Function BeginTrans(connectionString)
|
||||
If IsObject(connectionString) Then
|
||||
If connectionString is Nothing Then
|
||||
connectionString = DefaultConnString
|
||||
End If
|
||||
End If
|
||||
|
||||
Set conn = Server.CreateObject("ADODB.Connection")
|
||||
conn.Open connectionString
|
||||
conn.BeginTrans
|
||||
Set BeginTrans = conn
|
||||
End Function
|
||||
|
||||
'---------------------------------------------------
|
||||
' 활성화된 트랜잭션을 커밋한다.
|
||||
'---------------------------------------------------
|
||||
Public Sub CommitTrans(connectionObj)
|
||||
If Not connectionObj Is Nothing Then
|
||||
connectionObj.CommitTrans
|
||||
connectionObj.Close
|
||||
Set ConnectionObj = Nothing
|
||||
End If
|
||||
End Sub
|
||||
|
||||
'---------------------------------------------------
|
||||
' 활성화된 트랜잭션을 롤백한다.
|
||||
'---------------------------------------------------
|
||||
Public Sub RollbackTrans(connectionObj)
|
||||
If Not connectionObj Is Nothing Then
|
||||
connectionObj.RollbackTrans
|
||||
connectionObj.Close
|
||||
Set ConnectionObj = Nothing
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
'+++++++++++++++++++
|
||||
|
||||
|
||||
|
||||
|
||||
'---------------------------
|
||||
' -- Nothing
|
||||
'---------------------------
|
||||
Public Sub Dispose
|
||||
if (Not DefaultConnection is Nothing) Then
|
||||
if (DefaultConnection.State = adStateOpen) Then DefaultConnection.Close
|
||||
Set DefaultConnection = Nothing
|
||||
End if
|
||||
End Sub
|
||||
|
||||
|
||||
'---------------------------------------------------------------------------
|
||||
'Array로 넘겨오는 파라메터를 Parsing 하여 Parameter 객체를
|
||||
'생성하여 Command 객체에 추가한다.
|
||||
'---------------------------------------------------------------------------
|
||||
Private Function collectParams(cmd,argparams)
|
||||
If VarType(argparams) = 8192 or VarType(argparams) = 8204 or VarType(argparams) = 8209 then
|
||||
params = argparams
|
||||
For i = LBound(params) To UBound(params)
|
||||
l = LBound(params(i))
|
||||
u = UBound(params(i))
|
||||
' Check for nulls.
|
||||
If u - l = 4 Then
|
||||
|
||||
If VarType(params(i)(4)) = vbString Then
|
||||
If params(i)(4) = "" Then
|
||||
v = Null
|
||||
Else
|
||||
v = params(i)(4)
|
||||
End If
|
||||
Else
|
||||
v = params(i)(4)
|
||||
End If
|
||||
cmd.Parameters.Append cmd.CreateParameter(params(i)(0), params(i)(1), params(i)(2), params(i)(3), v)
|
||||
End If
|
||||
Next
|
||||
|
||||
Set collectParams = cmd
|
||||
Exit Function
|
||||
Else
|
||||
Set collectParams = cmd
|
||||
End If
|
||||
End Function
|
||||
|
||||
|
||||
End Class
|
||||
%>
|
||||
119
Lib/infiles/fun_module.asp
Normal file
119
Lib/infiles/fun_module.asp
Normal file
@@ -0,0 +1,119 @@
|
||||
<%
|
||||
|
||||
|
||||
' 히든값 넘기기
|
||||
Sub f_hiddenNext()
|
||||
Dim x
|
||||
For Each x in xform
|
||||
if left(x,2)="ff" Then
|
||||
If Trim(x)<>"ffnextpage" Then
|
||||
response.write "<input type='hidden' name='"&x&"' value='"&xform(x)&"' >"&vbCrLf
|
||||
End If
|
||||
end if
|
||||
next
|
||||
end Sub
|
||||
|
||||
|
||||
|
||||
' ----------------------------------------------------------------------------------
|
||||
'값 가져오기
|
||||
|
||||
function fy_GetQue(mo_field)
|
||||
|
||||
dim mo_DBopener,mo_objdb,mo_sql
|
||||
Call ClsOpen(mo_DBopener) : Dim mo_openDB : mo_openDB=ksurvey
|
||||
|
||||
mo_sql="select "&mo_field&" from "&xTable
|
||||
mo_sql=mo_sql&" where ffid='"&request.item("ffid")&"' "
|
||||
Call RsSQL(mo_DBopener,mo_openDB,mo_sql,mo_objdb)
|
||||
fy_GetQue=""
|
||||
if not mo_objdb.Eof then
|
||||
fy_GetQue=mo_objdb(0)
|
||||
end if
|
||||
|
||||
Call CloseSQL(mo_objdb)
|
||||
Call CloseCls(mo_DBopener)
|
||||
end function
|
||||
|
||||
' ----------------------------------------------------------------------------------
|
||||
|
||||
' 입력값 치환..
|
||||
Function f_replace(mo,t)
|
||||
Select Case t
|
||||
Case 1
|
||||
mo=Replace(mo,"'","")
|
||||
mo=Replace(mo,"""","")
|
||||
mo=Replace(mo," ","")
|
||||
mo=Replace(mo,"<","")
|
||||
mo=Replace(mo,">","")
|
||||
Case 2 ' 설문조사용
|
||||
mo=Replace(mo,"""","'")
|
||||
' mo=Replace(mo,"""","")
|
||||
' mo=Replace(mo," ","")
|
||||
mo=Replace(mo,"<","(")
|
||||
mo=Replace(mo,">",")")
|
||||
Case 3
|
||||
' 변환없음..
|
||||
|
||||
|
||||
Case 4 ' 숫자 ""시 --> 0: 리턴..
|
||||
mo=Replace(mo,"'","")
|
||||
mo=Replace(mo,"""","")
|
||||
mo=Replace(mo," ","")
|
||||
mo=Replace(mo,"<","")
|
||||
mo=Replace(mo,">","")
|
||||
If Trim(mo)="" Then mo=0
|
||||
|
||||
Case 5 ' textarea: 입력값 보여주기..
|
||||
mo=Replace(mo,"'","")
|
||||
mo=Replace(mo,"""","")
|
||||
' mo=Replace(mo," ","")
|
||||
mo=Replace(mo,"<","")
|
||||
mo=Replace(mo,">","")
|
||||
|
||||
mo=Replace(mo,"<","<")
|
||||
mo=Replace(mo,">",">")
|
||||
mo=Replace(mo,vbCrLf,"<br>")
|
||||
|
||||
Case 6 ' html 적용시..
|
||||
mo=Replace(mo,"'","")
|
||||
mo=Replace(mo,"""","")
|
||||
' mo=Replace(mo," ","")
|
||||
' mo=Replace(mo,"<","")
|
||||
' mo=Replace(mo,">","")
|
||||
|
||||
' mo=Replace(mo,"<","<")
|
||||
' mo=Replace(mo,">",">")
|
||||
mo=Replace(mo,vbCrLf,"<br>")
|
||||
|
||||
|
||||
End Select
|
||||
|
||||
mo=fncRegularReplace(mo, "select", "[select]")
|
||||
mo=fncRegularReplace(mo, "update", "[update]")
|
||||
mo=fncRegularReplace(mo, "insert", "[insert]")
|
||||
mo=fncRegularReplace(mo, "drop", "[drop]")
|
||||
mo=fncRegularReplace(mo, "delete", "[delete]")
|
||||
mo=fncRegularReplace(mo, "create", "[create]")
|
||||
mo=fncRegularReplace(mo, "alert", "[alert]")
|
||||
|
||||
f_replace=mo
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
'// Regular Expression으로 문자열 교체..
|
||||
Function fncRegularReplace( pOrgString, pPatternString, pReplaceString)
|
||||
Dim objRegExp : Set objRegExp = New RegExp
|
||||
|
||||
objRegExp.Pattern = pPatternString
|
||||
objRegExp.IgnoreCase = True
|
||||
objRegExp.Global = True
|
||||
|
||||
fncRegularReplace = objRegExp.Replace( pOrgString, pReplaceString)
|
||||
End Function
|
||||
|
||||
|
||||
%>
|
||||
|
||||
|
||||
183
Lib/infiles/fun_save.asp
Normal file
183
Lib/infiles/fun_save.asp
Normal file
@@ -0,0 +1,183 @@
|
||||
<!-- #include file="ini.asp" -->
|
||||
<%
|
||||
' 페이지 체크
|
||||
function f_pageCk(xado, xopenDB, xTable)
|
||||
|
||||
|
||||
dim x, xsql, ysql, usql, xobjdb
|
||||
xsql=" select ffpagelog, ffpage from "&xTable
|
||||
xsql=xsql&" where ffid='"&f_replace(request.form("ffid"),2)&"' "
|
||||
xsql=xsql&" and fftype='"&f_replace(request.form("fftype"),2)&"' "
|
||||
Call RsSQL(xado, xopenDB, xsql,xobjdb)
|
||||
If xobjdb.eof Then
|
||||
Call CloseCls(DBopener)
|
||||
response.write "<br> 정상적인 접근이 아닙니다. 처음부터 다시 진행하여 주시기 바랍니다. "
|
||||
response.end
|
||||
end if
|
||||
|
||||
dim xNum : xNum=split(xobjdb(0),"#")
|
||||
dim xNumYN : xNumYN="Y"
|
||||
dim xNumPage : xNumPage=""
|
||||
for i=0 to ubound(xNum)
|
||||
if trim(xNum(i))<>"" then
|
||||
if trim(ffnextpage)=trim(xNum(i)) then
|
||||
xNumYN="N"
|
||||
exit for
|
||||
end if
|
||||
end if
|
||||
next
|
||||
|
||||
|
||||
select case xNumYN
|
||||
case "Y" : xNumPage=""
|
||||
case "N" : xNumPage=xobjdb(1)
|
||||
end select
|
||||
Call CloseSQL(xobjdb)
|
||||
|
||||
f_pageCk=xNumPage
|
||||
|
||||
end function
|
||||
|
||||
|
||||
'#######################
|
||||
|
||||
|
||||
'데이터 저장
|
||||
Sub f_dataSave(xado, xopenDB, xTable) '-- xado:ADO클레스 , xopenDB:연결정보, xTable : 저장테이블명
|
||||
dim x, xsql, ysql, usql, xobjdb
|
||||
usql=""
|
||||
|
||||
' 구분별..
|
||||
For Each x in request.form
|
||||
|
||||
x_field=mid(x,3,len(x)) ' 저장필드명.
|
||||
select case Lcase(left(x,2))
|
||||
Case "s_" ' 단일
|
||||
usql=usql&","&x_field&"='"&f_replace(request.form(x),2)&"'"
|
||||
|
||||
Case "t_" ' text
|
||||
usql=usql&","&x_field&"='"&f_replace(request.form(x),2)&"'"
|
||||
|
||||
Case "m_" ' 멀티
|
||||
for j=1 to request.form(x).count
|
||||
usql=usql&","&x_field&"__"&request.form(x)(j)&"='"&f_replace(request.form(x)(j),2)&"'"
|
||||
next
|
||||
|
||||
Case "g_" ' 시간등록
|
||||
usql=usql&","&x_field&"=getdate() "
|
||||
End Select
|
||||
|
||||
Next
|
||||
|
||||
' 업데이트 쿼리.
|
||||
xsql=" update "&xTable&" set "
|
||||
|
||||
' 업데이트 기준
|
||||
If request.form("ffid")="" Then '-- Error
|
||||
Call CloseCls(DBopener)
|
||||
response.write "<br> 정상적인 접근이 아닙니다. 처음부터 다시 진행하여 주시기 바랍니다. "
|
||||
response.end
|
||||
|
||||
else ' 업데이트 기준
|
||||
ysql=" ffid='"&f_replace(request.form("ffid"),2)&"' "
|
||||
ysql=ysql&" and fftype='"&f_replace(request.form("fftype"),2)&"' "
|
||||
|
||||
end if
|
||||
|
||||
' SQL 생성.
|
||||
xsql=xsql&" fftype='"&f_replace(request.form("fftype"),2)&"' "
|
||||
xsql=xsql&usql&" where "&ysql
|
||||
' response.write xsql
|
||||
' response.End
|
||||
Call ExSQL(xado, xopenDB, xsql)
|
||||
|
||||
|
||||
|
||||
|
||||
'########## 진행상태 업데이트 ###################
|
||||
if not isnull(request.form("ffing")) then
|
||||
xsql=" update "&xTable&" set "
|
||||
xsql=xsql&" ffing='"&f_replace(request.form("ffing"),2)&"' "
|
||||
xsql=xsql&usql&" where "&ysql
|
||||
Call ExSQL(xado, xopenDB, xsql)
|
||||
end if
|
||||
|
||||
|
||||
'########## ffend(완료시간) 저장 ###################
|
||||
if not request.form("ffend")="0" then
|
||||
xsql=" update "&xTable&" set "
|
||||
xsql=xsql&" ffend=getdate() "
|
||||
xsql=xsql&usql&" where "&ysql
|
||||
Call ExSQL(xado, xopenDB, xsql)
|
||||
end if
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
'#######################
|
||||
|
||||
' 페이지 정보 저장
|
||||
sub f_pageSave(xado, xopenDB, xTable)
|
||||
|
||||
dim x, xsql, ysql, usql, xobjdb
|
||||
xsql=" update "&xTable&" set "
|
||||
xsql=xsql&" ffpage='"&ffnextpage&"' "
|
||||
xsql=xsql&",ffpagelog=ffpagelog+'#'+'"&ffnextpage&"' " '-- 분리자(#)
|
||||
xsql=xsql&",ffpagecount=ffpagecount+1 "
|
||||
xsql=xsql&" where ffid='"&f_replace(request.form("ffid"),2)&"' "
|
||||
xsql=xsql&" and fftype='"&f_replace(request.form("fftype"),2)&"' "
|
||||
Call ExSQL(xado, xopenDB, xsql)
|
||||
|
||||
end sub
|
||||
|
||||
'#######################
|
||||
|
||||
|
||||
|
||||
' ----------------------------------------------------------------------------------
|
||||
' ----------------------------------------------------------------------------------
|
||||
|
||||
|
||||
' 클레스 생성
|
||||
Sub clsOpen(mo)
|
||||
Set mo = new clsDBcomm
|
||||
End Sub
|
||||
|
||||
|
||||
' select 실행 : read only
|
||||
Sub RsSQL(clsN, mo_openDB, mo_sql, moobj)
|
||||
Set moobj = clsN.ExecSQLReturnRS(mo_sql, Nothing, Nothing,mo_openDB)
|
||||
End Sub
|
||||
|
||||
|
||||
' select 실행. : read update
|
||||
Sub RsSQL2(clsN, mo_openDB, mo_sql, moobj)
|
||||
Set moobj = clsN.ExecSQLReturnRS2(mo_sql, Nothing, Nothing,mo_openDB)
|
||||
End Sub
|
||||
|
||||
|
||||
' SQL 실행. : 리턴없음
|
||||
Sub ExSQL(clsN, mo_openDB, mo_sql)
|
||||
Call clsN.ExecSQL(mo_sql, Nothing, Nothing,mo_openDB)
|
||||
End Sub
|
||||
|
||||
|
||||
'연결종료
|
||||
Sub CloseSQL(mo)
|
||||
mo.Close
|
||||
Set mo = Nothing
|
||||
End Sub
|
||||
|
||||
' 클레스 종료
|
||||
Sub CloseCls(mo)
|
||||
mo.Dispose
|
||||
Set mo = Nothing
|
||||
End Sub
|
||||
|
||||
|
||||
' ----------------------------------------------------------------------------------
|
||||
' ----------------------------------------------------------------------------------
|
||||
|
||||
|
||||
%>
|
||||
183
Lib/infiles/fun_save_copy.asp
Normal file
183
Lib/infiles/fun_save_copy.asp
Normal file
@@ -0,0 +1,183 @@
|
||||
<!-- #include file="ini_copy.asp" -->
|
||||
<%
|
||||
' 페이지 체크
|
||||
function f_pageCk(xado, xopenDB, xTable)
|
||||
|
||||
|
||||
dim x, xsql, ysql, usql, xobjdb
|
||||
xsql=" select ffpagelog, ffpage from "&xTable
|
||||
xsql=xsql&" where ffid='"&f_replace(request.form("ffid"),2)&"' "
|
||||
xsql=xsql&" and fftype='"&f_replace(request.form("fftype"),2)&"' "
|
||||
Call RsSQL(xado, xopenDB, xsql,xobjdb)
|
||||
If xobjdb.eof Then
|
||||
Call CloseCls(DBopener)
|
||||
response.write "<br> 정상적인 접근이 아닙니다. 처음부터 다시 진행하여 주시기 바랍니다. "
|
||||
response.end
|
||||
end if
|
||||
|
||||
dim xNum : xNum=split(xobjdb(0),"#")
|
||||
dim xNumYN : xNumYN="Y"
|
||||
dim xNumPage : xNumPage=""
|
||||
for i=0 to ubound(xNum)
|
||||
if trim(xNum(i))<>"" then
|
||||
if trim(ffnextpage)=trim(xNum(i)) then
|
||||
xNumYN="N"
|
||||
exit for
|
||||
end if
|
||||
end if
|
||||
next
|
||||
|
||||
|
||||
select case xNumYN
|
||||
case "Y" : xNumPage=""
|
||||
case "N" : xNumPage=xobjdb(1)
|
||||
end select
|
||||
Call CloseSQL(xobjdb)
|
||||
|
||||
f_pageCk=xNumPage
|
||||
|
||||
end function
|
||||
|
||||
|
||||
'#######################
|
||||
|
||||
|
||||
'데이터 저장
|
||||
Sub f_dataSave(xado, xopenDB, xTable) '-- xado:ADO클레스 , xopenDB:연결정보, xTable : 저장테이블명
|
||||
dim x, xsql, ysql, usql, xobjdb
|
||||
usql=""
|
||||
|
||||
' 구분별..
|
||||
For Each x in request.form
|
||||
|
||||
x_field=mid(x,3,len(x)) ' 저장필드명.
|
||||
select case Lcase(left(x,2))
|
||||
Case "s_" ' 단일
|
||||
usql=usql&","&x_field&"='"&f_replace(request.form(x),2)&"'"
|
||||
|
||||
Case "t_" ' text
|
||||
usql=usql&","&x_field&"='"&f_replace(request.form(x),2)&"'"
|
||||
|
||||
Case "m_" ' 멀티
|
||||
for j=1 to request.form(x).count
|
||||
usql=usql&","&x_field&"__"&request.form(x)(j)&"='"&f_replace(request.form(x)(j),2)&"'"
|
||||
next
|
||||
|
||||
Case "g_" ' 시간등록
|
||||
usql=usql&","&x_field&"=getdate() "
|
||||
End Select
|
||||
|
||||
Next
|
||||
|
||||
' 업데이트 쿼리.
|
||||
xsql=" update "&xTable&" set "
|
||||
|
||||
' 업데이트 기준
|
||||
If request.form("ffid")="" Then '-- Error
|
||||
Call CloseCls(DBopener)
|
||||
response.write "<br> 정상적인 접근이 아닙니다. 처음부터 다시 진행하여 주시기 바랍니다. "
|
||||
response.end
|
||||
|
||||
else ' 업데이트 기준
|
||||
ysql=" ffid='"&f_replace(request.form("ffid"),2)&"' "
|
||||
ysql=ysql&" and fftype='"&f_replace(request.form("fftype"),2)&"' "
|
||||
|
||||
end if
|
||||
|
||||
' SQL 생성.
|
||||
xsql=xsql&" fftype='"&f_replace(request.form("fftype"),2)&"' "
|
||||
xsql=xsql&usql&" where "&ysql
|
||||
' response.write xsql
|
||||
' response.End
|
||||
Call ExSQL(xado, xopenDB, xsql)
|
||||
|
||||
|
||||
|
||||
|
||||
'########## 진행상태 업데이트 ###################
|
||||
if not isnull(request.form("ffing")) then
|
||||
xsql=" update "&xTable&" set "
|
||||
xsql=xsql&" ffing='"&f_replace(request.form("ffing"),2)&"' "
|
||||
xsql=xsql&usql&" where "&ysql
|
||||
Call ExSQL(xado, xopenDB, xsql)
|
||||
end if
|
||||
|
||||
|
||||
'########## ffend(완료시간) 저장 ###################
|
||||
if not request.form("ffend")="0" then
|
||||
xsql=" update "&xTable&" set "
|
||||
xsql=xsql&" ffend=getdate() "
|
||||
xsql=xsql&usql&" where "&ysql
|
||||
Call ExSQL(xado, xopenDB, xsql)
|
||||
end if
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
'#######################
|
||||
|
||||
' 페이지 정보 저장
|
||||
sub f_pageSave(xado, xopenDB, xTable)
|
||||
|
||||
dim x, xsql, ysql, usql, xobjdb
|
||||
xsql=" update "&xTable&" set "
|
||||
xsql=xsql&" ffpage='"&ffnextpage&"' "
|
||||
xsql=xsql&",ffpagelog=ffpagelog+'#'+'"&ffnextpage&"' " '-- 분리자(#)
|
||||
xsql=xsql&",ffpagecount=ffpagecount+1 "
|
||||
xsql=xsql&" where ffid='"&f_replace(request.form("ffid"),2)&"' "
|
||||
xsql=xsql&" and fftype='"&f_replace(request.form("fftype"),2)&"' "
|
||||
Call ExSQL(xado, xopenDB, xsql)
|
||||
|
||||
end sub
|
||||
|
||||
'#######################
|
||||
|
||||
|
||||
|
||||
' ----------------------------------------------------------------------------------
|
||||
' ----------------------------------------------------------------------------------
|
||||
|
||||
|
||||
' 클레스 생성
|
||||
Sub clsOpen(mo)
|
||||
Set mo = new clsDBcomm
|
||||
End Sub
|
||||
|
||||
|
||||
' select 실행 : read only
|
||||
Sub RsSQL(clsN, mo_openDB, mo_sql, moobj)
|
||||
Set moobj = clsN.ExecSQLReturnRS(mo_sql, Nothing, Nothing,mo_openDB)
|
||||
End Sub
|
||||
|
||||
|
||||
' select 실행. : read update
|
||||
Sub RsSQL2(clsN, mo_openDB, mo_sql, moobj)
|
||||
Set moobj = clsN.ExecSQLReturnRS2(mo_sql, Nothing, Nothing,mo_openDB)
|
||||
End Sub
|
||||
|
||||
|
||||
' SQL 실행. : 리턴없음
|
||||
Sub ExSQL(clsN, mo_openDB, mo_sql)
|
||||
Call clsN.ExecSQL(mo_sql, Nothing, Nothing,mo_openDB)
|
||||
End Sub
|
||||
|
||||
|
||||
'연결종료
|
||||
Sub CloseSQL(mo)
|
||||
mo.Close
|
||||
Set mo = Nothing
|
||||
End Sub
|
||||
|
||||
' 클레스 종료
|
||||
Sub CloseCls(mo)
|
||||
mo.Dispose
|
||||
Set mo = Nothing
|
||||
End Sub
|
||||
|
||||
|
||||
' ----------------------------------------------------------------------------------
|
||||
' ----------------------------------------------------------------------------------
|
||||
|
||||
|
||||
%>
|
||||
18
Lib/infiles/ini.asp
Normal file
18
Lib/infiles/ini.asp
Normal file
@@ -0,0 +1,18 @@
|
||||
<!-- #include file="../Config.asp" -->
|
||||
<%
|
||||
' ---------- 연 결 -------------------------------------------------------------------
|
||||
' ----------------------------------------------------------------------------------
|
||||
|
||||
dim ksurvey, ksurvey2,ksurvey3, DBopener
|
||||
ksurvey = "Provider=SQLOLEDB;Server=1.235.195.34;Initial Catalog="&DB_NAME1&";uid="&UID1&";pwd="&PWD1&";" 'krc_survey db
|
||||
ksurvey2 = "Provider=SQLOLEDB;Server=1.235.195.34;Initial Catalog="&DB_NAME&";uid="&UID&";pwd="&PWD&";" 'capi db
|
||||
'ksurvey3 = "Provider=SQLOLEDB; Server=" & SV_NAME2 & ";Initial Catalog=" & DB_NAME2 & "; UID=" & UID2 & "; PWD=" & PWD2 ' ep_reruit
|
||||
|
||||
'ksurvey2 = "Provider=SQLOLEDB;Server=10.10.13.115;Initial Catalog="&DB_NAME&";uid="&UID1&";pwd="&PWD1&";" 'krc_survey db
|
||||
'ksurvey = "Provider=SQLOLEDB;Server=10.10.13.115;Initial Catalog="&DB_NAME1&";uid="&UID1&";pwd="&PWD1&";" 'krc_survey db
|
||||
'ksurvey2 = "Provider=SQLOLEDB;Server="&SV_NAME&";Initial Catalog="&DB_NAME&";uid=sa;pwd=dudgus25;" 'capi db
|
||||
'ksurvey = "Provider=SQLOLEDB;Server="&SV_NAME1&";Initial Catalog="&DB_NAME1&";uid=sa;pwd=dudgus25;" 'krc_survey db
|
||||
|
||||
' ----------------------------------------------------------------------------------
|
||||
' ----------------------------------------------------------------------------------
|
||||
%>
|
||||
19
Lib/infiles/ini_Copy.asp
Normal file
19
Lib/infiles/ini_Copy.asp
Normal file
@@ -0,0 +1,19 @@
|
||||
<!-- #include file="../Config.asp" -->
|
||||
<%
|
||||
' ---------- 연 결 -------------------------------------------------------------------
|
||||
' ----------------------------------------------------------------------------------
|
||||
|
||||
dim ksurvey, ksurvey2,ksurvey3, DBopener
|
||||
'ksurvey = "Provider=SQLOLEDB;Server=1.235.195.34;Initial Catalog="&DB_NAME1&";uid="&UID1&";pwd="&PWD1&";" 'krc_survey db
|
||||
ksurvey2 = "Provider=SQLOLEDB;Server=1.235.195.34;Initial Catalog="&DB_NAME&";uid="&UID&";pwd="&PWD&";" 'capi db
|
||||
ksurvey3 = "Provider=SQLOLEDB; Server=" & SV_NAME2 & ";Initial Catalog=" & DB_NAME2 & "; UID=" & UID2 & "; PWD=" & PWD2 ' ep_reruit
|
||||
|
||||
'ksurvey2 = "Provider=SQLOLEDB;Server="&SV_NAME&";Initial Catalog="&DB_NAME&";uid=sa;pwd=dudgus25;" 'capi db
|
||||
ksurvey = "Provider=SQLOLEDB;Server=10.10.13.115;Initial Catalog="&DB_NAME1&";uid=sa;pwd=dudgus25;" 'krc_survey db
|
||||
|
||||
'ksurvey2 = "Provider=SQLOLEDB;Server="&SV_NAME&";Initial Catalog="&DB_NAME&";uid=sa;pwd=dudgus25;" 'capi db
|
||||
'ksurvey = "Provider=SQLOLEDB;Server=10.10.13;Initial Catalog="&DB_NAME1&";uid=sa;pwd=dudgus25;" 'krc_survey db
|
||||
|
||||
' ----------------------------------------------------------------------------------
|
||||
' ----------------------------------------------------------------------------------
|
||||
%>
|
||||
91
Lib/infiles/krc_css.css
Normal file
91
Lib/infiles/krc_css.css
Normal file
@@ -0,0 +1,91 @@
|
||||
|
||||
#topMenu
|
||||
{/*topMenu<6E><75> ID<49><44> <20><><EFBFBD><EFBFBD> <20>±<EFBFBD><C2B1><EFBFBD> <20><>Ÿ<EFBFBD><C5B8> <20><><EFBFBD><EFBFBD>*/
|
||||
height: 30px;/*topMenu<6E><75> <20><><EFBFBD≯<EFBFBD> 30px<70><78> <20><><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ϸ<EFBFBD> <20>Ʒ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>)*/
|
||||
display:inline-block;
|
||||
}
|
||||
#topMenu ul
|
||||
{
|
||||
display:inline-block;
|
||||
border-radius : 5px;
|
||||
}
|
||||
#topMenu ul li
|
||||
{/* topMenu<6E><75> ID<49><44> <20><><EFBFBD><EFBFBD> <20>±<EFBFBD> <20>ȿ<EFBFBD> <ul> <20>±<EFBFBD> <20>ȿ<EFBFBD> <li> <20>±<EFBFBD><C2B1><EFBFBD> <20><>Ÿ<EFBFBD><C5B8><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> */
|
||||
list-style: none;/*<li> <20>±״<C2B1> <20><><EFBFBD><EFBFBD> <20>̹<EFBFBD><CCB9><EFBFBD>ó<EFBFBD><C3B3> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>Ÿ<EFBFBD><C5B8><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ش<EFBFBD> */
|
||||
color: black;/*<2A>۾<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> */
|
||||
background-color: #f8f8f8;/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> ȸ<><C8B8>(RGB(2D,2D,2D)<29><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> */
|
||||
float: left;/* <li><3E>±<C2B1><D7B5><EFBFBD> <20><><EFBFBD>ʿ<EFBFBD> <20>帣<EFBFBD><E5B8A3> <20><><EFBFBD><EFBFBD>(<28><EFBFBD><D7B7><EFBFBD> <20>Ʒ<EFBFBD><C6B7>ִ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>)*/
|
||||
line-height: 30px;/* <20>۾<EFBFBD><DBBE><EFBFBD> <20><><EFBFBD><EFBFBD><EEB5A5> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϱ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD≯<EFBFBD> 30px<70><78> <20><><EFBFBD><EFBFBD>*/
|
||||
vertical-align: middle;/*<2A><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EEB5A5> <20><><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD> line-height<68><74> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ʿ<EFBFBD><CABF><EFBFBD>) */
|
||||
text-align: center;/* <20>۾<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EEB5A5> <20><><EFBFBD><EFBFBD>*/
|
||||
border-radius : 5px;
|
||||
}
|
||||
|
||||
#topMenu .menuLink
|
||||
{/* topMenu <20><><EFBFBD>̵<EFBFBD><CCB5><EFBFBD> <20><><EFBFBD><EFBFBD> <20>±<EFBFBD> <20>ȿ<EFBFBD> <20>ִ<EFBFBD> menuLink Ŭ<><C5AC><EFBFBD><EFBFBD> <20>±<C2B1><D7B5><EFBFBD> <20><>Ÿ<EFBFBD><C5B8> <20><><EFBFBD><EFBFBD>*/
|
||||
text-decoration:none;/*<2A><>ũ(<a> <20>±<EFBFBD>)<29><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>⺻ <20>ٹ<EFBFBD> ȿ<><C8BF>(<28><><EFBFBD><EFBFBD> <20><>)<29><> <20><><EFBFBD><EFBFBD> */
|
||||
color: black;/*<2A><>Ʈ<EFBFBD><C6AE><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> */
|
||||
display: inline-block;/*<2A><>ũ<EFBFBD><C5A9> <20>۾<EFBFBD><DBBE><EFBFBD> <20>ִ<EFBFBD> <20>κ<EFBFBD> <20>Ӹ<EFBFBD><D3B8>ƴ϶<C6B4> <20><>ü <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ŭ<><C5AC><EFBFBD>ص<EFBFBD> <20><>ũ<EFBFBD><C5A9> <20>ɸ<EFBFBD><C9B8><EFBFBD> <20><><EFBFBD><EFBFBD> */
|
||||
width: 180px;/* <20><EFBFBD><DEB4><EFBFBD>ũ<EFBFBD><C5A9> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>*/
|
||||
font-family: Helvetica Neue,Helvetica,Arial,sans-serif;
|
||||
font-size: 17px;/*<2A><>Ʈ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 12px<70><78> <20><><EFBFBD><EFBFBD> */
|
||||
font-weight: bold;/*<2A><>Ʈ<EFBFBD><C6AE> <20><><EFBFBD><EFBFBD>*/
|
||||
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;/*<2A>⺻ <20><>Ʈ <20><><EFBFBD><EFBFBD>, <20>ý<EFBFBD><C3BD><EFBFBD> <20><>Ʈ<EFBFBD><C6AE> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
||||
border-radius : 5px;
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
#topMenu .menuLink:hover
|
||||
{/*topMenu <20><><EFBFBD>̵<EFBFBD><CCB5><EFBFBD> <20><><EFBFBD><EFBFBD> <20>±<EFBFBD> <20>ȿ<EFBFBD> menuLinkŬ<6B><C5AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>±<C2B1> <20><><EFBFBD>콺<EFBFBD><ECBDBA> over<65>Ǹ<EFBFBD> <20><>Ÿ<EFBFBD><C5B8> <20><><EFBFBD><EFBFBD> */
|
||||
color: White;/*<2A>۾<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> */
|
||||
background-color: #D9D9D9;/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> ȸ<><C8B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> */
|
||||
border-radius : 5px;
|
||||
}
|
||||
/*
|
||||
div#menubar
|
||||
{
|
||||
text-align:center;
|
||||
|
||||
padding: 24px;border:0px;
|
||||
|
||||
}
|
||||
|
||||
div#menubar > button{
|
||||
|
||||
font-family: Malgun Gothic,Gulim,Arial,Helvetica,sans-serif;
|
||||
|
||||
font-size: 18px;
|
||||
border:0px;
|
||||
font-weight:bold;
|
||||
|
||||
background: #CCCCCC;
|
||||
|
||||
padding: 12px 20px;
|
||||
|
||||
color: #FFFFFF;
|
||||
|
||||
margin-right: 10px;
|
||||
|
||||
text-decoration: none;
|
||||
|
||||
border-radius:5px;
|
||||
|
||||
|
||||
}
|
||||
|
||||
div#menubar > button > i{
|
||||
|
||||
|
||||
font-weight:bold;
|
||||
|
||||
|
||||
}
|
||||
|
||||
div#menubar > button:hover{
|
||||
|
||||
background: #FFFFFF;
|
||||
|
||||
color: #AAA9A9;
|
||||
|
||||
}
|
||||
*/
|
||||
486
Lib/infiles/valueck.js
Normal file
486
Lib/infiles/valueck.js
Normal file
@@ -0,0 +1,486 @@
|
||||
|
||||
|
||||
function form_check(form, fields) {
|
||||
var lah = new ckForm(form);
|
||||
if (fields) lah.setCheckFields(fields);
|
||||
var wmf = lah.go();
|
||||
if (wmf == false) alert(lah.getErrorMessage());
|
||||
return wmf;
|
||||
}
|
||||
|
||||
ckForm = function(form) {
|
||||
this.FUNC_MAP = {
|
||||
|
||||
// 특정응답값 로직체크..
|
||||
email : "this.func_email",
|
||||
hangul : "this.func_hangul",
|
||||
engonly : "this.func_engonly",
|
||||
number : "this.func_number"
|
||||
/*
|
||||
residentno: "this.func_residentno", // 주민번호 체크 미사용
|
||||
jumin : "this.func_jumin", // 주민번호 체크 미사용
|
||||
foreignerno:"this.func_foreignerno",
|
||||
bizno : "this.func_bizno",
|
||||
phone : "this.func_phone",
|
||||
homephone : "this.func_homephone",
|
||||
handphone : "this.func_handphone"
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
this.ERR_MSG = {
|
||||
// 에러메세지..
|
||||
system : "ckForm Error: ",
|
||||
ck : "응답하지 않은 문항이 있습니다 ",
|
||||
ckuirenum:"이 항목들 중에 {ckuirenum}개 이상의 항목이 입력되어야 합니다.",
|
||||
notequal : "입력된 내용이 일치하지 않습니다.",
|
||||
invalid : "입력된 내용이 형식에 어긋납니다.",
|
||||
minbyte : "입력된 내용의 길이가 {minbyte}Byte 이상이어야 합니다.",
|
||||
maxbyte : "입력된 내용의 길이가 {maxbyte}Byte를 초과할 수 없습니다.",
|
||||
mincheck : "{mincheck}개의 항목이상으로 선택하세요.",
|
||||
maxcheck : "{maxcheck}개의 항목이하로 선택하세요.",
|
||||
minselect: "{minselect}개의 항목이상으로 선택하세요.",
|
||||
maxselect: "{maxselect}개의 항목이하로 선택하세요.",
|
||||
imageonly: "이미지 파일만 첨부할 수 있습니다."
|
||||
}
|
||||
this.ERR_DO = {
|
||||
// 포커스 구분...
|
||||
text : "select focus",
|
||||
select : "focus",
|
||||
check : "focus",
|
||||
radio : "focus",
|
||||
file : "focus",
|
||||
hidden : ""
|
||||
}
|
||||
this.ERR_SYS = '_SYSERR_';
|
||||
this.fields = form.elements;
|
||||
this.form = form;
|
||||
this.errMsg = "";
|
||||
}
|
||||
|
||||
ckForm.prototype.setForm = function(form) {
|
||||
this.form = form;
|
||||
}
|
||||
|
||||
ckForm.prototype.setFunc = function(map, func) {
|
||||
if (typeof(this.FUNC_MAP[map]) == "string") return;
|
||||
this.FUNC_MAP[map] = func;
|
||||
}
|
||||
|
||||
ckForm.prototype.setCheckFields = function(fields) {
|
||||
this.fields = [];
|
||||
if(typeof(fields) == 'string')
|
||||
// 단일
|
||||
if(this.form.elements[fields].disabled=="false"){
|
||||
this.fields = [this.form.elements[fields]];
|
||||
}
|
||||
else
|
||||
//멀티
|
||||
for(var i=0, s=fields.length; i<s; i++){
|
||||
if(this.form.elements[fields[i]].disabled=="false"){
|
||||
this.fields[this.fields.length] = this.form.elements[fields[i]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ckForm.prototype.setUnCheckFields = function(fields) {
|
||||
this.fields = [];
|
||||
var _isUnCheckEl;
|
||||
|
||||
if(typeof(fields) == 'string')
|
||||
fields = [fields];
|
||||
for (var i=0, s=this.form.elements.length; i<s; i++) {
|
||||
_isUnCheckEl = false;
|
||||
for (var j=0, t=fields.length; j<t; j++) {
|
||||
if (this.form.elements[i] == this.form.elements[fields[j]]) {
|
||||
_isUnCheckEl = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!_isUnCheckEl) this.fields[this.fields.length] = this.form.elements[i];
|
||||
}
|
||||
}
|
||||
|
||||
ckForm.prototype.setParam = function(el, name, value) {
|
||||
el.setAttribute(name, value);
|
||||
}
|
||||
|
||||
ckForm.prototype.delParam = function(el, name) {
|
||||
el.removeAttribute(name);
|
||||
}
|
||||
|
||||
ckForm.prototype.go = function() {
|
||||
for (var i=0,s=this.fields.length; i<s; i++) {
|
||||
var el = this.fields[i];
|
||||
if (!this.isValidElement(el)) continue;
|
||||
|
||||
var elType = this.getType(el);
|
||||
var trim = el.getAttribute("TRIM");
|
||||
var ck = el.getAttribute("ck");
|
||||
var ckuirenum = el.getAttribute("ckUIRENUM");
|
||||
var minbyte = parseInt(el.getAttribute("MINBYTE"),10);
|
||||
var maxbyte = parseInt(el.getAttribute("MAXBYTE"),10);
|
||||
var mincheck = parseInt(el.getAttribute("MINCHECK"),10);
|
||||
var maxcheck = parseInt(el.getAttribute("MAXCHECK"),10);
|
||||
var minselect = parseInt(el.getAttribute("MINSELECT"),10);
|
||||
var maxselect = parseInt(el.getAttribute("MAXSELECT"),10);
|
||||
var option = el.getAttribute("OPTION");
|
||||
var match = el.getAttribute("MATCH");
|
||||
var span = el.getAttribute("SPAN");
|
||||
var glue = el.getAttribute("GLUE");
|
||||
var pattern = el.getAttribute("PATTERN");
|
||||
var imageonly = el.getAttribute("IMAGEONLY");
|
||||
|
||||
if (trim != null && (elType == "text" || elType == "hidden")) {
|
||||
switch (trim) {
|
||||
case "trim":
|
||||
el.value = el.value.replace(/^\s+/, "").replace(/\s+$/, "");
|
||||
break;
|
||||
case "compress":
|
||||
el.value = el.value.replace(/\s+/, "");
|
||||
break;
|
||||
case "ltrim":
|
||||
el.value = el.value.replace(/^\s+/, "");
|
||||
break;
|
||||
case "rtrim":
|
||||
el.value = el.value.replace(/\s+$/, "");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var elEmpty = this.isEmpty(el, elType);
|
||||
|
||||
if (ck != null) {
|
||||
if (ck == "ck") {
|
||||
if (elEmpty) return this.raiseError(el, "ck");
|
||||
} else {
|
||||
ckuirenum = parseInt(ckuirenum, 10);
|
||||
var _num = 0;
|
||||
var _name = [];
|
||||
if (ckuirenum > 0) {
|
||||
for (var j=0; j<this.form.elements.length; j++) {
|
||||
var _el = this.form.elements[j];
|
||||
if (ck == _el.getAttribute("ck")) {
|
||||
if(!this.isEmpty(_el, this.getType(_el))) _num++;
|
||||
_name[_name.length] = this.getName(_el);
|
||||
}
|
||||
}
|
||||
if(_num < ckuirenum)
|
||||
return this.raiseError(el, "ckuirenum", _name.join(", "));
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((minbyte > 0 || maxbyte > 0) && (elType == "text" || elType == "hidden")) {
|
||||
var _tmp = el.value;
|
||||
var _len = el.value.length;
|
||||
for (j=0; j<_tmp.length; j++) {
|
||||
if (_tmp.charCodeAt(j) > 128) _len++;
|
||||
}
|
||||
if (minbyte > 0 && _len < minbyte) return this.raiseError(el, "minbyte");
|
||||
if (maxbyte > 0 && _len > maxbyte) return this.raiseError(el, "maxbyte");
|
||||
}
|
||||
if (match != null && elType != "file") {
|
||||
if (typeof this.form.elements[match] == "undefined")
|
||||
return this.raiseError(this.ERR_SYS, "Element '"+ match +"' is not found.");
|
||||
else if (el.value != this.form.elements[match].value)
|
||||
return this.raiseError(el, "notequal");
|
||||
}
|
||||
if (option != null && !elEmpty && elType != "file") {
|
||||
var _options = option.split(" ");
|
||||
for (var j in _options) {
|
||||
var _func = eval(this.FUNC_MAP[_options[j]]);
|
||||
if (span != null) {
|
||||
var _value = [];
|
||||
for (var k=0; k<parseInt(span,10); k++) {
|
||||
try {
|
||||
_value[k] = this.fields[i+k].value;
|
||||
} catch (e) {
|
||||
return this.raiseError(this.ERR_SYS, (i+k) +"th Element is not found.");
|
||||
}
|
||||
}
|
||||
try {
|
||||
var _result = _func(el, _value.join(glue == null ? "" : glue));
|
||||
} catch (e) {
|
||||
return this.raiseError(this.ERR_SYS, "function map '"+ _options[j] +"' is not exist.");
|
||||
}
|
||||
if (_result !== true) return this.raiseError(el, _result);
|
||||
} else {
|
||||
try {
|
||||
var _result = _func(el);
|
||||
} catch (e) {
|
||||
return this.raiseError(this.ERR_SYS, "function map '"+ _options[j] +"' is not exist.");
|
||||
}
|
||||
if (_result !== true) return this.raiseError(el, _result);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pattern != null && !elEmpty && elType != "file") {
|
||||
try {
|
||||
pattern = new RegExp(pattern);
|
||||
} catch (e) {
|
||||
return this.raiseError(this.ERR_SYS, "Invalid Regular Expression '"+ pattern +"'");
|
||||
}
|
||||
if (!pattern.test(el.value)) return this.raiseError(el, "invalid");
|
||||
}
|
||||
if ((mincheck > 0 || maxcheck > 0) && elType == "check") {
|
||||
var _checks = this.form.elements[el.name];
|
||||
var _num = 0;
|
||||
if (typeof _checks.length != "undefined") {
|
||||
for (var j=0; j<_checks.length; j++) {
|
||||
if (_checks[j].checked) _num++;
|
||||
}
|
||||
} else {
|
||||
if (_checks.checked) _num++;
|
||||
}
|
||||
if (mincheck > 0 && _num < mincheck) return this.raiseError(el, "mincheck");
|
||||
if (maxcheck > 0 && _num > maxcheck) return this.raiseError(el, "maxcheck");
|
||||
}
|
||||
if ((minselect > 0 || maxselect > 0) && elType == "multiselect") {
|
||||
var _num = 0;
|
||||
for (var j=0; j<el.options.length; j++) {
|
||||
if (el.options[j].selected) _num++;
|
||||
}
|
||||
if (minselect > 0 && _num < minselect) return this.raiseError(el, "minselect");
|
||||
if (maxselect > 0 && _num > maxselect) return this.raiseError(el, "maxselect");
|
||||
}
|
||||
if (imageonly != null && elType == "file") {
|
||||
var fn = el.value;
|
||||
if (fn != "") {
|
||||
var dotIndex = fn.lastIndexOf(".");
|
||||
var ext = fn.substring(dotIndex+1).toLowerCase();
|
||||
if(ext != "jpg" && ext != "jpeg" && ext != "gif" && ext != "png")
|
||||
return this.raiseError(el, "imageonly");
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
ckForm.prototype.isValidElement = function(el) {
|
||||
return el.name && el.tagName.match(/^input|select|textarea$/i) && !el.disabled;
|
||||
}
|
||||
|
||||
ckForm.prototype.isEmpty = function(el, type) {
|
||||
switch (type) {
|
||||
case "file": case "text": case "hidden":
|
||||
if (el.value == null || el.value == "") return true;
|
||||
break;
|
||||
case "select": case "multiselect":
|
||||
if (el.selectedIndex == -1 || el[el.selectedIndex].value == null ||
|
||||
el[el.selectedIndex].value == "")
|
||||
return true;
|
||||
break;
|
||||
case "check": case "radio":
|
||||
var elCheck = this.form.elements[el.name];
|
||||
var elChecked = false;
|
||||
if (typeof elCheck.length != "undefined") {
|
||||
for (var j=0; j<elCheck.length; j++) {
|
||||
if (elCheck[j].checked == true) elChecked = true;
|
||||
}
|
||||
} else {
|
||||
if (elCheck.checked == true) elChecked = true;
|
||||
}
|
||||
if (elChecked == false) return true;
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
ckForm.prototype.getType = function(el) {
|
||||
switch (el.tagName.toLowerCase()) {
|
||||
case "select":
|
||||
return el.multiple == true ? "multiselect" : "select";
|
||||
case "textarea": return "text";
|
||||
case "input":
|
||||
switch (el.type.toLowerCase()) {
|
||||
case "radio": return "radio";
|
||||
case "checkbox": return "check";
|
||||
case "file": return "file";
|
||||
case "text": case "password": return "text";
|
||||
case "hidden": return "hidden";
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ckForm.prototype.raiseError = function(el, type, elName) {
|
||||
if (el == this.ERR_SYS) {
|
||||
this.errMsg = this.ERR_MSG["system"] + type;
|
||||
return false;
|
||||
}
|
||||
var pattern = /\{([a-zA-Z0-9_]+)\}/i;
|
||||
var msg = this.ERR_MSG[type] ? this.ERR_MSG[type] : type;
|
||||
var elType = this.getType(el);
|
||||
var elName = elName ? elName : this.getName(el);
|
||||
var errDo = el.getAttribute("ERRDO") ? el.getAttribute("ERRDO") : this.ERR_DO[elType];
|
||||
var _errDos = errDo ? errDo.split(" ") : [];
|
||||
|
||||
if (el.getAttribute("ERRMSG") != null) msg = el.getAttribute("ERRMSG");
|
||||
if (pattern.test(msg) == true) {
|
||||
while (pattern.exec(msg)) msg = msg.replace(pattern, el.getAttribute(RegExp.$1));
|
||||
}
|
||||
for (var i in _errDos) {
|
||||
switch (_errDos[i]) {
|
||||
case "delete": el.value = ""; break;
|
||||
case "select": el.select(); break;
|
||||
case "focus": el.focus(); break;
|
||||
}
|
||||
}
|
||||
//----------------- h
|
||||
|
||||
// 경고문(alert) 등록시. ex( halt="체크박스 버튼을 체크해 주세요" )
|
||||
if(!(el.getAttribute("HALT") == null || el.getAttribute("HALT") == "")){
|
||||
this.errMsg = ""+el.getAttribute("HALT") +"\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// nname 인자가 없는경우 메세지 ex(nname="" : 메세지 --> this.ERR_MSG )
|
||||
if(el.getAttribute("rname") == null || el.getAttribute("rname") == ""){
|
||||
this.errMsg = ""+msg +"\n";
|
||||
return false;
|
||||
}else{
|
||||
// this.errMsg = "["+ elName +"]\n\n- "+ msg +"\n";
|
||||
this.errMsg = ""+msg +"\n";
|
||||
return false;
|
||||
}
|
||||
//------------------- h
|
||||
|
||||
}
|
||||
|
||||
ckForm.prototype.getErrorMessage = function() {
|
||||
return this.errMsg;
|
||||
}
|
||||
|
||||
ckForm.prototype.getName = function(el) {
|
||||
return el.getAttribute("rname") == null || el.getAttribute("rname") == ""
|
||||
? el.name : el.getAttribute("rname");
|
||||
}
|
||||
/**
|
||||
* validate functions
|
||||
*/
|
||||
ckForm.prototype.func_email = function(el,value) {
|
||||
var value = value ? value : el.value;
|
||||
var pattern = /^[_a-zA-Z0-9-\.]+@[\.a-zA-Z0-9-]+\.[a-zA-Z]+$/;
|
||||
return pattern.test(value) ? true : "invalid";
|
||||
}
|
||||
|
||||
ckForm.prototype.func_hangul = function(el) {
|
||||
var pattern = /[가-힝]/;
|
||||
return pattern.test(el.value) ? true : "반드시 한글을 포함해야 합니다";
|
||||
}
|
||||
|
||||
ckForm.prototype.func_engonly = function(el) {
|
||||
var pattern = /^[a-zA-Z]+$/;
|
||||
return pattern.test(el.value) ? true : "invalid";
|
||||
}
|
||||
|
||||
ckForm.prototype.func_number = function(el) {
|
||||
var pattern = /^[0-9]+$/;
|
||||
return pattern.test(el.value) ? true : "반드시 숫자로만 입력해야 합니다";
|
||||
}
|
||||
|
||||
/*
|
||||
ckForm.prototype.func_residentno = function(el,value) {
|
||||
var pattern = /^(\d{6})-?(\d{5}(\d{1})\d{1})$/;
|
||||
var num = value ? value : el.value;
|
||||
if (!pattern.test(num)) return "invalid";
|
||||
num = RegExp.$1 + RegExp.$2;
|
||||
if (RegExp.$3 == 7 || RegExp.$3 == 8 || RegExp.$4 == 9)
|
||||
if ((num[7]*10 + num[8]) %2) return "invalid";
|
||||
|
||||
var sum = 0;
|
||||
var last = num.charCodeAt(12) - 0x30;
|
||||
var bases = "234567892345";
|
||||
for (var i=0; i<12; i++) {
|
||||
if (isNaN(num.substring(i,i+1))) return "invalid";
|
||||
sum += (num.charCodeAt(i) - 0x30) * (bases.charCodeAt(i) - 0x30);
|
||||
}
|
||||
var mod = sum % 11;
|
||||
if(RegExp.$3 == 7 || RegExp.$3 == 8 || RegExp.$4 == 9)
|
||||
return (11 - mod + 2) % 10 == last ? true : "invalid";
|
||||
else
|
||||
return (11 - mod) % 10 == last ? true : "invalid";
|
||||
}
|
||||
*/
|
||||
/*
|
||||
ckForm.prototype.func_jumin = function(el,value) {
|
||||
var pattern = /^([0-9]{6})-?([0-9]{7})$/;
|
||||
var num = value ? value : el.value;
|
||||
if (!pattern.test(num)) return "invalid";
|
||||
num = RegExp.$1 + RegExp.$2;
|
||||
|
||||
var sum = 0;
|
||||
var last = num.charCodeAt(12) - 0x30;
|
||||
var bases = "234567892345";
|
||||
for (var i=0; i<12; i++) {
|
||||
if (isNaN(num.substring(i,i+1))) return "invalid";
|
||||
sum += (num.charCodeAt(i) - 0x30) * (bases.charCodeAt(i) - 0x30);
|
||||
}
|
||||
var mod = sum % 11;
|
||||
return (11 - mod) % 10 == last ? true : "invalid";
|
||||
}
|
||||
*/
|
||||
/*
|
||||
ckForm.prototype.func_foreignerno = function(el,value) {
|
||||
var pattern = /^(\d{6})-?(\d{5}[7-9]\d{1})$/;
|
||||
var num = value ? value : el.value;
|
||||
if (!pattern.test(num)) return "invalid";
|
||||
num = RegExp.$1 + RegExp.$2;
|
||||
if ((num[7]*10 + num[8]) %2) return "invalid";
|
||||
|
||||
var sum = 0;
|
||||
var last = num.charCodeAt(12) - 0x30;
|
||||
var bases = "234567892345";
|
||||
for (var i=0; i<12; i++) {
|
||||
if (isNaN(num.substring(i,i+1))) return "invalid";
|
||||
sum += (num.charCodeAt(i) - 0x30) * (bases.charCodeAt(i) - 0x30);
|
||||
}
|
||||
var mod = sum % 11;
|
||||
return (11 - mod + 2) % 10 == last ? true : "invalid";
|
||||
}
|
||||
*/
|
||||
/*
|
||||
ckForm.prototype.func_bizno = function(el,value) {
|
||||
var pattern = /([0-9]{3})-?([0-9]{2})-?([0-9]{5})/;
|
||||
var num = value ? value : el.value;
|
||||
if (!pattern.test(num)) return "invalid";
|
||||
num = RegExp.$1 + RegExp.$2 + RegExp.$3;
|
||||
var cVal = 0;
|
||||
for (var i=0; i<8; i++) {
|
||||
var cKeyNum = parseInt(((_tmp = i % 3) == 0) ? 1 : ( _tmp == 1 ) ? 3 : 7);
|
||||
cVal += (parseFloat(num.substring(i,i+1)) * cKeyNum) % 10;
|
||||
}
|
||||
var li_temp = parseFloat(num.substring(i,i+1)) * 5 + "0";
|
||||
cVal += parseFloat(li_temp.substring(0,1)) + parseFloat(li_temp.substring(1,2));
|
||||
return parseInt(num.substring(9,10)) == 10-(cVal % 10)%10 ? true : "invalid";
|
||||
}
|
||||
*/
|
||||
/*
|
||||
ckForm.prototype.func_phone = function(el,value) {
|
||||
var pattern = /^(0[2-8][0-5]?|01[01346-9])-?([1-9]{1}[0-9]{2,3})-?([0-9]{4})$/;
|
||||
var pattern15xx = /^(1544|1566|1577|1588|1644|1688)-?([0-9]{4})$/;
|
||||
var num = value ? value : el.value;
|
||||
return pattern.exec(num) || pattern15xx.exec(num) ? true : "invalid";
|
||||
}
|
||||
|
||||
ckForm.prototype.func_homephone = function(el,value) {
|
||||
var pattern = /^(0[2-8][0-5]?)-?([1-9]{1}[0-9]{2,3})-?([0-9]{4})$/;
|
||||
var pattern15xx = /^(1544|1566|1577|1588|1644|1688)-?([0-9]{4})$/;
|
||||
var num = value ? value : el.value;
|
||||
return pattern.exec(num) || pattern15xx.exec(num) ? true : "invalid";
|
||||
}
|
||||
|
||||
ckForm.prototype.func_handphone = function(el,value) {
|
||||
var pattern = /^(01[01346-9])-?([1-9]{1}[0-9]{2,3})-?([0-9]{4})$/;
|
||||
var num = value ? value : el.value;
|
||||
return pattern.exec(num) ? true : "invalid";
|
||||
}
|
||||
*/
|
||||
869
Lib/json2.asp
Normal file
869
Lib/json2.asp
Normal file
@@ -0,0 +1,869 @@
|
||||
<script language="Javascript" runat="server">
|
||||
|
||||
/*
|
||||
|
||||
File: json2.asp
|
||||
|
||||
AXE(ASP Xtreme Evolution) JSON parser based on Douglas Crockford json2.js.
|
||||
|
||||
This class is the result of Classic ASP JSON topic revisited by Fabio Zendhi
|
||||
Nagao (nagaozen). JSON2.ASP is a better option over JSON.ASP because it embraces
|
||||
the AXE philosophy of real collaboration over the languages. It works under the
|
||||
original json parser, so this class is strict in the standard rules, it also
|
||||
brings more of the Javascript json feeling to other ASP languages (eg. no more
|
||||
oJson.getElement("foo") stuff, just oJson.foo and you get it).
|
||||
|
||||
License:
|
||||
|
||||
This file is part of ASP Xtreme Evolution.
|
||||
Copyright (C) 2007-2012 Fabio Zendhi Nagao
|
||||
|
||||
ASP Xtreme Evolution is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ASP Xtreme Evolution is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with ASP Xtreme Evolution. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Class: JSON
|
||||
|
||||
JSON (Javascript Object Notation) is a lightweight data-interchange format. It
|
||||
is easy for humans to read and write. It is easy for machines to parse and
|
||||
generate. It is based on a subset of the Javascript Programming Language,
|
||||
Standard ECMA-262 3rd Edition - December 1999. JSON is a text format that is
|
||||
completely language independent but uses conventions that are familiar to
|
||||
programmers of the C-family of languages, including C, C++, C#, Java,
|
||||
Javascript, Perl, Python, and many others. These properties make JSON an ideal
|
||||
data-interchange language.
|
||||
|
||||
Notes:
|
||||
|
||||
- Javascript extensions concept inspired by Troy Foster JSON2.ASP work <http://tforster.wik.is/ASP_Classic_Practices_For_The_21st_Century/JSON4ASP>.
|
||||
- Javascript JSON parser is the Douglas Crockford json2.js <http://www.JSON.org/json2.js>, without the first line alert(...) and fixing "this.JSON = {};" to "JSON = {};" to make it JScript compatible.
|
||||
- Javascript JSON.toXML is based on the Prof. Stefan Gössner "Converting Between XML and JSON" pragmatic approach <http://www.xml.com/pub/a/2006/05/31/converting-between-xml-and-json.html>.
|
||||
|
||||
About:
|
||||
|
||||
- Written by Fabio Zendhi Nagao <http://zend.lojcomm.com.br/> @ August 2010
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Function: parse
|
||||
|
||||
This method parses a JSON text to produce an object or array. It can throw a SyntaxError exception.
|
||||
|
||||
Parameters:
|
||||
|
||||
(string) - Valid JSON text.
|
||||
|
||||
Returns:
|
||||
|
||||
(mixed) - a Javascript value, usually an object or array.
|
||||
|
||||
Example:
|
||||
|
||||
(start code)
|
||||
|
||||
dim Info : set Info = JSON.parse(join(array( _
|
||||
"{", _
|
||||
" ""firstname"": ""Fabio"",", _
|
||||
" ""lastname"": ""長尾"",", _
|
||||
" ""alive"": true,", _
|
||||
" ""age"": 27,", _
|
||||
" ""nickname"": ""nagaozen"",", _
|
||||
" ""fruits"": [", _
|
||||
" ""banana"",", _
|
||||
" ""orange"",", _
|
||||
" ""apple"",", _
|
||||
" ""papaya"",", _
|
||||
" ""pineapple""", _
|
||||
" ],", _
|
||||
" ""complex"": {", _
|
||||
" ""real"": 1,", _
|
||||
" ""imaginary"": 2", _
|
||||
" }", _
|
||||
"}" _
|
||||
)))
|
||||
|
||||
Response.write(Info.firstname & vbNewline) ' prints Fabio
|
||||
Response.write(Info.alive & vbNewline) ' prints True
|
||||
Response.write(Info.age & vbNewline) ' prints 27
|
||||
Response.write(Info.fruits.get(0) & vbNewline) ' prints banana
|
||||
Response.write(Info.fruits.get(1) & vbNewline) ' prints orange
|
||||
Response.write(Info.complex.real & vbNewline) ' prints 1
|
||||
Response.write(Info.complex.imaginary & vbNewline) ' prints 2
|
||||
|
||||
' You can also enumerate object properties ...
|
||||
|
||||
dim key : for each key in Info.keys()
|
||||
Response.write( key & vbNewline )
|
||||
next
|
||||
|
||||
' which prints:
|
||||
|
||||
' firstname
|
||||
' lastname
|
||||
' alive
|
||||
' age
|
||||
' nickname
|
||||
' fruits
|
||||
' complex
|
||||
|
||||
set Info = nothing
|
||||
|
||||
(end code)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Function: stringify
|
||||
|
||||
This method produces a JSON text from a Javascript value.
|
||||
|
||||
Parameters:
|
||||
|
||||
(mixed) - any Javascript value, usually an object or array.
|
||||
(mixed) - an optional parameter that determines how object values are stringified for objects. It can be a function or an array of strings.
|
||||
(mixed) - an optional parameter that specifies the indentation of nested structures. If it is omitted, the text will be packed without extra whitespace. If it is a number, it will specify the number of spaces to indent at each level. If it is a string (such as '\t' or ' '), it contains the characters used to indent at each level.
|
||||
|
||||
Returns:
|
||||
|
||||
(string) - a string that contains the serialized JSON text.
|
||||
|
||||
Example:
|
||||
|
||||
(start code)
|
||||
|
||||
dim Info : set Info = JSON.parse("{""firstname"":""Fabio"", ""lastname"":""長尾""}")
|
||||
Info.set "alive", true
|
||||
Info.set "age", 27
|
||||
Info.set "nickname", "nagaozen"
|
||||
Info.set "fruits", array("banana","orange","apple","papaya","pineapple")
|
||||
Info.set "complex", JSON.parse("{""real"":1, ""imaginary"":1}")
|
||||
|
||||
Response.write( JSON.stringify(Info, null, 2) & vbNewline ) ' prints the text below:
|
||||
'{
|
||||
' "firstname": "Fabio",
|
||||
' "lastname": "長尾",
|
||||
' "alive": true,
|
||||
' "age": 27,
|
||||
' "nickname": "nagaozen",
|
||||
' "fruits": [
|
||||
' "banana",
|
||||
' "orange",
|
||||
' "apple",
|
||||
' "papaya",
|
||||
' "pineapple"
|
||||
' ],
|
||||
' "complex": {
|
||||
' "real": 1,
|
||||
' "imaginary": 1
|
||||
' }
|
||||
'}
|
||||
|
||||
set Info = nothing
|
||||
|
||||
(end code)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Function: toXML
|
||||
|
||||
This method produces a XML text from a Javascript value.
|
||||
|
||||
Parameters:
|
||||
|
||||
(mixed) - any Javascript value, usually an object or array.
|
||||
(string) - an optional parameter that determines what tag should be used as a container for the output. Defaults to none.
|
||||
|
||||
Returns:
|
||||
|
||||
(string) - a string that contains the serialized XML text.
|
||||
|
||||
Example:
|
||||
|
||||
(start code)
|
||||
|
||||
dim Info : set Info = JSON.parse("{""firstname"":""Fabio"", ""lastname"":""長尾""}")
|
||||
Info.set "alive", true
|
||||
Info.set "age", 27
|
||||
Info.set "nickname", "nagaozen"
|
||||
Info.set "fruits", array("banana","orange","apple","papaya","pineapple")
|
||||
Info.set "complex", JSON.parse("{""real"":1, ""imaginary"":1}")
|
||||
|
||||
Response.write( JSON.toXML(Info) & vbNewline ) ' prints the text below:
|
||||
'<firstname>Fabio</firstname>
|
||||
'<lastname>長尾</lastname>
|
||||
'<alive>true</alive>
|
||||
'<age>27</age>
|
||||
'<nickname>nagaozen</nickname>
|
||||
'<fruits>banana</fruits>
|
||||
'<fruits>orange</fruits>
|
||||
'<fruits>apple</fruits>
|
||||
'<fruits>papaya</fruits>
|
||||
'<fruits>pineapple</fruits>
|
||||
'<complex>
|
||||
' <real>1</real>
|
||||
' <imaginary>1</imaginary>
|
||||
'</complex>
|
||||
|
||||
set Info = nothing
|
||||
|
||||
(end code)
|
||||
|
||||
*/
|
||||
|
||||
if(!Object.prototype.get) {
|
||||
Object.prototype.get = function(k) {
|
||||
return this[k];
|
||||
}
|
||||
}
|
||||
|
||||
if(!Object.prototype.set) {
|
||||
Object.prototype.set = function(k,v) {
|
||||
if(typeof(v) == "unknown") {
|
||||
try {
|
||||
v = (new VBArray(v)).toArray();
|
||||
} catch(e) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
this[k] = v;
|
||||
}
|
||||
}
|
||||
|
||||
if(!Object.prototype.purge) {
|
||||
Object.prototype.purge = function(k) {
|
||||
delete this[k];
|
||||
}
|
||||
}
|
||||
|
||||
if(!Object.prototype.keys) {
|
||||
Object.prototype.keys = function() {
|
||||
var d = new ActiveXObject("Scripting.Dictionary");
|
||||
for(var key in this) {
|
||||
if(this.hasOwnProperty(key)) {
|
||||
d.add(key, null);
|
||||
}
|
||||
}
|
||||
return d.keys();
|
||||
}
|
||||
}
|
||||
|
||||
if(!String.prototype.sanitize) {
|
||||
String.prototype.sanitize = function(a, b) {
|
||||
var len = a.length,
|
||||
s = this;
|
||||
if(len !== b.length) throw new TypeError('Invalid procedure call. Both arrays should have the same size.');
|
||||
for(var i = 0; i < len; i++) {
|
||||
var re = new RegExp(a[i],'g');
|
||||
s = s.replace(re, b[i]);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
||||
if(!String.prototype.substitute) {
|
||||
String.prototype.substitute = function(object, regexp){
|
||||
return this.replace(regexp || (/\\?\{([^{}]+)\}/g), function(match, name){
|
||||
if (match.charAt(0) == '\\') return match.slice(1);
|
||||
return (object[name] != undefined) ? object[name] : '';
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
json2.js
|
||||
2011-10-19
|
||||
|
||||
Public Domain.
|
||||
|
||||
NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
|
||||
|
||||
See http://www.JSON.org/js.html
|
||||
|
||||
|
||||
This code should be minified before deployment.
|
||||
See http://javascript.crockford.com/jsmin.html
|
||||
|
||||
USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
|
||||
NOT CONTROL.
|
||||
|
||||
|
||||
This file creates a global JSON object containing two methods: stringify
|
||||
and parse.
|
||||
|
||||
JSON.stringify(value, replacer, space)
|
||||
value any JavaScript value, usually an object or array.
|
||||
|
||||
replacer an optional parameter that determines how object
|
||||
values are stringified for objects. It can be a
|
||||
function or an array of strings.
|
||||
|
||||
space an optional parameter that specifies the indentation
|
||||
of nested structures. If it is omitted, the text will
|
||||
be packed without extra whitespace. If it is a number,
|
||||
it will specify the number of spaces to indent at each
|
||||
level. If it is a string (such as '\t' or ' '),
|
||||
it contains the characters used to indent at each level.
|
||||
|
||||
This method produces a JSON text from a JavaScript value.
|
||||
|
||||
When an object value is found, if the object contains a toJSON
|
||||
method, its toJSON method will be called and the result will be
|
||||
stringified. A toJSON method does not serialize: it returns the
|
||||
value represented by the name/value pair that should be serialized,
|
||||
or undefined if nothing should be serialized. The toJSON method
|
||||
will be passed the key associated with the value, and this will be
|
||||
bound to the value
|
||||
|
||||
For example, this would serialize Dates as ISO strings.
|
||||
|
||||
Date.prototype.toJSON = function (key) {
|
||||
function f(n) {
|
||||
// Format integers to have at least two digits.
|
||||
return n < 10 ? '0' + n : n;
|
||||
}
|
||||
|
||||
return this.getUTCFullYear() + '-' +
|
||||
f(this.getUTCMonth() + 1) + '-' +
|
||||
f(this.getUTCDate()) + 'T' +
|
||||
f(this.getUTCHours()) + ':' +
|
||||
f(this.getUTCMinutes()) + ':' +
|
||||
f(this.getUTCSeconds()) + 'Z';
|
||||
};
|
||||
|
||||
You can provide an optional replacer method. It will be passed the
|
||||
key and value of each member, with this bound to the containing
|
||||
object. The value that is returned from your method will be
|
||||
serialized. If your method returns undefined, then the member will
|
||||
be excluded from the serialization.
|
||||
|
||||
If the replacer parameter is an array of strings, then it will be
|
||||
used to select the members to be serialized. It filters the results
|
||||
such that only members with keys listed in the replacer array are
|
||||
stringified.
|
||||
|
||||
Values that do not have JSON representations, such as undefined or
|
||||
functions, will not be serialized. Such values in objects will be
|
||||
dropped; in arrays they will be replaced with null. You can use
|
||||
a replacer function to replace those with JSON values.
|
||||
JSON.stringify(undefined) returns undefined.
|
||||
|
||||
The optional space parameter produces a stringification of the
|
||||
value that is filled with line breaks and indentation to make it
|
||||
easier to read.
|
||||
|
||||
If the space parameter is a non-empty string, then that string will
|
||||
be used for indentation. If the space parameter is a number, then
|
||||
the indentation will be that many spaces.
|
||||
|
||||
Example:
|
||||
|
||||
text = JSON.stringify(['e', {pluribus: 'unum'}]);
|
||||
// text is '["e",{"pluribus":"unum"}]'
|
||||
|
||||
|
||||
text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
|
||||
// text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'
|
||||
|
||||
text = JSON.stringify([new Date()], function (key, value) {
|
||||
return this[key] instanceof Date ?
|
||||
'Date(' + this[key] + ')' : value;
|
||||
});
|
||||
// text is '["Date(---current time---)"]'
|
||||
|
||||
|
||||
JSON.parse(text, reviver)
|
||||
This method parses a JSON text to produce an object or array.
|
||||
It can throw a SyntaxError exception.
|
||||
|
||||
The optional reviver parameter is a function that can filter and
|
||||
transform the results. It receives each of the keys and values,
|
||||
and its return value is used instead of the original value.
|
||||
If it returns what it received, then the structure is not modified.
|
||||
If it returns undefined then the member is deleted.
|
||||
|
||||
Example:
|
||||
|
||||
// Parse the text. Values that look like ISO date strings will
|
||||
// be converted to Date objects.
|
||||
|
||||
myData = JSON.parse(text, function (key, value) {
|
||||
var a;
|
||||
if (typeof value === 'string') {
|
||||
a =
|
||||
/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
|
||||
if (a) {
|
||||
return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
|
||||
+a[5], +a[6]));
|
||||
}
|
||||
}
|
||||
return value;
|
||||
});
|
||||
|
||||
myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
|
||||
var d;
|
||||
if (typeof value === 'string' &&
|
||||
value.slice(0, 5) === 'Date(' &&
|
||||
value.slice(-1) === ')') {
|
||||
d = new Date(value.slice(5, -1));
|
||||
if (d) {
|
||||
return d;
|
||||
}
|
||||
}
|
||||
return value;
|
||||
});
|
||||
|
||||
|
||||
This is a reference implementation. You are free to copy, modify, or
|
||||
redistribute.
|
||||
*/
|
||||
|
||||
/*jslint evil: true, regexp: true */
|
||||
|
||||
/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
|
||||
call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
|
||||
getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
|
||||
lastIndex, length, parse, prototype, push, replace, slice, stringify,
|
||||
test, toJSON, toString, valueOf
|
||||
*/
|
||||
|
||||
|
||||
// Create a JSON object only if one does not already exist. We create the
|
||||
// methods in a closure to avoid creating global variables.
|
||||
|
||||
var JSON;
|
||||
if (!JSON) {
|
||||
JSON = {};
|
||||
}
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
function f(n) {
|
||||
// Format integers to have at least two digits.
|
||||
return n < 10 ? '0' + n : n;
|
||||
}
|
||||
|
||||
if (typeof Date.prototype.toJSON !== 'function') {
|
||||
|
||||
Date.prototype.toJSON = function (key) {
|
||||
|
||||
return isFinite(this.valueOf())
|
||||
? this.getUTCFullYear() + '-' +
|
||||
f(this.getUTCMonth() + 1) + '-' +
|
||||
f(this.getUTCDate()) + 'T' +
|
||||
f(this.getUTCHours()) + ':' +
|
||||
f(this.getUTCMinutes()) + ':' +
|
||||
f(this.getUTCSeconds()) + 'Z'
|
||||
: null;
|
||||
};
|
||||
|
||||
String.prototype.toJSON =
|
||||
Number.prototype.toJSON =
|
||||
Boolean.prototype.toJSON = function (key) {
|
||||
return this.valueOf();
|
||||
};
|
||||
}
|
||||
|
||||
var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
|
||||
escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
|
||||
gap,
|
||||
indent,
|
||||
meta = { // table of character substitutions
|
||||
'\b': '\\b',
|
||||
'\t': '\\t',
|
||||
'\n': '\\n',
|
||||
'\f': '\\f',
|
||||
'\r': '\\r',
|
||||
'"' : '\\"',
|
||||
'\\': '\\\\'
|
||||
},
|
||||
rep;
|
||||
|
||||
|
||||
function quote(string) {
|
||||
|
||||
// If the string contains no control characters, no quote characters, and no
|
||||
// backslash characters, then we can safely slap some quotes around it.
|
||||
// Otherwise we must also replace the offending characters with safe escape
|
||||
// sequences.
|
||||
|
||||
escapable.lastIndex = 0;
|
||||
return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
|
||||
var c = meta[a];
|
||||
return typeof c === 'string'
|
||||
? c
|
||||
: '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
|
||||
}) + '"' : '"' + string + '"';
|
||||
}
|
||||
|
||||
|
||||
function str(key, holder) {
|
||||
|
||||
// Produce a string from holder[key].
|
||||
|
||||
var i, // The loop counter.
|
||||
k, // The member key.
|
||||
v, // The member value.
|
||||
length,
|
||||
mind = gap,
|
||||
partial,
|
||||
value = holder[key];
|
||||
|
||||
// If the value has a toJSON method, call it to obtain a replacement value.
|
||||
|
||||
if (value && typeof value === 'object' &&
|
||||
typeof value.toJSON === 'function') {
|
||||
value = value.toJSON(key);
|
||||
}
|
||||
|
||||
// If we were called with a replacer function, then call the replacer to
|
||||
// obtain a replacement value.
|
||||
|
||||
if (typeof rep === 'function') {
|
||||
value = rep.call(holder, key, value);
|
||||
}
|
||||
|
||||
// What happens next depends on the value's type.
|
||||
|
||||
switch (typeof value) {
|
||||
case 'string':
|
||||
return quote(value);
|
||||
|
||||
case 'number':
|
||||
|
||||
// JSON numbers must be finite. Encode non-finite numbers as null.
|
||||
|
||||
return isFinite(value) ? String(value) : 'null';
|
||||
|
||||
case 'boolean':
|
||||
case 'null':
|
||||
|
||||
// If the value is a boolean or null, convert it to a string. Note:
|
||||
// typeof null does not produce 'null'. The case is included here in
|
||||
// the remote chance that this gets fixed someday.
|
||||
|
||||
return String(value);
|
||||
|
||||
// If the type is 'object', we might be dealing with an object or an array or
|
||||
// null.
|
||||
|
||||
case 'object':
|
||||
|
||||
// Due to a specification blunder in ECMAScript, typeof null is 'object',
|
||||
// so watch out for that case.
|
||||
|
||||
if (!value) {
|
||||
return 'null';
|
||||
}
|
||||
|
||||
// Make an array to hold the partial results of stringifying this object value.
|
||||
|
||||
gap += indent;
|
||||
partial = [];
|
||||
|
||||
// Is the value an array?
|
||||
|
||||
if (Object.prototype.toString.apply(value) === '[object Array]') {
|
||||
|
||||
// The value is an array. Stringify every element. Use null as a placeholder
|
||||
// for non-JSON values.
|
||||
|
||||
length = value.length;
|
||||
for (i = 0; i < length; i += 1) {
|
||||
partial[i] = str(i, value) || 'null';
|
||||
}
|
||||
|
||||
// Join all of the elements together, separated with commas, and wrap them in
|
||||
// brackets.
|
||||
|
||||
v = partial.length === 0
|
||||
? '[]'
|
||||
: gap
|
||||
? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']'
|
||||
: '[' + partial.join(',') + ']';
|
||||
gap = mind;
|
||||
return v;
|
||||
}
|
||||
|
||||
// If the replacer is an array, use it to select the members to be stringified.
|
||||
|
||||
if (rep && typeof rep === 'object') {
|
||||
length = rep.length;
|
||||
for (i = 0; i < length; i += 1) {
|
||||
if (typeof rep[i] === 'string') {
|
||||
k = rep[i];
|
||||
v = str(k, value);
|
||||
if (v) {
|
||||
partial.push(quote(k) + (gap ? ': ' : ':') + v);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
// Otherwise, iterate through all of the keys in the object.
|
||||
|
||||
for (k in value) {
|
||||
if (Object.prototype.hasOwnProperty.call(value, k)) {
|
||||
v = str(k, value);
|
||||
if (v) {
|
||||
partial.push(quote(k) + (gap ? ': ' : ':') + v);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Join all of the member texts together, separated with commas,
|
||||
// and wrap them in braces.
|
||||
|
||||
v = partial.length === 0
|
||||
? '{}'
|
||||
: gap
|
||||
? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}'
|
||||
: '{' + partial.join(',') + '}';
|
||||
gap = mind;
|
||||
return v;
|
||||
}
|
||||
}
|
||||
|
||||
// If the JSON object does not yet have a stringify method, give it one.
|
||||
|
||||
if (typeof JSON.stringify !== 'function') {
|
||||
JSON.stringify = function (value, replacer, space) {
|
||||
|
||||
// The stringify method takes a value and an optional replacer, and an optional
|
||||
// space parameter, and returns a JSON text. The replacer can be a function
|
||||
// that can replace values, or an array of strings that will select the keys.
|
||||
// A default replacer method can be provided. Use of the space parameter can
|
||||
// produce text that is more easily readable.
|
||||
|
||||
var i;
|
||||
gap = '';
|
||||
indent = '';
|
||||
|
||||
// If the space parameter is a number, make an indent string containing that
|
||||
// many spaces.
|
||||
|
||||
if (typeof space === 'number') {
|
||||
for (i = 0; i < space; i += 1) {
|
||||
indent += ' ';
|
||||
}
|
||||
|
||||
// If the space parameter is a string, it will be used as the indent string.
|
||||
|
||||
} else if (typeof space === 'string') {
|
||||
indent = space;
|
||||
}
|
||||
|
||||
// If there is a replacer, it must be a function or an array.
|
||||
// Otherwise, throw an error.
|
||||
|
||||
rep = replacer;
|
||||
if (replacer && typeof replacer !== 'function' &&
|
||||
(typeof replacer !== 'object' ||
|
||||
typeof replacer.length !== 'number')) {
|
||||
throw new Error('JSON.stringify');
|
||||
}
|
||||
|
||||
// Make a fake root object containing our value under the key of ''.
|
||||
// Return the result of stringifying the value.
|
||||
|
||||
return str('', {'': value});
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
// If the JSON object does not yet have a parse method, give it one.
|
||||
|
||||
if (typeof JSON.parse !== 'function') {
|
||||
JSON.parse = function (text, reviver) {
|
||||
|
||||
// The parse method takes a text and an optional reviver function, and returns
|
||||
// a JavaScript value if the text is a valid JSON text.
|
||||
|
||||
var j;
|
||||
|
||||
function walk(holder, key) {
|
||||
|
||||
// The walk method is used to recursively walk the resulting structure so
|
||||
// that modifications can be made.
|
||||
|
||||
var k, v, value = holder[key];
|
||||
if (value && typeof value === 'object') {
|
||||
for (k in value) {
|
||||
if (Object.prototype.hasOwnProperty.call(value, k)) {
|
||||
v = walk(value, k);
|
||||
if (v !== undefined) {
|
||||
value[k] = v;
|
||||
} else {
|
||||
delete value[k];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return reviver.call(holder, key, value);
|
||||
}
|
||||
|
||||
|
||||
// Parsing happens in four stages. In the first stage, we replace certain
|
||||
// Unicode characters with escape sequences. JavaScript handles many characters
|
||||
// incorrectly, either silently deleting them, or treating them as line endings.
|
||||
|
||||
text = String(text);
|
||||
cx.lastIndex = 0;
|
||||
if (cx.test(text)) {
|
||||
text = text.replace(cx, function (a) {
|
||||
return '\\u' +
|
||||
('0000' + a.charCodeAt(0).toString(16)).slice(-4);
|
||||
});
|
||||
}
|
||||
|
||||
// In the second stage, we run the text against regular expressions that look
|
||||
// for non-JSON patterns. We are especially concerned with '()' and 'new'
|
||||
// because they can cause invocation, and '=' because it can cause mutation.
|
||||
// But just to be safe, we want to reject all unexpected forms.
|
||||
|
||||
// We split the second stage into 4 regexp operations in order to work around
|
||||
// crippling inefficiencies in IE's and Safari's regexp engines. First we
|
||||
// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
|
||||
// replace all simple value tokens with ']' characters. Third, we delete all
|
||||
// open brackets that follow a colon or comma or that begin the text. Finally,
|
||||
// we look to see that the remaining characters are only whitespace or ']' or
|
||||
// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
|
||||
|
||||
if (/^[\],:{}\s]*$/
|
||||
.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
|
||||
.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
|
||||
.replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
|
||||
|
||||
// In the third stage we use the eval function to compile the text into a
|
||||
// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
|
||||
// in JavaScript: it can begin a block or an object literal. We wrap the text
|
||||
// in parens to eliminate the ambiguity.
|
||||
|
||||
j = eval('(' + text + ')');
|
||||
|
||||
// In the optional fourth stage, we recursively walk the new structure, passing
|
||||
// each name/value pair to a reviver function for possible transformation.
|
||||
|
||||
return typeof reviver === 'function'
|
||||
? walk({'': j}, '')
|
||||
: j;
|
||||
}
|
||||
|
||||
// If the text is not JSON parseable, then a SyntaxError is thrown.
|
||||
|
||||
throw new SyntaxError('JSON.parse');
|
||||
};
|
||||
}
|
||||
}());
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
(function(){
|
||||
|
||||
function __sanitize(value) {
|
||||
return value.sanitize(
|
||||
['&', '<', '>', '\'', '"'],
|
||||
['&','<','>', ''','"']
|
||||
);
|
||||
};
|
||||
|
||||
function __toXML(o, t) {
|
||||
var xml = [];
|
||||
switch( typeof o ) {
|
||||
case "object":
|
||||
if(o.length) {
|
||||
var a = o;
|
||||
if(a.length === 0) {
|
||||
xml.push("<{tag}/>".substitute({"tag":t}));
|
||||
} else {
|
||||
for(var i = 0, len = a.length; i < len; i++) {
|
||||
xml.push(__toXML(a[i], t));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
xml.push("<{tag}".substitute({"tag":t}));
|
||||
var childs = [];
|
||||
for(var p in o) {
|
||||
if(o.hasOwnProperty(p)) {
|
||||
if(p.charAt(0) === "@") xml.push(" {param}='{content}'".substitute({"param":p.substr(1), "content":__sanitize(o[p].toString())}));
|
||||
else childs.push(p);
|
||||
}
|
||||
}
|
||||
if(childs.length === 0) {
|
||||
xml.push("/>");
|
||||
} else {
|
||||
xml.push(">");
|
||||
for(var i = 0, len = childs.length; i < len; i++) {
|
||||
if(p === "#text") { xml.push(__sanitize(o[childs[i]])); }
|
||||
else if(p === "#cdata") { xml.push("<![CDATA[{code}]]>".substitute({"code": o[childs[i]].toString()})); }
|
||||
else if(p.charAt(0) !== "@") { xml.push(__toXML(o[childs[i]], childs[i])); }
|
||||
}
|
||||
xml.push("</{tag}>".substitute({"tag":t}));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
var s = String(o);
|
||||
if(s.length === 0) {
|
||||
xml.push("<{tag}/>".substitute({"tag":t}));
|
||||
} else {
|
||||
xml.push("<{tag}>{value}</{tag}>".substitute({"tag":t, "value":__sanitize(s)}));
|
||||
}
|
||||
}
|
||||
return xml.join('');
|
||||
}
|
||||
|
||||
if (typeof JSON.toXML !== 'function') {
|
||||
JSON.toXML = function(json, container){
|
||||
//container = container || "";
|
||||
var xml = [];
|
||||
if(container) xml.push("<{tag}>".substitute({"tag":container}));
|
||||
for(var p in json) {
|
||||
if(json.hasOwnProperty(p)) {
|
||||
xml.push(__toXML(json[p], p));
|
||||
}
|
||||
}
|
||||
if(container) xml.push("</{tag}>".substitute({"tag":container}));
|
||||
return xml.join('');
|
||||
}
|
||||
}
|
||||
|
||||
})();
|
||||
|
||||
</script>
|
||||
357
Lib/md5.asp
Normal file
357
Lib/md5.asp
Normal file
@@ -0,0 +1,357 @@
|
||||
<%
|
||||
|
||||
|
||||
Private Const BITS_TO_A_BYTE = 8
|
||||
Private Const BYTES_TO_A_WORD = 4
|
||||
Private Const BITS_TO_A_WORD = 32
|
||||
|
||||
Private m_lOnBits(30)
|
||||
Private m_l2Power(30)
|
||||
|
||||
m_lOnBits(0) = CLng(1)
|
||||
m_lOnBits(1) = CLng(3)
|
||||
m_lOnBits(2) = CLng(7)
|
||||
m_lOnBits(3) = CLng(15)
|
||||
m_lOnBits(4) = CLng(31)
|
||||
m_lOnBits(5) = CLng(63)
|
||||
m_lOnBits(6) = CLng(127)
|
||||
m_lOnBits(7) = CLng(255)
|
||||
m_lOnBits(8) = CLng(511)
|
||||
m_lOnBits(9) = CLng(1023)
|
||||
m_lOnBits(10) = CLng(2047)
|
||||
m_lOnBits(11) = CLng(4095)
|
||||
m_lOnBits(12) = CLng(8191)
|
||||
m_lOnBits(13) = CLng(16383)
|
||||
m_lOnBits(14) = CLng(32767)
|
||||
m_lOnBits(15) = CLng(65535)
|
||||
m_lOnBits(16) = CLng(131071)
|
||||
m_lOnBits(17) = CLng(262143)
|
||||
m_lOnBits(18) = CLng(524287)
|
||||
m_lOnBits(19) = CLng(1048575)
|
||||
m_lOnBits(20) = CLng(2097151)
|
||||
m_lOnBits(21) = CLng(4194303)
|
||||
m_lOnBits(22) = CLng(8388607)
|
||||
m_lOnBits(23) = CLng(16777215)
|
||||
m_lOnBits(24) = CLng(33554431)
|
||||
m_lOnBits(25) = CLng(67108863)
|
||||
m_lOnBits(26) = CLng(134217727)
|
||||
m_lOnBits(27) = CLng(268435455)
|
||||
m_lOnBits(28) = CLng(536870911)
|
||||
m_lOnBits(29) = CLng(1073741823)
|
||||
m_lOnBits(30) = CLng(2147483647)
|
||||
|
||||
m_l2Power(0) = CLng(1)
|
||||
m_l2Power(1) = CLng(2)
|
||||
m_l2Power(2) = CLng(4)
|
||||
m_l2Power(3) = CLng(8)
|
||||
m_l2Power(4) = CLng(16)
|
||||
m_l2Power(5) = CLng(32)
|
||||
m_l2Power(6) = CLng(64)
|
||||
m_l2Power(7) = CLng(128)
|
||||
m_l2Power(8) = CLng(256)
|
||||
m_l2Power(9) = CLng(512)
|
||||
m_l2Power(10) = CLng(1024)
|
||||
m_l2Power(11) = CLng(2048)
|
||||
m_l2Power(12) = CLng(4096)
|
||||
m_l2Power(13) = CLng(8192)
|
||||
m_l2Power(14) = CLng(16384)
|
||||
m_l2Power(15) = CLng(32768)
|
||||
m_l2Power(16) = CLng(65536)
|
||||
m_l2Power(17) = CLng(131072)
|
||||
m_l2Power(18) = CLng(262144)
|
||||
m_l2Power(19) = CLng(524288)
|
||||
m_l2Power(20) = CLng(1048576)
|
||||
m_l2Power(21) = CLng(2097152)
|
||||
m_l2Power(22) = CLng(4194304)
|
||||
m_l2Power(23) = CLng(8388608)
|
||||
m_l2Power(24) = CLng(16777216)
|
||||
m_l2Power(25) = CLng(33554432)
|
||||
m_l2Power(26) = CLng(67108864)
|
||||
m_l2Power(27) = CLng(134217728)
|
||||
m_l2Power(28) = CLng(268435456)
|
||||
m_l2Power(29) = CLng(536870912)
|
||||
m_l2Power(30) = CLng(1073741824)
|
||||
|
||||
Private Function LShift(lValue, iShiftBits)
|
||||
If iShiftBits = 0 Then
|
||||
LShift = lValue
|
||||
Exit Function
|
||||
ElseIf iShiftBits = 31 Then
|
||||
If lValue And 1 Then
|
||||
LShift = &H80000000
|
||||
Else
|
||||
LShift = 0
|
||||
End If
|
||||
Exit Function
|
||||
ElseIf iShiftBits < 0 Or iShiftBits > 31 Then
|
||||
Err.Raise 6
|
||||
End If
|
||||
|
||||
If (lValue And m_l2Power(31 - iShiftBits)) Then
|
||||
LShift = ((lValue And m_lOnBits(31 - (iShiftBits + 1))) * m_l2Power(iShiftBits)) Or &H80000000
|
||||
Else
|
||||
LShift = ((lValue And m_lOnBits(31 - iShiftBits)) * m_l2Power(iShiftBits))
|
||||
End If
|
||||
End Function
|
||||
|
||||
Private Function RShift(lValue, iShiftBits)
|
||||
If iShiftBits = 0 Then
|
||||
RShift = lValue
|
||||
Exit Function
|
||||
ElseIf iShiftBits = 31 Then
|
||||
If lValue And &H80000000 Then
|
||||
RShift = 1
|
||||
Else
|
||||
RShift = 0
|
||||
End If
|
||||
Exit Function
|
||||
ElseIf iShiftBits < 0 Or iShiftBits > 31 Then
|
||||
Err.Raise 6
|
||||
End If
|
||||
|
||||
RShift = (lValue And &H7FFFFFFE) \ m_l2Power(iShiftBits)
|
||||
|
||||
If (lValue And &H80000000) Then
|
||||
RShift = (RShift Or (&H40000000 \ m_l2Power(iShiftBits - 1)))
|
||||
End If
|
||||
End Function
|
||||
|
||||
Private Function RotateLeft(lValue, iShiftBits)
|
||||
RotateLeft = LShift(lValue, iShiftBits) Or RShift(lValue, (32 - iShiftBits))
|
||||
End Function
|
||||
|
||||
Private Function AddUnsigned(lX, lY)
|
||||
Dim lX4
|
||||
Dim lY4
|
||||
Dim lX8
|
||||
Dim lY8
|
||||
Dim lResult
|
||||
|
||||
lX8 = lX And &H80000000
|
||||
lY8 = lY And &H80000000
|
||||
lX4 = lX And &H40000000
|
||||
lY4 = lY And &H40000000
|
||||
|
||||
lResult = (lX And &H3FFFFFFF) + (lY And &H3FFFFFFF)
|
||||
|
||||
If lX4 And lY4 Then
|
||||
lResult = lResult Xor &H80000000 Xor lX8 Xor lY8
|
||||
ElseIf lX4 Or lY4 Then
|
||||
If lResult And &H40000000 Then
|
||||
lResult = lResult Xor &HC0000000 Xor lX8 Xor lY8
|
||||
Else
|
||||
lResult = lResult Xor &H40000000 Xor lX8 Xor lY8
|
||||
End If
|
||||
Else
|
||||
lResult = lResult Xor lX8 Xor lY8
|
||||
End If
|
||||
|
||||
AddUnsigned = lResult
|
||||
End Function
|
||||
|
||||
Private Function F(x, y, z)
|
||||
F = (x And y) Or ((Not x) And z)
|
||||
End Function
|
||||
|
||||
Private Function G(x, y, z)
|
||||
G = (x And z) Or (y And (Not z))
|
||||
End Function
|
||||
|
||||
Private Function H(x, y, z)
|
||||
H = (x Xor y Xor z)
|
||||
End Function
|
||||
|
||||
Private Function I(x, y, z)
|
||||
I = (y Xor (x Or (Not z)))
|
||||
End Function
|
||||
|
||||
Private Sub FF(a, b, c, d, x, s, ac)
|
||||
a = AddUnsigned(a, AddUnsigned(AddUnsigned(F(b, c, d), x), ac))
|
||||
a = RotateLeft(a, s)
|
||||
a = AddUnsigned(a, b)
|
||||
End Sub
|
||||
|
||||
Private Sub GG(a, b, c, d, x, s, ac)
|
||||
a = AddUnsigned(a, AddUnsigned(AddUnsigned(G(b, c, d), x), ac))
|
||||
a = RotateLeft(a, s)
|
||||
a = AddUnsigned(a, b)
|
||||
End Sub
|
||||
|
||||
Private Sub HH(a, b, c, d, x, s, ac)
|
||||
a = AddUnsigned(a, AddUnsigned(AddUnsigned(H(b, c, d), x), ac))
|
||||
a = RotateLeft(a, s)
|
||||
a = AddUnsigned(a, b)
|
||||
End Sub
|
||||
|
||||
Private Sub II(a, b, c, d, x, s, ac)
|
||||
a = AddUnsigned(a, AddUnsigned(AddUnsigned(I(b, c, d), x), ac))
|
||||
a = RotateLeft(a, s)
|
||||
a = AddUnsigned(a, b)
|
||||
End Sub
|
||||
|
||||
Private Function ConvertToWordArray(sMessage)
|
||||
Dim lMessageLength
|
||||
Dim lNumberOfWords
|
||||
Dim lWordArray()
|
||||
Dim lBytePosition
|
||||
Dim lByteCount
|
||||
Dim lWordCount
|
||||
|
||||
Const MODULUS_BITS = 512
|
||||
Const CONGRUENT_BITS = 448
|
||||
|
||||
lMessageLength = Len(sMessage)
|
||||
|
||||
lNumberOfWords = (((lMessageLength + ((MODULUS_BITS - CONGRUENT_BITS) \ BITS_TO_A_BYTE)) \ (MODULUS_BITS \ BITS_TO_A_BYTE)) + 1) * (MODULUS_BITS \ BITS_TO_A_WORD)
|
||||
ReDim lWordArray(lNumberOfWords - 1)
|
||||
|
||||
lBytePosition = 0
|
||||
lByteCount = 0
|
||||
Do Until lByteCount >= lMessageLength
|
||||
lWordCount = lByteCount \ BYTES_TO_A_WORD
|
||||
lBytePosition = (lByteCount Mod BYTES_TO_A_WORD) * BITS_TO_A_BYTE
|
||||
lWordArray(lWordCount) = lWordArray(lWordCount) Or LShift(Asc(Mid(sMessage, lByteCount + 1, 1)), lBytePosition)
|
||||
lByteCount = lByteCount + 1
|
||||
Loop
|
||||
|
||||
lWordCount = lByteCount \ BYTES_TO_A_WORD
|
||||
lBytePosition = (lByteCount Mod BYTES_TO_A_WORD) * BITS_TO_A_BYTE
|
||||
|
||||
lWordArray(lWordCount) = lWordArray(lWordCount) Or LShift(&H80, lBytePosition)
|
||||
|
||||
lWordArray(lNumberOfWords - 2) = LShift(lMessageLength, 3)
|
||||
lWordArray(lNumberOfWords - 1) = RShift(lMessageLength, 29)
|
||||
|
||||
ConvertToWordArray = lWordArray
|
||||
End Function
|
||||
|
||||
Private Function WordToHex(lValue)
|
||||
Dim lByte
|
||||
Dim lCount
|
||||
|
||||
For lCount = 0 To 3
|
||||
lByte = RShift(lValue, lCount * BITS_TO_A_BYTE) And m_lOnBits(BITS_TO_A_BYTE - 1)
|
||||
WordToHex = WordToHex & Right("0" & Hex(lByte), 2)
|
||||
Next
|
||||
End Function
|
||||
|
||||
Public Function MD5(sMessage)
|
||||
Dim x
|
||||
Dim k
|
||||
Dim AA
|
||||
Dim BB
|
||||
Dim CC
|
||||
Dim DD
|
||||
Dim a
|
||||
Dim b
|
||||
Dim c
|
||||
Dim d
|
||||
|
||||
Const S11 = 7
|
||||
Const S12 = 12
|
||||
Const S13 = 17
|
||||
Const S14 = 22
|
||||
Const S21 = 5
|
||||
Const S22 = 9
|
||||
Const S23 = 14
|
||||
Const S24 = 20
|
||||
Const S31 = 4
|
||||
Const S32 = 11
|
||||
Const S33 = 16
|
||||
Const S34 = 23
|
||||
Const S41 = 6
|
||||
Const S42 = 10
|
||||
Const S43 = 15
|
||||
Const S44 = 21
|
||||
|
||||
x = ConvertToWordArray(sMessage)
|
||||
|
||||
a = &H67452301
|
||||
b = &HEFCDAB89
|
||||
c = &H98BADCFE
|
||||
d = &H10325476
|
||||
|
||||
For k = 0 To UBound(x) Step 16
|
||||
AA = a
|
||||
BB = b
|
||||
CC = c
|
||||
DD = d
|
||||
|
||||
FF a, b, c, d, x(k + 0), S11, &HD76AA478
|
||||
FF d, a, b, c, x(k + 1), S12, &HE8C7B756
|
||||
FF c, d, a, b, x(k + 2), S13, &H242070DB
|
||||
FF b, c, d, a, x(k + 3), S14, &HC1BDCEEE
|
||||
FF a, b, c, d, x(k + 4), S11, &HF57C0FAF
|
||||
FF d, a, b, c, x(k + 5), S12, &H4787C62A
|
||||
FF c, d, a, b, x(k + 6), S13, &HA8304613
|
||||
FF b, c, d, a, x(k + 7), S14, &HFD469501
|
||||
FF a, b, c, d, x(k + 8), S11, &H698098D8
|
||||
FF d, a, b, c, x(k + 9), S12, &H8B44F7AF
|
||||
FF c, d, a, b, x(k + 10), S13, &HFFFF5BB1
|
||||
FF b, c, d, a, x(k + 11), S14, &H895CD7BE
|
||||
FF a, b, c, d, x(k + 12), S11, &H6B901122
|
||||
FF d, a, b, c, x(k + 13), S12, &HFD987193
|
||||
FF c, d, a, b, x(k + 14), S13, &HA679438E
|
||||
FF b, c, d, a, x(k + 15), S14, &H49B40821
|
||||
|
||||
GG a, b, c, d, x(k + 1), S21, &HF61E2562
|
||||
GG d, a, b, c, x(k + 6), S22, &HC040B340
|
||||
GG c, d, a, b, x(k + 11), S23, &H265E5A51
|
||||
GG b, c, d, a, x(k + 0), S24, &HE9B6C7AA
|
||||
GG a, b, c, d, x(k + 5), S21, &HD62F105D
|
||||
GG d, a, b, c, x(k + 10), S22, &H2441453
|
||||
GG c, d, a, b, x(k + 15), S23, &HD8A1E681
|
||||
GG b, c, d, a, x(k + 4), S24, &HE7D3FBC8
|
||||
GG a, b, c, d, x(k + 9), S21, &H21E1CDE6
|
||||
GG d, a, b, c, x(k + 14), S22, &HC33707D6
|
||||
GG c, d, a, b, x(k + 3), S23, &HF4D50D87
|
||||
GG b, c, d, a, x(k + 8), S24, &H455A14ED
|
||||
GG a, b, c, d, x(k + 13), S21, &HA9E3E905
|
||||
GG d, a, b, c, x(k + 2), S22, &HFCEFA3F8
|
||||
GG c, d, a, b, x(k + 7), S23, &H676F02D9
|
||||
GG b, c, d, a, x(k + 12), S24, &H8D2A4C8A
|
||||
|
||||
HH a, b, c, d, x(k + 5), S31, &HFFFA3942
|
||||
HH d, a, b, c, x(k + 8), S32, &H8771F681
|
||||
HH c, d, a, b, x(k + 11), S33, &H6D9D6122
|
||||
HH b, c, d, a, x(k + 14), S34, &HFDE5380C
|
||||
HH a, b, c, d, x(k + 1), S31, &HA4BEEA44
|
||||
HH d, a, b, c, x(k + 4), S32, &H4BDECFA9
|
||||
HH c, d, a, b, x(k + 7), S33, &HF6BB4B60
|
||||
HH b, c, d, a, x(k + 10), S34, &HBEBFBC70
|
||||
HH a, b, c, d, x(k + 13), S31, &H289B7EC6
|
||||
HH d, a, b, c, x(k + 0), S32, &HEAA127FA
|
||||
HH c, d, a, b, x(k + 3), S33, &HD4EF3085
|
||||
HH b, c, d, a, x(k + 6), S34, &H4881D05
|
||||
HH a, b, c, d, x(k + 9), S31, &HD9D4D039
|
||||
HH d, a, b, c, x(k + 12), S32, &HE6DB99E5
|
||||
HH c, d, a, b, x(k + 15), S33, &H1FA27CF8
|
||||
HH b, c, d, a, x(k + 2), S34, &HC4AC5665
|
||||
|
||||
II a, b, c, d, x(k + 0), S41, &HF4292244
|
||||
II d, a, b, c, x(k + 7), S42, &H432AFF97
|
||||
II c, d, a, b, x(k + 14), S43, &HAB9423A7
|
||||
II b, c, d, a, x(k + 5), S44, &HFC93A039
|
||||
II a, b, c, d, x(k + 12), S41, &H655B59C3
|
||||
II d, a, b, c, x(k + 3), S42, &H8F0CCC92
|
||||
II c, d, a, b, x(k + 10), S43, &HFFEFF47D
|
||||
II b, c, d, a, x(k + 1), S44, &H85845DD1
|
||||
II a, b, c, d, x(k + 8), S41, &H6FA87E4F
|
||||
II d, a, b, c, x(k + 15), S42, &HFE2CE6E0
|
||||
II c, d, a, b, x(k + 6), S43, &HA3014314
|
||||
II b, c, d, a, x(k + 13), S44, &H4E0811A1
|
||||
II a, b, c, d, x(k + 4), S41, &HF7537E82
|
||||
II d, a, b, c, x(k + 11), S42, &HBD3AF235
|
||||
II c, d, a, b, x(k + 2), S43, &H2AD7D2BB
|
||||
II b, c, d, a, x(k + 9), S44, &HEB86D391
|
||||
|
||||
a = AddUnsigned(a, AA)
|
||||
b = AddUnsigned(b, BB)
|
||||
c = AddUnsigned(c, CC)
|
||||
d = AddUnsigned(d, DD)
|
||||
Next
|
||||
|
||||
MD5 = LCase(WordToHex(a) & WordToHex(b) & WordToHex(c) & WordToHex(d))
|
||||
End Function
|
||||
|
||||
%>
|
||||
417
Lib/sha256.asp
Normal file
417
Lib/sha256.asp
Normal file
@@ -0,0 +1,417 @@
|
||||
<%
|
||||
' See the VB6 project that accompanies this sample for full code comments on how
|
||||
' it works.
|
||||
'
|
||||
' ASP VBScript code for generating a SHA256 'digest' or 'signature' of a string. The
|
||||
' MD5 algorithm is one of the industry standard methods for generating digital
|
||||
' signatures. It is generically known as a digest, digital signature, one-way
|
||||
' encryption, hash or checksum algorithm. A common use for SHA256 is for password
|
||||
' encryption as it is one-way in nature, that does not mean that your passwords
|
||||
' are not free from a dictionary attack.
|
||||
'
|
||||
' If you are using the routine for passwords, you can make it a little more secure
|
||||
' by concatenating some known random characters to the password before you generate
|
||||
' the signature and on subsequent tests, so even if a hacker knows you are using
|
||||
' SHA-256 for your passwords, the random characters will make it harder to dictionary
|
||||
' attack.
|
||||
'
|
||||
' NOTE: Due to the way in which the string is processed the routine assumes a
|
||||
' single byte character set. VB passes unicode (2-byte) character strings, the
|
||||
' ConvertToWordArray function uses on the first byte for each character. This
|
||||
' has been done this way for ease of use, to make the routine truely portable
|
||||
' you could accept a byte array instead, it would then be up to the calling
|
||||
' routine to make sure that the byte array is generated from their string in
|
||||
' a manner consistent with the string type.
|
||||
'
|
||||
' This is 'free' software with the following restrictions:
|
||||
'
|
||||
' You may not redistribute this code as a 'sample' or 'demo'. However, you are free
|
||||
' to use the source code in your own code, but you may not claim that you created
|
||||
' the sample code. It is expressly forbidden to sell or profit from this source code
|
||||
' other than by the knowledge gained or the enhanced value added by your own code.
|
||||
'
|
||||
' Use of this software is also done so at your own risk. The code is supplied as
|
||||
' is without warranty or guarantee of any kind.
|
||||
'
|
||||
' Should you wish to commission some derivative work based on this code provided
|
||||
' here, or any consultancy work, please do not hesitate to contact us.
|
||||
'
|
||||
' Web Site: http://www.frez.co.uk
|
||||
' E-mail: sales@frez.co.uk
|
||||
|
||||
Class clsSHA256
|
||||
|
||||
Private m_lOnBits(30)
|
||||
Private m_l2Power(30)
|
||||
Private K(63)
|
||||
|
||||
'Const BITS_TO_A_BYTE = 8
|
||||
'Const BYTES_TO_A_WORD = 4
|
||||
'Const BITS_TO_A_WORD = 32
|
||||
|
||||
Private BITS_TO_A_BYTE
|
||||
Private BYTES_TO_A_WORD
|
||||
Private BITS_TO_A_WORD
|
||||
|
||||
Private sub Class_Initialize()
|
||||
BITS_TO_A_BYTE = 8
|
||||
BYTES_TO_A_WORD = 4
|
||||
BITS_TO_A_WORD = 32
|
||||
|
||||
m_lOnBits(0) = CLng(1)
|
||||
m_lOnBits(1) = CLng(3)
|
||||
m_lOnBits(2) = CLng(7)
|
||||
m_lOnBits(3) = CLng(15)
|
||||
m_lOnBits(4) = CLng(31)
|
||||
m_lOnBits(5) = CLng(63)
|
||||
m_lOnBits(6) = CLng(127)
|
||||
m_lOnBits(7) = CLng(255)
|
||||
m_lOnBits(8) = CLng(511)
|
||||
m_lOnBits(9) = CLng(1023)
|
||||
m_lOnBits(10) = CLng(2047)
|
||||
m_lOnBits(11) = CLng(4095)
|
||||
m_lOnBits(12) = CLng(8191)
|
||||
m_lOnBits(13) = CLng(16383)
|
||||
m_lOnBits(14) = CLng(32767)
|
||||
m_lOnBits(15) = CLng(65535)
|
||||
m_lOnBits(16) = CLng(131071)
|
||||
m_lOnBits(17) = CLng(262143)
|
||||
m_lOnBits(18) = CLng(524287)
|
||||
m_lOnBits(19) = CLng(1048575)
|
||||
m_lOnBits(20) = CLng(2097151)
|
||||
m_lOnBits(21) = CLng(4194303)
|
||||
m_lOnBits(22) = CLng(8388607)
|
||||
m_lOnBits(23) = CLng(16777215)
|
||||
m_lOnBits(24) = CLng(33554431)
|
||||
m_lOnBits(25) = CLng(67108863)
|
||||
m_lOnBits(26) = CLng(134217727)
|
||||
m_lOnBits(27) = CLng(268435455)
|
||||
m_lOnBits(28) = CLng(536870911)
|
||||
m_lOnBits(29) = CLng(1073741823)
|
||||
m_lOnBits(30) = CLng(2147483647)
|
||||
|
||||
m_l2Power(0) = CLng(1)
|
||||
m_l2Power(1) = CLng(2)
|
||||
m_l2Power(2) = CLng(4)
|
||||
m_l2Power(3) = CLng(8)
|
||||
m_l2Power(4) = CLng(16)
|
||||
m_l2Power(5) = CLng(32)
|
||||
m_l2Power(6) = CLng(64)
|
||||
m_l2Power(7) = CLng(128)
|
||||
m_l2Power(8) = CLng(256)
|
||||
m_l2Power(9) = CLng(512)
|
||||
m_l2Power(10) = CLng(1024)
|
||||
m_l2Power(11) = CLng(2048)
|
||||
m_l2Power(12) = CLng(4096)
|
||||
m_l2Power(13) = CLng(8192)
|
||||
m_l2Power(14) = CLng(16384)
|
||||
m_l2Power(15) = CLng(32768)
|
||||
m_l2Power(16) = CLng(65536)
|
||||
m_l2Power(17) = CLng(131072)
|
||||
m_l2Power(18) = CLng(262144)
|
||||
m_l2Power(19) = CLng(524288)
|
||||
m_l2Power(20) = CLng(1048576)
|
||||
m_l2Power(21) = CLng(2097152)
|
||||
m_l2Power(22) = CLng(4194304)
|
||||
m_l2Power(23) = CLng(8388608)
|
||||
m_l2Power(24) = CLng(16777216)
|
||||
m_l2Power(25) = CLng(33554432)
|
||||
m_l2Power(26) = CLng(67108864)
|
||||
m_l2Power(27) = CLng(134217728)
|
||||
m_l2Power(28) = CLng(268435456)
|
||||
m_l2Power(29) = CLng(536870912)
|
||||
m_l2Power(30) = CLng(1073741824)
|
||||
|
||||
K(0) = &H428A2F98
|
||||
K(1) = &H71374491
|
||||
K(2) = &HB5C0FBCF
|
||||
K(3) = &HE9B5DBA5
|
||||
K(4) = &H3956C25B
|
||||
K(5) = &H59F111F1
|
||||
K(6) = &H923F82A4
|
||||
K(7) = &HAB1C5ED5
|
||||
K(8) = &HD807AA98
|
||||
K(9) = &H12835B01
|
||||
K(10) = &H243185BE
|
||||
K(11) = &H550C7DC3
|
||||
K(12) = &H72BE5D74
|
||||
K(13) = &H80DEB1FE
|
||||
K(14) = &H9BDC06A7
|
||||
K(15) = &HC19BF174
|
||||
K(16) = &HE49B69C1
|
||||
K(17) = &HEFBE4786
|
||||
K(18) = &HFC19DC6
|
||||
K(19) = &H240CA1CC
|
||||
K(20) = &H2DE92C6F
|
||||
K(21) = &H4A7484AA
|
||||
K(22) = &H5CB0A9DC
|
||||
K(23) = &H76F988DA
|
||||
K(24) = &H983E5152
|
||||
K(25) = &HA831C66D
|
||||
K(26) = &HB00327C8
|
||||
K(27) = &HBF597FC7
|
||||
K(28) = &HC6E00BF3
|
||||
K(29) = &HD5A79147
|
||||
K(30) = &H6CA6351
|
||||
K(31) = &H14292967
|
||||
K(32) = &H27B70A85
|
||||
K(33) = &H2E1B2138
|
||||
K(34) = &H4D2C6DFC
|
||||
K(35) = &H53380D13
|
||||
K(36) = &H650A7354
|
||||
K(37) = &H766A0ABB
|
||||
K(38) = &H81C2C92E
|
||||
K(39) = &H92722C85
|
||||
K(40) = &HA2BFE8A1
|
||||
K(41) = &HA81A664B
|
||||
K(42) = &HC24B8B70
|
||||
K(43) = &HC76C51A3
|
||||
K(44) = &HD192E819
|
||||
K(45) = &HD6990624
|
||||
K(46) = &HF40E3585
|
||||
K(47) = &H106AA070
|
||||
K(48) = &H19A4C116
|
||||
K(49) = &H1E376C08
|
||||
K(50) = &H2748774C
|
||||
K(51) = &H34B0BCB5
|
||||
K(52) = &H391C0CB3
|
||||
K(53) = &H4ED8AA4A
|
||||
K(54) = &H5B9CCA4F
|
||||
K(55) = &H682E6FF3
|
||||
K(56) = &H748F82EE
|
||||
K(57) = &H78A5636F
|
||||
K(58) = &H84C87814
|
||||
K(59) = &H8CC70208
|
||||
K(60) = &H90BEFFFA
|
||||
K(61) = &HA4506CEB
|
||||
K(62) = &HBEF9A3F7
|
||||
K(63) = &HC67178F2
|
||||
|
||||
End Sub
|
||||
|
||||
'<27>Ҹ<EFBFBD><D2B8><EFBFBD>
|
||||
Private Sub Class_Terminate()
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Private Function LShift(lValue, iShiftBits)
|
||||
If iShiftBits = 0 Then
|
||||
LShift = lValue
|
||||
Exit Function
|
||||
ElseIf iShiftBits = 31 Then
|
||||
If lValue And 1 Then
|
||||
LShift = &H80000000
|
||||
Else
|
||||
LShift = 0
|
||||
End If
|
||||
Exit Function
|
||||
ElseIf iShiftBits < 0 Or iShiftBits > 31 Then
|
||||
Err.Raise 6
|
||||
End If
|
||||
|
||||
If (lValue And m_l2Power(31 - iShiftBits)) Then
|
||||
LShift = ((lValue And m_lOnBits(31 - (iShiftBits + 1))) * m_l2Power(iShiftBits)) Or &H80000000
|
||||
Else
|
||||
LShift = ((lValue And m_lOnBits(31 - iShiftBits)) * m_l2Power(iShiftBits))
|
||||
End If
|
||||
End Function
|
||||
|
||||
Private Function RShift(lValue, iShiftBits)
|
||||
If iShiftBits = 0 Then
|
||||
RShift = lValue
|
||||
Exit Function
|
||||
ElseIf iShiftBits = 31 Then
|
||||
If lValue And &H80000000 Then
|
||||
RShift = 1
|
||||
Else
|
||||
RShift = 0
|
||||
End If
|
||||
Exit Function
|
||||
ElseIf iShiftBits < 0 Or iShiftBits > 31 Then
|
||||
Err.Raise 6
|
||||
End If
|
||||
|
||||
RShift = (lValue And &H7FFFFFFE) \ m_l2Power(iShiftBits)
|
||||
|
||||
If (lValue And &H80000000) Then
|
||||
RShift = (RShift Or (&H40000000 \ m_l2Power(iShiftBits - 1)))
|
||||
End If
|
||||
End Function
|
||||
|
||||
Private Function AddUnsigned(lX, lY)
|
||||
Dim lX4
|
||||
Dim lY4
|
||||
Dim lX8
|
||||
Dim lY8
|
||||
Dim lResult
|
||||
|
||||
lX8 = lX And &H80000000
|
||||
lY8 = lY And &H80000000
|
||||
lX4 = lX And &H40000000
|
||||
lY4 = lY And &H40000000
|
||||
|
||||
lResult = (lX And &H3FFFFFFF) + (lY And &H3FFFFFFF)
|
||||
|
||||
If lX4 And lY4 Then
|
||||
lResult = lResult Xor &H80000000 Xor lX8 Xor lY8
|
||||
ElseIf lX4 Or lY4 Then
|
||||
If lResult And &H40000000 Then
|
||||
lResult = lResult Xor &HC0000000 Xor lX8 Xor lY8
|
||||
Else
|
||||
lResult = lResult Xor &H40000000 Xor lX8 Xor lY8
|
||||
End If
|
||||
Else
|
||||
lResult = lResult Xor lX8 Xor lY8
|
||||
End If
|
||||
|
||||
AddUnsigned = lResult
|
||||
End Function
|
||||
|
||||
Private Function Ch(x, y, z)
|
||||
Ch = ((x And y) Xor ((Not x) And z))
|
||||
End Function
|
||||
|
||||
Private Function Maj(x, y, z)
|
||||
Maj = ((x And y) Xor (x And z) Xor (y And z))
|
||||
End Function
|
||||
|
||||
Private Function S(x, n)
|
||||
S = (RShift(x, (n And m_lOnBits(4))) Or LShift(x, (32 - (n And m_lOnBits(4)))))
|
||||
End Function
|
||||
|
||||
Private Function R(x, n)
|
||||
R = RShift(x, CInt(n And m_lOnBits(4)))
|
||||
End Function
|
||||
|
||||
Private Function Sigma0(x)
|
||||
Sigma0 = (S(x, 2) Xor S(x, 13) Xor S(x, 22))
|
||||
End Function
|
||||
|
||||
Private Function Sigma1(x)
|
||||
Sigma1 = (S(x, 6) Xor S(x, 11) Xor S(x, 25))
|
||||
End Function
|
||||
|
||||
Private Function Gamma0(x)
|
||||
Gamma0 = (S(x, 7) Xor S(x, 18) Xor R(x, 3))
|
||||
End Function
|
||||
|
||||
Private Function Gamma1(x)
|
||||
Gamma1 = (S(x, 17) Xor S(x, 19) Xor R(x, 10))
|
||||
End Function
|
||||
|
||||
Private Function ConvertToWordArray(sMessage)
|
||||
Dim lMessageLength
|
||||
Dim lNumberOfWords
|
||||
Dim lWordArray()
|
||||
Dim lBytePosition
|
||||
Dim lByteCount
|
||||
Dim lWordCount
|
||||
Dim lByte
|
||||
|
||||
Const MODULUS_BITS = 512
|
||||
Const CONGRUENT_BITS = 448
|
||||
|
||||
lMessageLength = Len(sMessage)
|
||||
|
||||
lNumberOfWords = (((lMessageLength + ((MODULUS_BITS - CONGRUENT_BITS) \ BITS_TO_A_BYTE)) \ (MODULUS_BITS \ BITS_TO_A_BYTE)) + 1) * (MODULUS_BITS \ BITS_TO_A_WORD)
|
||||
ReDim lWordArray(lNumberOfWords - 1)
|
||||
|
||||
lBytePosition = 0
|
||||
lByteCount = 0
|
||||
Do Until lByteCount >= lMessageLength
|
||||
lWordCount = lByteCount \ BYTES_TO_A_WORD
|
||||
|
||||
lBytePosition = (3 - (lByteCount Mod BYTES_TO_A_WORD)) * BITS_TO_A_BYTE
|
||||
|
||||
lByte = AscB(Mid(sMessage, lByteCount + 1, 1))
|
||||
|
||||
lWordArray(lWordCount) = lWordArray(lWordCount) Or LShift(lByte, lBytePosition)
|
||||
lByteCount = lByteCount + 1
|
||||
Loop
|
||||
|
||||
lWordCount = lByteCount \ BYTES_TO_A_WORD
|
||||
lBytePosition = (3 - (lByteCount Mod BYTES_TO_A_WORD)) * BITS_TO_A_BYTE
|
||||
|
||||
lWordArray(lWordCount) = lWordArray(lWordCount) Or LShift(&H80, lBytePosition)
|
||||
|
||||
lWordArray(lNumberOfWords - 1) = LShift(lMessageLength, 3)
|
||||
lWordArray(lNumberOfWords - 2) = RShift(lMessageLength, 29)
|
||||
|
||||
ConvertToWordArray = lWordArray
|
||||
End Function
|
||||
|
||||
Public Function SHA256(sMessage)
|
||||
Dim HASH(7)
|
||||
Dim M
|
||||
Dim W(63)
|
||||
Dim a
|
||||
Dim b
|
||||
Dim c
|
||||
Dim d
|
||||
Dim e
|
||||
Dim f
|
||||
Dim g
|
||||
Dim h
|
||||
Dim i
|
||||
Dim j
|
||||
Dim T1
|
||||
Dim T2
|
||||
|
||||
HASH(0) = &H6A09E667
|
||||
HASH(1) = &HBB67AE85
|
||||
HASH(2) = &H3C6EF372
|
||||
HASH(3) = &HA54FF53A
|
||||
HASH(4) = &H510E527F
|
||||
HASH(5) = &H9B05688C
|
||||
HASH(6) = &H1F83D9AB
|
||||
HASH(7) = &H5BE0CD19
|
||||
|
||||
M = ConvertToWordArray(sMessage)
|
||||
|
||||
For i = 0 To UBound(M) Step 16
|
||||
a = HASH(0)
|
||||
b = HASH(1)
|
||||
c = HASH(2)
|
||||
d = HASH(3)
|
||||
e = HASH(4)
|
||||
f = HASH(5)
|
||||
g = HASH(6)
|
||||
h = HASH(7)
|
||||
|
||||
For j = 0 To 63
|
||||
If j < 16 Then
|
||||
W(j) = M(j + i)
|
||||
Else
|
||||
W(j) = AddUnsigned(AddUnsigned(AddUnsigned(Gamma1(W(j - 2)), W(j - 7)), Gamma0(W(j - 15))), W(j - 16))
|
||||
End If
|
||||
|
||||
T1 = AddUnsigned(AddUnsigned(AddUnsigned(AddUnsigned(h, Sigma1(e)), Ch(e, f, g)), K(j)), W(j))
|
||||
T2 = AddUnsigned(Sigma0(a), Maj(a, b, c))
|
||||
|
||||
h = g
|
||||
g = f
|
||||
f = e
|
||||
e = AddUnsigned(d, T1)
|
||||
d = c
|
||||
c = b
|
||||
b = a
|
||||
a = AddUnsigned(T1, T2)
|
||||
Next
|
||||
|
||||
HASH(0) = AddUnsigned(a, HASH(0))
|
||||
HASH(1) = AddUnsigned(b, HASH(1))
|
||||
HASH(2) = AddUnsigned(c, HASH(2))
|
||||
HASH(3) = AddUnsigned(d, HASH(3))
|
||||
HASH(4) = AddUnsigned(e, HASH(4))
|
||||
HASH(5) = AddUnsigned(f, HASH(5))
|
||||
HASH(6) = AddUnsigned(g, HASH(6))
|
||||
HASH(7) = AddUnsigned(h, HASH(7))
|
||||
Next
|
||||
|
||||
SHA256 = LCase(Right("00000000" & Hex(HASH(0)), 8) & Right("00000000" & Hex(HASH(1)), 8) & Right("00000000" & Hex(HASH(2)), 8) & Right("00000000" & Hex(HASH(3)), 8) & Right("00000000" & Hex(HASH(4)), 8) & Right("00000000" & Hex(HASH(5)), 8) & Right("00000000" & Hex(HASH(6)), 8) & Right("00000000" & Hex(HASH(7)), 8))
|
||||
End Function
|
||||
|
||||
End Class
|
||||
%>
|
||||
104
Lib/visit_click_log.asp
Normal file
104
Lib/visit_click_log.asp
Normal file
@@ -0,0 +1,104 @@
|
||||
<!-- #include Virtual="./Lib/Config.asp" -->
|
||||
<%
|
||||
'모바일인지 pc인지 체크하기
|
||||
Dim mobileYN, mob_id, mob, splitmo, agent, sUserAgent, iNo, osVal, l_host, l_referer, l_ip_reg, l_now_page
|
||||
Dim data_pkey, data_idkey
|
||||
Dim etc_1, etc_2, etc_3 , etc_4
|
||||
dim PRJCODE, IDKEY
|
||||
|
||||
On Error Resume Next
|
||||
|
||||
Dim CID : CID = Request("CID")
|
||||
Dim ISCAPI : ISCAPI = "999"
|
||||
PRJCODE = request("PRJCODE")
|
||||
data_idkey = request("IDKEY")
|
||||
etc_1 = request("etc_1")
|
||||
etc_2 = request("etc_2")
|
||||
etc_3 = request("etc_3")
|
||||
etc_4 = request("etc_4")
|
||||
|
||||
if CID = "wi11u215oh" then
|
||||
ISCAPI = "ALL"
|
||||
elseif CID = "83ex9w1qe2" then
|
||||
ISCAPI = "0"
|
||||
elseif CID = "85089yodxm" then
|
||||
ISCAPI = "1"
|
||||
elseif CID = "9xno5431w7" then
|
||||
ISCAPI = "2"
|
||||
elseif CID = "d66u9c5w0" then
|
||||
ISCAPI = "3"
|
||||
elseif CID = "E40caw63qg4" then
|
||||
ISCAPI = "4"
|
||||
elseif CID = "h6yubq8a2me" then
|
||||
ISCAPI = "5"
|
||||
end if
|
||||
|
||||
|
||||
if iscapi = "999" then
|
||||
'response.write "유효하지 않은 링크입니다. 관리자에게 문의하세요."
|
||||
response.write "{""result"":""9999"", ""msg"":""유효하지 않은 링크입니다. 관리자에게 문의하세요.""}"
|
||||
response.end
|
||||
end if
|
||||
|
||||
|
||||
data_pkey = PRJCODE
|
||||
|
||||
mobileYN = "pc"
|
||||
mob_id = ""
|
||||
|
||||
|
||||
'mob = "iPad|iPod|iPhone|Android|BlackBerry|SymbianOS|SCH-M\d+|Opera Mini|Windows CE|Nokia|SonyEricsson|webOS|PalmOS"
|
||||
mob = "iPad|iPhone|iPod|Android|Windows CE|BlackBerry|SymbianOS|Symbian|SCH-M\d+|Windows Phone|webOS|Opera Mini|Opera Mobi|POLARIS|IEMobile|lgtelecom|nokia|SonyEricsson|PalmOS|LG|SAMSUNG|Samsung"
|
||||
splitmo = split(mob,"|")
|
||||
agent = Request.ServerVariables("HTTP_USER_AGENT")
|
||||
For iNo = 0 to UBound(splitmo )
|
||||
If InStr(agent,splitmo (iNo)) > 0 Then
|
||||
mobileYN = "mobile"
|
||||
mob_id = splitmo (iNo)
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
|
||||
sUserAgent = UCase(Request.ServerVariables("HTTP_USER_AGENT"))
|
||||
if Instr(sUserAgent,"ANDROID") > 0 then
|
||||
osVal = "ANDROID"
|
||||
elseif Instr(sUserAgent,"IPAD") > 0 or Instr(sUserAgent,"IPHONE") > 0 then
|
||||
osVal = "IOS"
|
||||
else
|
||||
osVal = "ETC"
|
||||
end if
|
||||
|
||||
l_host = Request.ServerVariables("HTTP_HOST") //호스트 정보 추출
|
||||
l_referer = Request.ServerVariables("HTTP_REFERER") //이전 페이지 정보(url 입력으로 접근은 값 없음)
|
||||
l_ip_reg = Request.ServerVariables("REMOTE_ADDR") // IP 주소 추출
|
||||
l_now_page = request.servervariables("HTTP_HOST") & request.servervariables("HTTP_url")
|
||||
|
||||
|
||||
Dim strSQL_log
|
||||
|
||||
'//-- strSQL_log = "INSERT INTO kon.dbo.visit_log (user_agent, osVal, mob_id, mobileYN, host, referer, logdate, ip, etc_1, DATA_IDKEY, DATA_PKEY, now_page) VALUES( "
|
||||
strSQL_log = "INSERT INTO Kon.dbo.visit_click_log(DATA_IDKEY, DATA_PKEY, mobileYN, host, now_page, logdate, ip, etc_1, etc_2, etc_3) VALUES( "
|
||||
strSQL_log = strSQL_log & "'" & data_idkey & "', "
|
||||
strSQL_log = strSQL_log & "'" & data_pkey & "', "
|
||||
strSQL_log = strSQL_log & "'" & mobileYN & "', "
|
||||
strSQL_log = strSQL_log & "'" & l_host & "', "
|
||||
strSQL_log = strSQL_log & "'" & l_now_page & "', "
|
||||
strSQL_log = strSQL_log & " getdate(), "
|
||||
strSQL_log = strSQL_log & "'" & l_ip_reg & "', "
|
||||
strSQL_log = strSQL_log & "'" & etc_1 & "', "
|
||||
strSQL_log = strSQL_log & "'" & etc_2 & "', "
|
||||
strSQL_log = strSQL_log & "'" & etc_3 & "' "
|
||||
|
||||
strSQL_log = strSQL_log & " )"
|
||||
|
||||
'response.write data_idkey &"-------------"
|
||||
'response.write strSQL_log
|
||||
response.write "{""result"":""0000"", ""msg"":""Success""}"
|
||||
|
||||
|
||||
Call DBConnect2()
|
||||
|
||||
DBConn.Execute strSQL_log
|
||||
|
||||
call DBClose()
|
||||
%>
|
||||
88
Lib/visit_log.asp
Normal file
88
Lib/visit_log.asp
Normal file
@@ -0,0 +1,88 @@
|
||||
|
||||
<%
|
||||
'모바일인지 pc인지 체크하기
|
||||
Dim mobileYN, mob_id, mob, splitmo, agent, sUserAgent, iNo, osVal, l_host, l_referer, l_ip_reg, l_now_page
|
||||
Dim data_pkey, data_idkey, data_surveytype, data_pagename, data_qnumber
|
||||
|
||||
|
||||
On Error Resume Next
|
||||
|
||||
data_pkey = PRJCODE
|
||||
data_idkey = IDKEY
|
||||
data_surveytype = SURVEYTYPE
|
||||
data_pagename = PAGENAME
|
||||
data_qnumber = QNUMBER
|
||||
|
||||
mobileYN = "pc"
|
||||
mob_id = ""
|
||||
|
||||
|
||||
'mob = "iPad|iPod|iPhone|Android|BlackBerry|SymbianOS|SCH-M\d+|Opera Mini|Windows CE|Nokia|SonyEricsson|webOS|PalmOS"
|
||||
mob = "iPad|iPhone|iPod|Android|Windows CE|BlackBerry|SymbianOS|Symbian|SCH-M\d+|Windows Phone|webOS|Opera Mini|Opera Mobi|POLARIS|IEMobile|lgtelecom|nokia|SonyEricsson|PalmOS|LG|SAMSUNG|Samsung"
|
||||
splitmo = split(mob,"|")
|
||||
agent = Request.ServerVariables("HTTP_USER_AGENT")
|
||||
For iNo = 0 to UBound(splitmo )
|
||||
If InStr(agent,splitmo (iNo)) > 0 Then
|
||||
mobileYN = "mobile"
|
||||
mob_id = splitmo (iNo)
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
|
||||
sUserAgent = UCase(Request.ServerVariables("HTTP_USER_AGENT"))
|
||||
if Instr(sUserAgent,"ANDROID") > 0 then
|
||||
osVal = "ANDROID"
|
||||
elseif Instr(sUserAgent,"IPAD") > 0 or Instr(sUserAgent,"IPHONE") > 0 then
|
||||
osVal = "IOS"
|
||||
else
|
||||
osVal = "ETC"
|
||||
end if
|
||||
|
||||
l_host = Request.ServerVariables("HTTP_HOST") //호스트 정보 추출
|
||||
l_referer = Request.ServerVariables("HTTP_REFERER") //이전 페이지 정보(url 입력으로 접근은 값 없음)
|
||||
l_ip_reg = Request.ServerVariables("REMOTE_ADDR") // IP 주소 추출
|
||||
l_now_page = request.servervariables("HTTP_HOST") & request.servervariables("HTTP_url")
|
||||
|
||||
%>
|
||||
<!--
|
||||
<%'=sUserAgent %> -----
|
||||
<%'=osVal %> -----
|
||||
<%'=mob_id %> -----
|
||||
<%'=mobileYN %> -----
|
||||
<%'=agent %>
|
||||
<%'=l_host %>
|
||||
<%'=l_referer %>
|
||||
<%'=l_ip_reg %>
|
||||
<%'=l_now_page %>
|
||||
-->
|
||||
<%
|
||||
|
||||
Dim strSQL_log
|
||||
|
||||
strSQL_log = "INSERT INTO kon.dbo.visit_log (user_agent, osVal, mob_id, mobileYN, host, referer, logdate, ip, etc_1, etc_2, DATA_IDKEY, DATA_PKEY, now_page) VALUES( "
|
||||
strSQL_log = strSQL_log & "'" & agent & "', "
|
||||
strSQL_log = strSQL_log & "'" & osVal & "', "
|
||||
strSQL_log = strSQL_log & "'" & mob_id & "', "
|
||||
strSQL_log = strSQL_log & "'" & mobileYN & "', "
|
||||
strSQL_log = strSQL_log & "'" & l_host & "', "
|
||||
strSQL_log = strSQL_log & "'" & l_referer & "', "
|
||||
strSQL_log = strSQL_log & " getdate(), "
|
||||
strSQL_log = strSQL_log & "'" & l_ip_reg & "', "
|
||||
|
||||
strSQL_log = strSQL_log & "'" & data_surveytype & "', "
|
||||
strSQL_log = strSQL_log & "'" & data_pagename & "', "
|
||||
strSQL_log = strSQL_log & "'" & data_idkey & "', "
|
||||
strSQL_log = strSQL_log & "'" & data_pkey & "', "
|
||||
|
||||
strSQL_log = strSQL_log & "'" & l_now_page & "'"
|
||||
strSQL_log = strSQL_log & " )"
|
||||
|
||||
'response.write strSQL_log
|
||||
|
||||
|
||||
Call DBConnect2()
|
||||
|
||||
DBConn.Execute strSQL_log
|
||||
|
||||
call DBClose()
|
||||
%>
|
||||
450
Lib/백업/DBHelper_20171119.asp
Normal file
450
Lib/백업/DBHelper_20171119.asp
Normal file
@@ -0,0 +1,450 @@
|
||||
<!--METADATA TYPE= "typelib" NAME= "ADODB Type Library"
|
||||
FILE="C:\Program Files\Common Files\SYSTEM\ADO\msado15.dll" -->
|
||||
<%
|
||||
Class clsDBHelper
|
||||
Private DefaultConnString
|
||||
Private DefaultConnection
|
||||
Private m_ServerIP
|
||||
Private m_DBName
|
||||
Private m_UserID
|
||||
Private m_UserPW
|
||||
Dim cmd
|
||||
Dim rs
|
||||
|
||||
Private sub Class_Initialize()
|
||||
'----------------------------------------------------
|
||||
'SQL OLE DB ConnString
|
||||
'----------------------------------------------------
|
||||
'DefaultConnString = "Provider=SQLOLEDB;Data Source=" & m_ServerIP & ";Initial Catalog=" & m_DBName & ";User Id=" & m_UserID & ";Password=" & m_UserPW & ";"
|
||||
|
||||
'----------------------------------------------------
|
||||
'MS SQL DB ConnString
|
||||
'----------------------------------------------------
|
||||
DefaultConnString = "Driver=SQL Server; Server=" & m_ServerIP & "; Database=" & m_DBName & "; UID=" & m_UserID & "; PWD=" & m_UserPW
|
||||
Set DefaultConnection = Nothing
|
||||
End Sub
|
||||
|
||||
'소멸자
|
||||
Private Sub Class_Terminate()
|
||||
Set DefaultConnection = Nothing
|
||||
End Sub
|
||||
|
||||
'---------------------------------------------------
|
||||
' 서버 설정
|
||||
'---------------------------------------------------
|
||||
Public Property Set Server(mServer)
|
||||
m_ServerIP = mServer
|
||||
End Property
|
||||
|
||||
Public Property Set DBName(mDBName)
|
||||
m_DBName = mDBName
|
||||
End Property
|
||||
|
||||
Public Property Set UserID(mUserID)
|
||||
m_UserID = mUserID
|
||||
End Property
|
||||
|
||||
Public Property Set UserPW(mUserPW)
|
||||
m_UserPW = mUserPW
|
||||
End Property
|
||||
|
||||
'---------------------------------------------------
|
||||
' SP를 실행하고, RecordSet을 반환한다.
|
||||
'---------------------------------------------------
|
||||
Public Function ExecSPReturnRS(spName, params, connectionString)
|
||||
If IsObject(connectionString) Then
|
||||
If connectionString is Nothing Then
|
||||
If DefaultConnection is Nothing Then
|
||||
Set DefaultConnection = CreateObject("ADODB.Connection")
|
||||
DefaultConnection.Open DefaultConnString
|
||||
End If
|
||||
Set connectionString = DefaultConnection
|
||||
End If
|
||||
End If
|
||||
|
||||
Set rs = CreateObject("ADODB.RecordSet")
|
||||
Set cmd = CreateObject("ADODB.Command")
|
||||
|
||||
cmd.ActiveConnection = connectionString
|
||||
cmd.CommandText = spName
|
||||
cmd.CommandType = adCmdStoredProc
|
||||
Set cmd = collectParams(cmd, params)
|
||||
'cmd.Parameters.Refresh
|
||||
|
||||
rs.CursorLocation = adUseClient
|
||||
rs.Open cmd, ,adOpenStatic, adLockReadOnly
|
||||
|
||||
For i = 0 To cmd.Parameters.Count - 1
|
||||
If cmd.Parameters(i).Direction = adParamOutput OR cmd.Parameters(i).Direction = adParamInputOutput OR cmd.Parameters(i).Direction = adParamReturnValue Then
|
||||
If IsObject(params) Then
|
||||
If params is Nothing Then
|
||||
Exit For
|
||||
End If
|
||||
Else
|
||||
params(i)(4) = cmd.Parameters(i).Value
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
Set cmd.ActiveConnection = Nothing
|
||||
Set cmd = Nothing
|
||||
If rs.State = adStateClosed Then
|
||||
Set rs.Source = Nothing
|
||||
End If
|
||||
Set rs.ActiveConnection = Nothing
|
||||
|
||||
Set ExecSPReturnRS = rs
|
||||
End Function
|
||||
|
||||
'---------------------------------------------------
|
||||
' SQL Query를 실행하고, RecordSet을 반환한다.
|
||||
'---------------------------------------------------
|
||||
Public Function ExecSQLReturnRS(strSQL, params, connectionString)
|
||||
If IsObject(connectionString) Then
|
||||
If connectionString is Nothing Then
|
||||
If DefaultConnection is Nothing Then
|
||||
Set DefaultConnection = CreateObject("ADODB.Connection")
|
||||
DefaultConnection.Open DefaultConnString
|
||||
End If
|
||||
Set connectionString = DefaultConnection
|
||||
End If
|
||||
End If
|
||||
|
||||
Set rs = CreateObject("ADODB.RecordSet")
|
||||
Set cmd = CreateObject("ADODB.Command")
|
||||
|
||||
cmd.ActiveConnection = connectionString
|
||||
cmd.Prepared = true
|
||||
cmd.CommandText = strSQL
|
||||
cmd.CommandType = adCmdText
|
||||
|
||||
Set cmd = collectParams(cmd, params)
|
||||
|
||||
' On Error Resume Next
|
||||
|
||||
' Response.Write strSQL & "<BR>"
|
||||
|
||||
rs.CursorLocation = adUseClient
|
||||
rs.Open cmd, , adOpenStatic, adLockReadOnly
|
||||
|
||||
If Err.Number<>0 Then
|
||||
ErrorLog DefaultConnection.Number, DefaultConnection.Description
|
||||
End IF
|
||||
|
||||
Set cmd.ActiveConnection = Nothing
|
||||
Set cmd = Nothing
|
||||
If rs.State = adStateClosed Then
|
||||
Set rs.Source = Nothing
|
||||
End If
|
||||
|
||||
Set rs.ActiveConnection = Nothing
|
||||
|
||||
Set ExecSQLReturnRS = rs
|
||||
End Function
|
||||
|
||||
'---------------------------------------------------
|
||||
' SQL Query를 실행하고, RecordSet Array을 반환한다.
|
||||
'---------------------------------------------------
|
||||
Public Function ExecSQLReturnAR(strSQL, params, connectionString)
|
||||
If IsObject(connectionString) Then
|
||||
If connectionString is Nothing Then
|
||||
If DefaultConnection is Nothing Then
|
||||
Set DefaultConnection = CreateObject("ADODB.Connection")
|
||||
DefaultConnection.Open DefaultConnString
|
||||
End If
|
||||
Set connectionString = DefaultConnection
|
||||
End If
|
||||
End If
|
||||
|
||||
Set rs = CreateObject("ADODB.RecordSet")
|
||||
Set cmd = CreateObject("ADODB.Command")
|
||||
|
||||
cmd.ActiveConnection = connectionString
|
||||
cmd.Prepared = true
|
||||
cmd.CommandText = strSQL
|
||||
cmd.CommandType = adCmdText
|
||||
|
||||
Set cmd = collectParams(cmd, params)
|
||||
|
||||
' On Error Resume Next
|
||||
|
||||
'Response.Write strSQL & "<BR>"& "<BR>"& "<BR>"& "<BR>"
|
||||
|
||||
rs.CursorLocation = adUseClient
|
||||
rs.Open cmd, , adOpenStatic, adLockReadOnly
|
||||
|
||||
If Err.Number<>0 Then
|
||||
ErrorLog DefaultConnection.Number, DefaultConnection.Description
|
||||
End IF
|
||||
|
||||
Set cmd.ActiveConnection = Nothing
|
||||
Set cmd = Nothing
|
||||
If rs.State = adStateClosed Then
|
||||
Set rs.Source = Nothing
|
||||
End If
|
||||
|
||||
Set rs.ActiveConnection = Nothing
|
||||
|
||||
Set ExecSQLReturnAR = rs.getRows
|
||||
End Function
|
||||
|
||||
'---------------------------------------------------
|
||||
' SQL Query를 실행하고, RecordSet String을 반환한다.
|
||||
'---------------------------------------------------
|
||||
Public Function ExecSQLReturnST(strSQL, params, connectionString)
|
||||
If IsObject(connectionString) Then
|
||||
If connectionString is Nothing Then
|
||||
If DefaultConnection is Nothing Then
|
||||
Set DefaultConnection = CreateObject("ADODB.Connection")
|
||||
DefaultConnection.Open DefaultConnString
|
||||
End If
|
||||
Set connectionString = DefaultConnection
|
||||
End If
|
||||
End If
|
||||
|
||||
Set rs = CreateObject("ADODB.RecordSet")
|
||||
Set cmd = CreateObject("ADODB.Command")
|
||||
|
||||
cmd.ActiveConnection = connectionString
|
||||
cmd.Prepared = true
|
||||
cmd.CommandText = strSQL
|
||||
cmd.CommandType = adCmdText
|
||||
|
||||
Set cmd = collectParams(cmd, params)
|
||||
|
||||
' On Error Resume Next
|
||||
|
||||
'Response.Write strSQL & "<BR>"& "<BR>"& "<BR>"& "<BR>"
|
||||
|
||||
rs.CursorLocation = adUseClient
|
||||
rs.Open cmd, , adOpenStatic, adLockReadOnly
|
||||
|
||||
If Err.Number<>0 Then
|
||||
ErrorLog DefaultConnection.Number, DefaultConnection.Description
|
||||
End IF
|
||||
|
||||
Set cmd.ActiveConnection = Nothing
|
||||
Set cmd = Nothing
|
||||
If rs.State = adStateClosed Then
|
||||
Set rs.Source = Nothing
|
||||
End If
|
||||
|
||||
Set rs.ActiveConnection = Nothing
|
||||
|
||||
Set ExecSQLReturnAR = rs.getString(2)
|
||||
End Function
|
||||
|
||||
'---------------------------------------------------
|
||||
' SP를 실행한다.(RecordSet 반환없음)
|
||||
'---------------------------------------------------
|
||||
Public Sub ExecSP(strSP,params,connectionString)
|
||||
If IsObject(connectionString) Then
|
||||
If connectionString is Nothing Then
|
||||
If DefaultConnection is Nothing Then
|
||||
Set DefaultConnection = CreateObject("ADODB.Connection")
|
||||
DefaultConnection.Open DefaultConnString
|
||||
End If
|
||||
Set connectionString = DefaultConnection
|
||||
End If
|
||||
End If
|
||||
|
||||
Set cmd = CreateObject("ADODB.Command")
|
||||
|
||||
cmd.ActiveConnection = connectionString
|
||||
cmd.CommandText = strSP
|
||||
cmd.CommandType = adCmdStoredProc
|
||||
Set cmd = collectParams(cmd, params)
|
||||
|
||||
cmd.Execute , , adExecuteNoRecords
|
||||
|
||||
For i = 0 To cmd.Parameters.Count - 1
|
||||
If cmd.Parameters(i).Direction = adParamOutput OR cmd.Parameters(i).Direction = adParamInputOutput OR cmd.Parameters(i).Direction = adParamReturnValue Then
|
||||
If IsObject(params) Then
|
||||
If params is Nothing Then
|
||||
Exit For
|
||||
End If
|
||||
Else
|
||||
params(i)(4) = cmd.Parameters(i).Value
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
Set cmd.ActiveConnection = Nothing
|
||||
Set cmd = Nothing
|
||||
End Sub
|
||||
|
||||
'---------------------------------------------------
|
||||
' SQL Query를 실행한다.(RecordSet 반환없음)
|
||||
'---------------------------------------------------
|
||||
Public Sub ExecSQL(strSQL,params,connectionString)
|
||||
If IsObject(connectionString) Then
|
||||
If connectionString is Nothing Then
|
||||
If DefaultConnection is Nothing Then
|
||||
Set DefaultConnection = CreateObject("ADODB.Connection")
|
||||
DefaultConnection.Open DefaultConnString
|
||||
End If
|
||||
Set connectionString = DefaultConnection
|
||||
End If
|
||||
End If
|
||||
|
||||
On Error Resume Next
|
||||
|
||||
Set cmd = CreateObject("ADODB.Command")
|
||||
|
||||
cmd.ActiveConnection = connectionString
|
||||
cmd.CommandText = strSQL
|
||||
cmd.CommandType = adCmdText
|
||||
Set cmd = collectParams(cmd, params)
|
||||
cmd.Execute , , adExecuteNoRecords
|
||||
|
||||
' If DefaultConnection.Errors.Count <> 0 Then
|
||||
' For each objErr in DefaultConnection.Errors
|
||||
' response.write("<p>")
|
||||
' response.write("Description: ")
|
||||
' response.write(objErr.Description & "<br>")
|
||||
' response.write("Help context: ")
|
||||
' response.write(objErr.HelpContext & "<br>")
|
||||
' response.write("Help file: ")
|
||||
' response.write(objErr.HelpFile & "<br>")
|
||||
' response.write("Native error: ")
|
||||
' response.write(objErr.NativeError & "<br>")
|
||||
' response.write("Error number: ")
|
||||
' response.write(objErr.Number & "<br>")
|
||||
' response.write("Error source: ")
|
||||
' response.write(objErr.Source & "<br>")
|
||||
' response.write("SQL state: ")
|
||||
' response.write(objErr.SQLState & "<br>")
|
||||
' response.write("</p>")
|
||||
' Next
|
||||
' Response.End
|
||||
' End IF
|
||||
|
||||
if err.number <> 0 then
|
||||
response.Write("<b>SQL :</B>"&strSQL&"<br>")
|
||||
response.Write("<b>err.description :</B>"&err.Description&"<br>")
|
||||
response.Write("<b>err.number : </b>"&err.Number&"<br>")
|
||||
response.Write("<b>err.Source : </b>"&err.Source&"<br>")
|
||||
Response.End
|
||||
End IF
|
||||
|
||||
Set cmd.ActiveConnection = Nothing
|
||||
Set cmd = Nothing
|
||||
End Sub
|
||||
|
||||
'---------------------------------------------------
|
||||
' 트랜잭션을 시작하고, Connetion 개체를 반환한다.
|
||||
'---------------------------------------------------
|
||||
Public Function BeginTrans(connectionString)
|
||||
If IsObject(connectionString) Then
|
||||
If connectionString is Nothing Then
|
||||
connectionString = DefaultConnString
|
||||
End If
|
||||
End If
|
||||
|
||||
Set conn = CreateObject("ADODB.Connection")
|
||||
conn.Open connectionString
|
||||
conn.BeginTrans
|
||||
Set BeginTrans = conn
|
||||
End Function
|
||||
|
||||
'---------------------------------------------------
|
||||
' 활성화된 트랜잭션을 커밋한다.
|
||||
'---------------------------------------------------
|
||||
Public Sub CommitTrans(connectionObj)
|
||||
If Not connectionObj Is Nothing Then
|
||||
connectionObj.CommitTrans
|
||||
connectionObj.Close
|
||||
Set ConnectionObj = Nothing
|
||||
End If
|
||||
End Sub
|
||||
|
||||
'---------------------------------------------------
|
||||
' 활성화된 트랜잭션을 롤백한다.
|
||||
'---------------------------------------------------
|
||||
Public Sub RollbackTrans(connectionObj)
|
||||
If Not connectionObj Is Nothing Then
|
||||
connectionObj.RollbackTrans
|
||||
connectionObj.Close
|
||||
Set ConnectionObj = Nothing
|
||||
End If
|
||||
End Sub
|
||||
|
||||
'---------------------------------------------------
|
||||
' 배열로 매개변수를 만든다.
|
||||
'---------------------------------------------------
|
||||
Public Function MakeParam(PName,PType,PDirection,PSize,PValue)
|
||||
MakeParam = Array(PName, PType, PDirection, PSize, PValue)
|
||||
End Function
|
||||
|
||||
'---------------------------------------------------
|
||||
' 매개변수 배열 내에서 지정된 이름의 매개변수 값을 반환한다.
|
||||
'---------------------------------------------------
|
||||
Public Function GetValue(params, paramName)
|
||||
For Each param in params
|
||||
If param(0) = paramName Then
|
||||
GetValue = param(4)
|
||||
Exit Function
|
||||
End If
|
||||
Next
|
||||
End Function
|
||||
|
||||
Public Sub Dispose
|
||||
if (Not DefaultConnection is Nothing) Then
|
||||
if (DefaultConnection.State = adStateOpen) Then DefaultConnection.Close
|
||||
Set DefaultConnection = Nothing
|
||||
End if
|
||||
End Sub
|
||||
|
||||
'---------------------------------------------------------------------------
|
||||
'Array로 넘겨오는 파라메터를 Parsing 하여 Parameter 객체를
|
||||
'생성하여 Command 객체에 추가한다.
|
||||
'---------------------------------------------------------------------------
|
||||
Private Function collectParams(cmd,argparams)
|
||||
Dim params
|
||||
Dim i,l,u,v
|
||||
If VarType(argparams) = 8192 or VarType(argparams) = 8204 or VarType(argparams) = 8209 then
|
||||
params = argparams
|
||||
For i = LBound(params) To UBound(params)
|
||||
l = LBound(params(i))
|
||||
u = UBound(params(i))
|
||||
' Check for nulls.
|
||||
If u - l = 4 Then
|
||||
|
||||
If VarType(params(i)(4)) = vbString Then
|
||||
If params(i)(4) = "" Then
|
||||
v = Null
|
||||
Else
|
||||
v = Trim(params(i)(4))
|
||||
End If
|
||||
Else
|
||||
v = params(i)(4)
|
||||
End If
|
||||
' On Error Resume Next
|
||||
' If err.number <> 0 then
|
||||
' Response.Write params(i)(0) & ":" & params(i)(1) & ":" & params(i)(2) & ":" & params(i)(3)& ":" &v&"<BR>"
|
||||
' End If
|
||||
|
||||
If VarType(params(i)(4)) = vbString And params(i)(4) = "" Then
|
||||
Set cnParam = cmd.CreateParameter(params(i)(0))
|
||||
cnParam.attributes=adParamNullable
|
||||
cnParam.type = params(i)(1)
|
||||
cnParam.Direction = params(i)(2)
|
||||
cnParam.Size=1
|
||||
cnParam.value=Null
|
||||
cmd.Parameters.Append cnParam 'cmd.CreateParameter(params(i)(0), params(i)(1), params(i)(2), params(i)(3), Null)
|
||||
Else
|
||||
cmd.Parameters.Append cmd.CreateParameter(params(i)(0), params(i)(1), params(i)(2), params(i)(3), v)
|
||||
End If
|
||||
|
||||
End If
|
||||
Next
|
||||
|
||||
Set collectParams = cmd
|
||||
Exit Function
|
||||
Else
|
||||
Set collectParams = cmd
|
||||
End If
|
||||
End Function
|
||||
|
||||
End Class
|
||||
%>
|
||||
1180
Lib/백업/SiteFunc_20171018.asp
Normal file
1180
Lib/백업/SiteFunc_20171018.asp
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user