<%
public function CltrID()
	dim tempcltrid
	tempcltrid = date()*1&left(time()*1000000000,9)
	CltrID = tempcltrid
END function

public function getENCID(tempcid,password)
	tempmd5=SMS_MD5(tempcid&"-"&password)
	getENCID = tempmd5
end function

'返回XML中的节点之间的内容
public function getMessage(CutXml,svalue)
	getMessage = getValue(svalue,CutXml)
end function

public function getTypeMessage(CutXml,svalue1,svalue2)
		str1 = "<"&svalue1&">"
		str2 = "</"&svalue2&">"
		start=Instr(lcase(CutXml),str1)
		tempxml=right(CutXml,len(CutXml)-start-len(str1)+1)
		start=Instr(lcase(tempxml),str2)
		if start>0 then
			getTypeMessage=trim(left(tempxml,start-1))
		end if
end function
	'是否有成功消息返回
	function isSuccess(CutXml)
		isSuccess = split("successfully",CutXml)
	end function

function getValue(svalue,CutXml)
		key = svalue
		'if instr(svalue, "-") then value = left(value, Instr(value, "-")) end if
		str1 = "<"&svalue&">"
		str2 = "</"&svalue&">"
		start_pos = Instr(lcase(CutXml),lcase(str1))
		if start_pos > 0 then
			over_pos = InstrRev(lcase(CutXml),lcase(str2))
			resValue = trim(MID(CutXml,start_pos,(over_pos-start_pos)))
		end if
		getValue = resValue
end function

function parseMol(mvalues,mretype)
	if mvalues(0)="open" then
		for i=1 to count(mvalues)
			key=mvalues(i)
			if isempty(mretype)="" then

           mol(key)() = mvalues(i)("value")
			else
				arr("value") = mvalues(i)("value")
				if isset(mvalues(i)("attributes")) then
					arr("attributes") = mvalues(i)("attributes")
				end if
				mol(key)() = arr
			end if
		next
	end if
	parseMol = mol
end function


function XMLgetValue(values,tags,item)
		for each tags in molranges
			if tags = item then
				for i=0 to num
					data()=values(molranges(i))("value")
				next
			end if
		next
		XMLgetValue data
end function


'建立正则表达式替换字符串
Function ReplaceTest(str1,patrn,replStr)
	Dim regEx ' 建立变量。
	Set regEx = New RegExp ' 建立正则表达式。
	regEx.Pattern = patrn ' 设置模式。
	regEx.IgnoreCase = True ' 设置是否区分大小写。
	ReplaceTest = regEx.Replace(str1, replStr) ' 作替换。
End Function

'取出字符之间的值
Function Newstring(wstr,strng)
			Newstring=Instr(lcase(wstr),lcase(strng))
			if Newstring<=0 then Newstring=Len(wstr)
End Function

Function CheckMobile(x)
		If IsNull(x) Then
				CheckMobile = False
				Exit Function
		End If
		Dim i,strCurrentChar,strTemp
		CheckMobile = True
		For i = 1 To len(x)
				If IsNumeric(Mid(x, i, 1)) = False And Mid(x, i, 1) <> "-" And Mid(x, i, 1) <> "(" And Mid(x, i, 1) <> ")" Then
						CheckMobile = False
						Exit Function
				End If
		Next
		For i = 1 To len(x)
				strCurrentChar = Mid(x, i, 1)
				If Asc("0") <= Asc(strCurrentChar) And Asc(strCurrentChar) <= Asc("9") Then
						strTemp = strTemp & strCurrentChar
				End If
				If Asc("A") <= Asc(strCurrentChar) And Asc(strCurrentChar) <= Asc("Z") Then
						strTemp = strTemp & strCurrentChar
				End If
		Next
		x = strTemp
		If len(x) = 10 And Left(x, 1) = "1" Then
				CheckMobile = False
				Exit Function
		End If
		If len(x) < 10 Then
				CheckMobile = False
				Exit Function
		End If
		If len(x) > 11 Then
				CheckMobile = False
				Exit Function
		End If
