?? htmledit.asp
字號:
If Trim(str)<>"" Then
If isNumeric(str) Then str=Cstr(str)
Dim newstr,i
newstr=""
For i=1 To Len(str)
newstr=newstr & ascw(mid(str,i,1))
If i<> Len(str) Then newstr= newstr & "a"
Next
CodeCookie=newstr
Else
CodeCookie=""
End If
End Function
Public Function DecodeCookie(ByVal str)
DecodeCookie=""
If Trim(str)<>"" Then
Dim newstr,i
newstr=Split(str,"a")
For i = LBound(newstr) To UBound(newstr)
DecodeCookie= DecodeCookie & chrw(newstr(i))
Next
End If
End Function
Public Function MUPFilesGetv()
''-------- 表單提交書寫要求 --------''
'' enctype="multipart/form-data" ''
''-----------------------------------''
'' TFormlname 提交的表單項目名稱 ''
''------------ 數組說明 ------------''
'' 數組(0):表單項目名稱 ''
'' 數組(1):表單項目數據 ''
'' 數組(2):表單(上傳文件)類文件名稱 ''
'' 數組(3):表單(上傳文件)類文件類型 ''
'' 數組(4):表單(上傳文件)類文件大小 ''
''-----------------------------------''
DIM FMArray(50,4),ri,i
DIM FM_type,FM_name,FM_value,FM_f_lx,FM_f_size,FM_f_name
DIM FBytesDatacount,FBytesData
DIM tStream,oUpFileStream,RequestBinDate,iFormEnd,bCrLf,sStart,iStart,iFormStart
DIM iInfoStart,iInfoEnd,sInfo,iFindStart,iFindEnd,sFormName,sFileName,sFormValue
FM_type = ""
FM_name = ""
FM_value = ""
FM_f_name = ""
FM_f_lx = ""
FM_f_size = 0
FBytesDatacount = Request.TotalBytes
If FBytesDatacount < 1 Then Exit function
FBytesData = Request.BinaryRead(FBytesDatacount)
set tStream = Server.CreateObject("adodb.stream")
set oUpFileStream = Server.CreateObject("adodb.stream")
oUpFileStream.Type = 1
oUpFileStream.Mode = 3
oUpFileStream.Open
oUpFileStream.Write FBytesData
oUpFileStream.Position=0
RequestBinDate = oUpFileStream.Read
iFormEnd = oUpFileStream.Size
bCrLf = chrB(13) & chrB(10)
''取得每個項目之間的分隔符''
sStart = MidB(RequestBinDate,1, InStrB(1,RequestBinDate,bCrLf)-1)
iStart = LenB (sStart)
iFormStart = iStart+2
''分解項目''
ri=0
Do
iInfoEnd = InStrB(iFormStart,RequestBinDate,bCrLf & bCrLf)+3
tStream.Type = 1
tStream.Mode = 3
tStream.Open
oUpFileStream.Position = iFormStart
oUpFileStream.CopyTo tStream,iInfoEnd-iFormStart
tStream.Position = 0
tStream.Type = 2
tStream.Charset ="gb2312"
sInfo = tStream.ReadText
'取得表單項目名稱
iFormStart = InStrB(iInfoEnd,RequestBinDate,sStart)-1
iFindStart = InStr(22,sInfo,"name=""",1)+6
iFindEnd = InStr(iFindStart,sInfo,"""",1)
sFormName = Mid (sinfo,iFindStart,iFindEnd-iFindStart)
FM_type = ""
FM_name = sFormName
FM_value = ""
FM_f_name = ""
FM_f_lx = ""
FM_f_size = 0
If InStr (45,sInfo,"filename=""",1) > 0 Then
'如果是文件
FM_type="WJ"
iFindStart = InStr(iFindEnd,sInfo,"filename=""",1)+10
iFindEnd = InStr(iFindStart,sInfo,"""",1)
sFileName = Mid (sinfo,iFindStart,iFindEnd-iFindStart)
FM_f_name = Mid(sFileName,InStrRev(sFileName,"\")+1,Len(sFileName))
iFindStart = InStr(iFindEnd,sInfo,"Content-Type: ",1)+14
iFindEnd = InStr(iFindStart,sInfo,vbCr)
FM_f_lx = Mid (sinfo,iFindStart,iFindEnd-iFindStart)
FM_f_size = iFormStart -iInfoEnd -2
tStream.Close
tStream.Type = 1
tStream.Mode = 3
tStream.Open
oUpFileStream.Position = iInfoEnd
oUpFileStream.CopyTo tStream,iFormStart-iInfoEnd-2
tStream.Position = 0
FM_value = tStream.Read
FMArray(ri,0)=FM_name
FMArray(ri,1)=FM_value
FMArray(ri,2)=FM_f_name
FMArray(ri,3)=FM_f_lx
FMArray(ri,4)=FM_f_size
else
'如果是表單項目
tStream.Close
FM_type="BD"
tStream.Type = 1
tStream.Mode = 3
tStream.Open
oUpFileStream.Position = iInfoEnd
oUpFileStream.CopyTo tStream,iFormStart-iInfoEnd-2
tStream.Position = 0
tStream.Type = 2
tStream.Charset = "gb2312"
sFormValue = tStream.ReadText
FM_value = sFormValue
FMArray(ri,0)=FM_name
FMArray(ri,1)=FM_value
FMArray(ri,2)=FM_f_name
FMArray(ri,3)=FM_f_lx
FMArray(ri,4)=FM_f_size
end If
tStream.Close
iFormStart = iFormStart+iStart+2
ri=ri+1
loop until (iFormStart+2) = iFormEnd
Set tStream = Nothing
Set oUpFileStream = Nothing
DIM temparray
ReDim temparray(ri,4)
For i=0 to 50
If FMArray(i,0)<>"" Then
temparray(i,0)=FMArray(i,0)
temparray(i,1)=FMArray(i,1)
temparray(i,2)=FMArray(i,2)
temparray(i,3)=FMArray(i,3)
temparray(i,4)=FMArray(i,4)
Else
Exit For
End if
Next
MUPFilesGetv=temparray
End Function
Public Function MUPFilesTo(ByVal TFBinDate,ByVal Tpath,ByVal Tfname)
''-----------------------------------''
'' TFBinDate :表單項名稱 ''
'' Tpath :服務器上的物理路徑 ''
'' Tfname :目標文件名 ''
''-----------------------------------''
MUPFilesTo=False
DIM oStream,newpath
If LenB(TFBinDate) > 0 Then
set oStream = Server.CreateObject("adodb.stream")
oStream.Type = 1
oStream.Mode = 3
oStream.Open
oStream.Write TFBinDate
newpath = Trim(Tpath)
If Right(newpath,1) <> "\" Then newpath = newpath & "\"
oStream.SaveToFile newpath & Tfname,2
oStream.Close
set oStream=nothing
MUPFilesTo=True
End If
End Function
Public Function MUPGtArrayone(ByVal TArray,ByVal Tws,ByVal Tvalue)
Dim i
MUPGtArrayone=0
For i=0 to UBound(TArray)-1
If TArray(i,Tws)=Tvalue Then
MUPGtArrayone=i
Exit For
End If
Next
End Function
Public Function GetMyTimeNumber(ByVal lx)
randomize
If lx=0 Then GetMyTimeNumber=Year(Date)*12*30*24*60*60*100+Month(Date)*30*24*60*60*100+Day(Date)*24*60*60*100+Hour(Time)*60*60*100+Minute(Time)*60*100+Second(Time)*100+Int(100 * Rnd)
If lx=1 Then GetMyTimeNumber=Year(Date)*12*30*24*60*60+Month(Date)*30*24*60*60+Day(Date)*24*60*60+Hour(Time)*60*60+Minute(Time)*60+Second(Time)
If lx=2 Then GetMyTimeNumber=Year(Date)*12*30*24*60+Month(Date)*30*24*60+Day(Date)*24*60+Hour(Time)*60+Minute(Time)
If lx=3 Then GetMyTimeNumber=Year(Date)*12*30*24+Month(Date)*30*24+Day(Date)*24+Hour(Time)
If lx=4 Then GetMyTimeNumber=Year(Date)*12*30+Month(Date)*30+Day(Date)
If lx=5 Then GetMyTimeNumber=Year(Date)*12+Month(Date)
End Function
%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -