<%
Function CheckFile(sFileName)
CheckFile=false
Dim objFilesys
On Error Resume Next
Set objFilesys=server
If objFilesys
CheckFile=true
End if
Set objFilesys=nothing
End function
Function CheckFolder(Chk_Path)
set fso = server
if fso
CheckFolder=false
else
CheckFolder=true
end if
End function
function GetFileExt(sFileName)
GetFileExt = UCase(Mid(sFileName
End function
function IsTrueFileName(sFileName)
dim str_len
str_len=len(sFileName)
pos=Instr(sFileName
If pos=
IsTrueFileName = true
else
IsTrueFileName = false
End If
End function
Function IsImgFile(sFileName)
const adTypeBinary=
dim return
dim jpg(
dim bmp(
dim png(
dim gif(
on error resume next
return=false
dim fstream
FileExt = LCase(GetFileExt(sFileName))
If strInString(FileExt
Set fstream=Server
fstream
fstream
fstream
fstream
select case LCase(FileExt)
case "jpg"
stamp=fstream
for i=
If ascB(MidB(stamp
next
case "gif"
stamp=fstream
for i=
If ascB(MidB(stamp
next
case "png"
stamp=fstream
for i=
If ascB(MidB(stamp
next
case "bmp"
stamp=fstream
for i=
If ascB(MidB(stamp
next
End select
fstream
Set fseteam=nothing
If err
else
return = true
End If
IsImgFile = return
End function
Function CheckFileExt(sFileExt
dim arrExt
sFileExt = UCase(sFileExt)
strExt = UCase(strExt)
arrExt = split(strExt
If blnAllow=true then
return = false
for i=
If sFileExt=arrExt(i) then return=true
next
else
return = true
for i=
If sFileExt=arrExt(i) then return=false
next
End If
CheckFileExt = return
End Function
Function FormatSize(FileSize)
If FileSize<
If FileSize/
FileSize = FileSize/
FormatSize=round(FileSize*
Elseif FileSize/(
FileSize = FileSize/(
FormatSize = round(FileSize*
End If
End function
Sub DownFile(FileName)
fname = server
filename=split(fname
Set objAdoStream=Server
objAdoStream
objAdoStream
objAdoStream
strchar=objAdoStream
fsize=objAdoStream
objAdoStream
Set objAdoStream=nothing
Response
response
Response
Response
Response
End Sub
Function ReadIni(FilePath_Name
Dim MyString
MyString=LoadFile(FilePath_Name)
Arr=split(MyString
For I =
Str_temp= Arr(I)
Str_temp=Replace(Trim(Str_temp)
If Trim(Str_temp)<>"" and InStr(Trim(Str_temp)
If InStr(Trim(Str_temp)
sesstion_temp=Trim(Str_temp)
sesstion_temp=Replace(Trim(sesstion_temp)
sesstion_temp=Replace(Trim(sesstion_temp)
Else
MyArray = Split(Trim(Str_temp)
If Trim(MyArray(
ReadIni= Trim(MyArray(
Exit Function
End if
End If
End if
Next
ReadIni=""
End Function
Function WriteIni(FilePath_Name
Dim MyString
IsDo=false
IsHave=false
MyString=LoadFile(FilePath_Name)
Arr=split(MyString
For I =
Str_temp= Arr(I)
Str_temp=Replace(Trim(Str_temp)
if not IsDo then
If Trim(Str_temp)<>"" and InStr(Trim(Str_temp)
If InStr(Trim(Str_temp)
sesstion_temp=Trim(Str_temp)
sesstion_temp=Replace(Trim(sesstion_temp)
sesstion_temp=Replace(Trim(sesstion_temp)
if sesstion_temp<>sesstion_temp
Str_temp=MyItem&"="&MyValue&VbCrLf&Str_temp
IsDo=true
end if
sesstion_temp
if sesstion_temp=MySession then IsHave=true
Else
MyArray = Split(Trim(Str_temp)
If Trim(MyArray(
Str_temp= MyItem&"="&MyValue
IsDo=true
End if
End If
End if
End if
if(I<>UBound(Arr)) then
if Str_temp<>"" then Rstr=Rstr&Str_temp&VbCrLf
else
if Str_temp<>"" then Rstr=Rstr&Str_temp
end if
Next
if IsHave and IsDo=false then Rstr=Rstr&VbCrLf&MyItem&"="&MyValue
if IsHave=false and IsDo=false then Rstr=Rstr&VbCrLf&"["&MySession&"]"&VbCrLf&MyItem&"="&MyValue
call SaveToFile(Rstr
End Function
Function GetRanNum()
GetRanNum = ""
GetRanNum = GetRanNum&FormatIntNumber(year(now)
GetRanNum = GetRanNum&FormatIntNumber(month(now)
GetRanNum = GetRanNum&FormatIntNumber(day(now)
GetRanNum = GetRanNum&FormatIntNumber(hour(now)
GetRanNum = GetRanNum&FormatIntNumber(minute(now)
GetRanNum = GetRanNum&FormatIntNumber(second(now)
randomize
ranNum=int((
GetRanNum = GetRanNum&ranNum
End Function
Function FormatIntNumber(ExPRession
While Len(Expression) < Digit
Expression = "
wend
FormatIntNumber = Expression
End Function
%>
From:http://tw.wingwit.com/Article/program/net/201311/14329.html