End Function

'*********************
'--------------------------------------
' COCOON Disk Manager v3 -- MD5 Function
'--------------------------------------
Private Const SMS_BITS_TO_A_BYTE = 8
Private Const SMS_BYTES_TO_A_WORD = 4
Private Const SMS_BITS_TO_A_WORD = 32

Private SMS_m_lOnBits(30)
Private SMS_m_l2Power(30)

Private Function SMS_LShift(lValue, iShiftBits)
	If iShiftBits = 0 Then
		SMS_LShift = lValue
		Exit Function
	ElseIf iShiftBits = 31 Then
		If lValue And 1 Then
			SMS_LShift = &H80000000
		Else
			SMS_LShift = 0
		End If
		Exit Function
	ElseIf iShiftBits < 0 Or iShiftBits > 31 Then
		Err.Raise 6
	End If

	If (lValue And SMS_m_l2Power(31 - iShiftBits)) Then
		SMS_LShift = ((lValue And SMS_m_lOnBits(31 - (iShiftBits + 1))) * SMS_m_l2Power(iShiftBits)) Or &H80000000
	Else
		SMS_LShift = ((lValue And SMS_m_lOnBits(31 - iShiftBits)) * SMS_m_l2Power(iShiftBits))
	End If
End Function

Private Function SMS_RShift(lValue, iShiftBits)
	If iShiftBits = 0 Then
		SMS_RShift = lValue
		Exit Function
	ElseIf iShiftBits = 31 Then
		If lValue And &H80000000 Then
			SMS_RShift = 1
		Else
			SMS_RShift = 0
		End If
		Exit Function
	ElseIf iShiftBits < 0 Or iShiftBits > 31 Then
		Err.Raise 6
	End If

	SMS_RShift = (lValue And &H7FFFFFFE) \ SMS_m_l2Power(iShiftBits)

	If (lValue And &H80000000) Then
		SMS_RShift = (SMS_RShift Or (&H40000000 \ SMS_m_l2Power(iShiftBits - 1)))
	End If
End Function

Private Function SMS_RotateLeft(lValue, iShiftBits)
	SMS_RotateLeft = SMS_LShift(lValue, iShiftBits) Or SMS_RShift(lValue, (32 - iShiftBits))
End Function

Private Function SMS_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

	SMS_AddUnsigned = lResult
End Function

Private Function SMS_md5_F(x, y, z)
	SMS_md5_F = (x And y) Or ((Not x) And z)
End Function

Private Function SMS_md5_G(x, y, z)
	SMS_md5_G = (x And z) Or (y And (Not z))
End Function

Private Function SMS_md5_H(x, y, z)
	SMS_md5_H = (x Xor y Xor z)
End Function

Private Function SMS_md5_I(x, y, z)
	SMS_md5_I = (y Xor (x Or (Not z)))
End Function

Private Sub SMS_md5_FF(a, b, c, d, x, s, ac)
	a = SMS_AddUnsigned(a, SMS_AddUnsigned(SMS_AddUnsigned(SMS_md5_F(b, c, d), x), ac))
	a = SMS_RotateLeft(a, s)
	a = SMS_AddUnsigned(a, b)
End Sub

Private Sub SMS_md5_GG(a, b, c, d, x, s, ac)
	a = SMS_AddUnsigned(a, SMS_AddUnsigned(SMS_AddUnsigned(SMS_md5_G(b, c, d), x), ac))
	a = SMS_RotateLeft(a, s)
	a = SMS_AddUnsigned(a, b)
End Sub

Private Sub SMS_md5_HH(a, b, c, d, x, s, ac)
	a = SMS_AddUnsigned(a, SMS_AddUnsigned(SMS_AddUnsigned(SMS_md5_H(b, c, d), x), ac))
	a = SMS_RotateLeft(a, s)
	a = SMS_AddUnsigned(a, b)
End Sub

Private Sub SMS_md5_II(a, b, c, d, x, s, ac)
	a = SMS_AddUnsigned(a, SMS_AddUnsigned(SMS_AddUnsigned(SMS_md5_I(b, c, d), x), ac))
	a = SMS_RotateLeft(a, s)
	a = SMS_AddUnsigned(a, b)
End Sub

Private Function SMS_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) \ SMS_BITS_TO_A_BYTE)) \ (MODULUS_BITS \ SMS_BITS_TO_A_BYTE)) + 1) * (MODULUS_BITS \ SMS_BITS_TO_A_WORD)
	ReDim lWordArray(lNumberOfWords - 1)

	lBytePosition = 0
	lByteCount = 0
	Do Until lByteCount >= lMessageLength
		lWordCount = lByteCount \ SMS_BYTES_TO_A_WORD
		lBytePosition = (lByteCount Mod SMS_BYTES_TO_A_WORD) * SMS_BITS_TO_A_BYTE
		lWordArray(lWordCount) = lWordArray(lWordCount) Or SMS_LShift(Asc(Mid(sMessage, lByteCount + 1, 1)), lBytePosition)
		lByteCount = lByteCount + 1
	Loop

	lWordCount = lByteCount \ SMS_BYTES_TO_A_WORD
	lBytePosition = (lByteCount Mod SMS_BYTES_TO_A_WORD) * SMS_BITS_TO_A_BYTE

	lWordArray(lWordCount) = lWordArray(lWordCount) Or SMS_LShift(&H80, lBytePosition)

	lWordArray(lNumberOfWords - 2) = SMS_LShift(lMessageLength, 3)
	lWordArray(lNumberOfWords - 1) = SMS_RShift(lMessageLength, 29)

	SMS_ConvertToWordArray = lWordArray
End Function

Private Function SMS_WordToHex(lValue)
	Dim lByte
	Dim lCount

	For lCount = 0 To 3
		lByte = SMS_RShift(lValue, lCount * SMS_BITS_TO_A_BYTE) And SMS_m_lOnBits(SMS_BITS_TO_A_BYTE - 1)
		SMS_WordToHex = SMS_WordToHex & Right("0" & Hex(lByte), 2)
	Next
End Function

Public Function SMS_MD5(sMessage)
	SMS_m_lOnBits(0) = CLng(1)
	SMS_m_lOnBits(1) = CLng(3)
	SMS_m_lOnBits(2) = CLng(7)
	SMS_m_lOnBits(3) = CLng(15)
	SMS_m_lOnBits(4) = CLng(31)
	SMS_m_lOnBits(5) = CLng(63)
	SMS_m_lOnBits(6) = CLng(127)
	SMS_m_lOnBits(7) = CLng(255)
	SMS_m_lOnBits(8) = CLng(511)
	SMS_m_lOnBits(9) = CLng(1023)
	SMS_m_lOnBits(10) = CLng(2047)
	SMS_m_lOnBits(11) = CLng(4095)
	SMS_m_lOnBits(12) = CLng(8191)
	SMS_m_lOnBits(13) = CLng(16383)
	SMS_m_lOnBits(14) = CLng(32767)
	SMS_m_lOnBits(15) = CLng(65535)
	SMS_m_lOnBits(16) = CLng(131071)
	SMS_m_lOnBits(17) = CLng(262143)
	SMS_m_lOnBits(18) = CLng(524287)
	SMS_m_lOnBits(19) = CLng(1048575)
	SMS_m_lOnBits(20) = CLng(2097151)
	SMS_m_lOnBits(21) = CLng(4194303)
	SMS_m_lOnBits(22) = CLng(8388607)
	SMS_m_lOnBits(23) = CLng(16777215)
	SMS_m_lOnBits(24) = CLng(33554431)
	SMS_m_lOnBits(25) = CLng(67108863)
	SMS_m_lOnBits(26) = CLng(134217727)
	SMS_m_lOnBits(27) = CLng(268435455)
	SMS_m_lOnBits(28) = CLng(536870911)
	SMS_m_lOnBits(29) = CLng(1073741823)
	SMS_m_lOnBits(30) = CLng(2147483647)

	SMS_m_l2Power(0) = CLng(1)
	SMS_m_l2Power(1) = CLng(2)
	SMS_m_l2Power(2) = CLng(4)
	SMS_m_l2Power(3) = CLng(8)
	SMS_m_l2Power(4) = CLng(16)
	SMS_m_l2Power(5) = CLng(32)
	SMS_m_l2Power(6) = CLng(64)
	SMS_m_l2Power(7) = CLng(128)
	SMS_m_l2Power(8) = CLng(256)
	SMS_m_l2Power(9) = CLng(512)
	SMS_m_l2Power(10) = CLng(1024)
	SMS_m_l2Power(11) = CLng(2048)
	SMS_m_l2Power(12) = CLng(4096)
	SMS_m_l2Power(13) = CLng(8192)
	SMS_m_l2Power(14) = CLng(16384)
	SMS_m_l2Power(15) = CLng(32768)
	SMS_m_l2Power(16) = CLng(65536)
	SMS_m_l2Power(17) = CLng(131072)
	SMS_m_l2Power(18) = CLng(262144)
	SMS_m_l2Power(19) = CLng(524288)
	SMS_m_l2Power(20) = CLng(1048576)
	SMS_m_l2Power(21) = CLng(2097152)
	SMS_m_l2Power(22) = CLng(4194304)
	SMS_m_l2Power(23) = CLng(8388608)
	SMS_m_l2Power(24) = CLng(16777216)
	SMS_m_l2Power(25) = CLng(33554432)
	SMS_m_l2Power(26) = CLng(67108864)
	SMS_m_l2Power(27) = CLng(134217728)
	SMS_m_l2Power(28) = CLng(268435456)
	SMS_m_l2Power(29) = CLng(536870912)
	SMS_m_l2Power(30) = CLng(1073741824)


	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 = SMS_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

		SMS_md5_FF a, b, c, d, x(k + 0), S11, &HD76AA478
		SMS_md5_FF d, a, b, c, x(k + 1), S12, &HE8C7B756
		SMS_md5_FF c, d, a, b, x(k + 2), S13, &H242070DB
		SMS_md5_FF b, c, d, a, x(k + 3), S14, &HC1BDCEEE
		SMS_md5_FF a, b, c, d, x(k + 4), S11, &HF57C0FAF
		SMS_md5_FF d, a, b, c, x(k + 5), S12, &H4787C62A
		SMS_md5_FF c, d, a, b, x(k + 6), S13, &HA8304613
		SMS_md5_FF b, c, d, a, x(k + 7), S14, &HFD469501
		SMS_md5_FF a, b, c, d, x(k + 8), S11, &H698098D8
		SMS_md5_FF d, a, b, c, x(k + 9), S12, &H8B44F7AF
		SMS_md5_FF c, d, a, b, x(k + 10), S13, &HFFFF5BB1
		SMS_md5_FF b, c, d, a, x(k + 11), S14, &H895CD7BE
		SMS_md5_FF a, b, c, d, x(k + 12), S11, &H6B901122
		SMS_md5_FF d, a, b, c, x(k + 13), S12, &HFD987193
		SMS_md5_FF c, d, a, b, x(k + 14), S13, &HA679438E
		SMS_md5_FF b, c, d, a, x(k + 15), S14, &H49B40821

		SMS_md5_GG a, b, c, d, x(k + 1), S21, &HF61E2562
		SMS_md5_GG d, a, b, c, x(k + 6), S22, &HC040B340
		SMS_md5_GG c, d, a, b, x(k + 11), S23, &H265E5A51
		SMS_md5_GG b, c, d, a, x(k + 0), S24, &HE9B6C7AA
		SMS_md5_GG a, b, c, d, x(k + 5), S21, &HD62F105D
		SMS_md5_GG d, a, b, c, x(k + 10), S22, &H2441453
		SMS_md5_GG c, d, a, b, x(k + 15), S23, &HD8A1E681
		SMS_md5_GG b, c, d, a, x(k + 4), S24, &HE7D3FBC8
		SMS_md5_GG a, b, c, d, x(k + 9), S21, &H21E1CDE6
		SMS_md5_GG d, a, b, c, x(k + 14), S22, &HC33707D6
		SMS_md5_GG c, d, a, b, x(k + 3), S23, &HF4D50D87
		SMS_md5_GG b, c, d, a, x(k + 8), S24, &H455A14ED
		SMS_md5_GG a, b, c, d, x(k + 13), S21, &HA9E3E905
		SMS_md5_GG d, a, b, c, x(k + 2), S22, &HFCEFA3F8
		SMS_md5_GG c, d, a, b, x(k + 7), S23, &H676F02D9
		SMS_md5_GG b, c, d, a, x(k + 12), S24, &H8D2A4C8A

		SMS_md5_HH a, b, c, d, x(k + 5), S31, &HFFFA3942
		SMS_md5_HH d, a, b, c, x(k + 8), S32, &H8771F681
		SMS_md5_HH c, d, a, b, x(k + 11), S33, &H6D9D6122
		SMS_md5_HH b, c, d, a, x(k + 14), S34, &HFDE5380C
		SMS_md5_HH a, b, c, d, x(k + 1), S31, &HA4BEEA44
		SMS_md5_HH d, a, b, c, x(k + 4), S32, &H4BDECFA9
		SMS_md5_HH c, d, a, b, x(k + 7), S33, &HF6BB4B60
		SMS_md5_HH b, c, d, a, x(k + 10), S34, &HBEBFBC70
		SMS_md5_HH a, b, c, d, x(k + 13), S31, &H289B7EC6
		SMS_md5_HH d, a, b, c, x(k + 0), S32, &HEAA127FA
		SMS_md5_HH c, d, a, b, x(k + 3), S33, &HD4EF3085
		SMS_md5_HH b, c, d, a, x(k + 6), S34, &H4881D05
		SMS_md5_HH a, b, c, d, x(k + 9), S31, &HD9D4D039
		SMS_md5_HH d, a, b, c, x(k + 12), S32, &HE6DB99E5
		SMS_md5_HH c, d, a, b, x(k + 15), S33, &H1FA27CF8
		SMS_md5_HH b, c, d, a, x(k + 2), S34, &HC4AC5665

		SMS_md5_II a, b, c, d, x(k + 0), S41, &HF4292244
		SMS_md5_II d, a, b, c, x(k + 7), S42, &H432AFF97
		SMS_md5_II c, d, a, b, x(k + 14), S43, &HAB9423A7
		SMS_md5_II b, c, d, a, x(k + 5), S44, &HFC93A039
		SMS_md5_II a, b, c, d, x(k + 12), S41, &H655B59C3
		SMS_md5_II d, a, b, c, x(k + 3), S42, &H8F0CCC92
		SMS_md5_II c, d, a, b, x(k + 10), S43, &HFFEFF47D
		SMS_md5_II b, c, d, a, x(k + 1), S44, &H85845DD1
		SMS_md5_II a, b, c, d, x(k + 8), S41, &H6FA87E4F
		SMS_md5_II d, a, b, c, x(k + 15), S42, &HFE2CE6E0
		SMS_md5_II c, d, a, b, x(k + 6), S43, &HA3014314
		SMS_md5_II b, c, d, a, x(k + 13), S44, &H4E0811A1
		SMS_md5_II a, b, c, d, x(k + 4), S41, &HF7537E82
		SMS_md5_II d, a, b, c, x(k + 11), S42, &HBD3AF235
		SMS_md5_II c, d, a, b, x(k + 2), S43, &H2AD7D2BB
		SMS_md5_II b, c, d, a, x(k + 9), S44, &HEB86D391

		a = SMS_AddUnsigned(a, AA)
		b = SMS_AddUnsigned(b, BB)
		c = SMS_AddUnsigned(c, CC)
		d = SMS_AddUnsigned(d, DD)
	Next

	SMS_MD5 = LCase(SMS_WordToHex(a) & SMS_WordToHex(b) & SMS_WordToHex(c) & SMS_WordToHex(d)) '32位
End Function
%>