📄 function.asp
字号:
New_StrTmp = New_StrTmp & " And "&FildName&" like '"&StrTmp&"' "
end if
end if
Bol_Xin = False
next
''去掉得sql模式时的第一个and
if FildValue="" and New_StrTmp<>"" then New_StrTmp = " ("&mid(New_StrTmp,len(" And ")+1)&") "
Search_TextArr = New_StrTmp
End Function
''暂不支持中文
'可配合server.URLEncode如:server.URLEncode(Encrypt(防止被转化成'报错。
Function Encrypt(ecode)
''加密
dim texts
dim i
for i=1 to len(ecode)
texts=texts & chr(asc(mid(ecode,i,1))+3)
next
Encrypt = texts
End Function
''暂不支持中文
Function Decrypt(dcode)
''解密
dim texts
dim i
for i=1 to len(dcode)
texts=texts & chr(asc(mid(dcode,i,1))-3)
next
Decrypt=texts
End Function
Function and_where(sql)
if instr(lcase(sql)," where ")>0 then
and_where = sql & " and "
else
and_where = sql & " where "
end if
End Function
Function Get_Date(f_getDate,f_datestyle)
dim tmp_f_datestyle
tmp_f_datestyle = f_datestyle
if instr(1,f_datestyle,"YY02",1)>0 then
tmp_f_datestyle= replace(tmp_f_datestyle,"YY02",right(year(f_getDate),2))
end if
if instr(f_datestyle,"YY04")>0 then
tmp_f_datestyle= replace(tmp_f_datestyle,"YY04",year(f_getDate))
end if
if instr(f_datestyle,"MM")>0 then
if month(f_getDate)<10 then
tmp_f_datestyle= replace(tmp_f_datestyle,"MM","0"&month(f_getDate))
else
tmp_f_datestyle= replace(tmp_f_datestyle,"MM",month(f_getDate))
end if
end if
if instr(f_datestyle,"DD")>0 then
if day(f_getDate)<10 then
tmp_f_datestyle= replace(tmp_f_datestyle,"DD","0"&day(f_getDate))
else
tmp_f_datestyle= replace(tmp_f_datestyle,"DD",day(f_getDate))
end if
end if
if instr(f_datestyle,"HH")>0 then
if hour(f_getDate)<10 then
tmp_f_datestyle= replace(tmp_f_datestyle,"HH","0"&hour(f_getDate))
else
tmp_f_datestyle= replace(tmp_f_datestyle,"HH",hour(f_getDate))
end if
end if
if instr(f_datestyle,"MI")>0 then
if minute(f_getDate)<10 then
tmp_f_datestyle= replace(tmp_f_datestyle,"MI","0"&minute(f_getDate))
else
tmp_f_datestyle= replace(tmp_f_datestyle,"MI",minute(f_getDate))
end if
end if
if instr(f_datestyle,"SS")>0 then
if second(f_getDate)<10 then
tmp_f_datestyle= replace(tmp_f_datestyle,"SS","0"&second(f_getDate))
else
tmp_f_datestyle= replace(tmp_f_datestyle,"SS",second(f_getDate))
end if
end if
Get_Date = tmp_f_datestyle
End Function
'html转换函数
Function Encode(str)
str=Replace(str,"&","&")
str=Replace(str,"'","''")
str=Replace(str,"""",""")
str=Replace(str," "," ")
str=Replace(str,"<","<")
str=Replace(str,">",">")
str=Replace(str,"\n","<br>")
Encode=str
End Function
''删除相关文件.
Function fso_DeleteFile(PhFileName)
On Error Resume Next
if isnull(PhFileName) or PhFileName = "" or instr(lcase(PhFileName),"http://")>0 then fso_DeleteFile=true:exit function
Dim Fso,isTrue
isTrue = False
Set Fso = CreateObject(G_FS_FSO)
Fso.DeleteFile server.MapPath(PhFileName),True
Set Fso = Nothing
if Err then
isTrue = False
else
isTrue = True
end if
fso_DeleteFile = isTrue
End Function
''删除相关文件.
Function fso_DeleteFolder(PhFileName)
On Error Resume Next
if isnull(PhFileName) or PhFileName = "" or instr(lcase(PhFileName),"http://")>0 then fso_DeleteFile=true:exit function
Dim Fso,isTrue
isTrue = False
Set Fso = CreateObject(G_FS_FSO)
Fso.DeleteFolder server.MapPath(PhFileName),True
Set Fso = Nothing
If Err Then
isTrue = False
Else
isTrue = True
End If
fso_DeleteFile = isTrue
End Function
''长新闻自动分页
Function AutoSplitPages(StrNewsContent,Page_Split_page,AutoPagesNum)
Dim Inti,StrTrueContent,iPageLen,DLocation,XLocation,FoundStr
If StrNewsContent<>"" and AutoPagesNum<>0 and instr(1,StrNewsContent,Page_Split_page)=0 then
Inti=instr(1,StrNewsContent,"<")
If inti>=1 then '新闻中存在Html标记
StrTrueContent=left(StrNewsContent,Inti-1)
iPageLen=IStrLen(StrTrueContent)
inti=inti+1
Else '新闻中不存在Html标记,对内容直接分页即可
dim i,c,t
do while i< len(StrNewsContent)
i=i+1
c=Abs(Asc(Mid(StrNewsContent,i,1)))
if c>255 then '判断为汉字则为两个字符,英文为一个字符
t=t+2
else
t=t+1
end if
if t>=AutoPagesNum then '如果字数达到了分页的数量则插入分页符号
StrNewsContent=left(StrNewsContent,i)&Page_Split_page&mid(StrNewsContent,i+1)
i=i+6
t=0
end if
loop
AutoSplitPages=StrNewsContent '返回插入分页符号的内容
Exit Function
End If
iPageLen=0
''新闻中存在Html标记时,则用下面的语句来处理
do while instr(Inti,StrNewsContent,">")<>0
DLocation=instr(Inti,StrNewsContent,">") '只计算Html标记之外的字符数量
XLocation=instr(DLocation,StrNewsContent,"<")
If XLocation>DLocation+1 then
Inti=XLocation
StrTrueContent=mid(StrNewsContent,DLocation+1,XLocation-DLocation-1)
iPageLen=iPageLen+IStrLen(StrTrueContent) '统计Html之外的字符的数量
If iPageLen>AutoPagesNum then '如果达到了分页的数量则插入分页字符
FoundStr=Lcase(left(StrNewsContent,XLocation-1))
If AllowSplitPages(FoundStr,"table|a|b>|i>|strong|div")=true then
StrNewsContent=left(StrNewsContent,XLocation-1)&Page_Split_page&mid(StrNewsContent,XLocation)
iPageLen=0 '重新统计Html之外的字符
End If
End If
ElseIf XLocation=0 then '在后面再也找不到<,即后面没有Html标记了
Exit Do
ElseIf XLocation=DLocation+1 then '找到的Html标记之间的内容为空,则继续向后找
Inti=XLocation
End If
loop
End If
AutoSplitPages=StrNewsContent
End Function
Function Recv(Str_Number)
Dim Arr_Number,Str_Return,Temp_i
Arr_Number = Split(Str_Number,chr(108))
Str_Return = ""
For Temp_i = LBound(Arr_Number) To UBound(Arr_Number)
Str_Return = Str_Return & Chr(Arr_Number(Temp_i)+31)
Next
Recv = Str_Return
End Function
Function IStrLen(TempStr)
Dim iLen,i,StrAsc
iLen=0
for i=1 to len(TempStr)
StrAsc=Abs(Asc(Mid(TempStr,i,1)))
if StrAsc>255 then
iLen=iLen+2
else
iLen=iLen+1
end if
next
IStrLen=iLen
End Function
Function GetInfo(GetPath)
Dim http,ErrContentLength,Report,ContentLength,ErrContent
ErrContent = ""
On Error Resume Next
Response.Clear
Set http=Server.CreateObject("Microsoft.XMLHTTP")
If Err Then
Err.Clear
Set http = Server.CreateObject("Msxml2.XMLHTTP")
If Err Then
ErrContent = "服务器不支持XML对象"
Err.Clear
End If
End If
If ErrContent<>"" Then
GetInfo = "False||"&ErrContent
Else
http.Open "GET",GetPath,False
http.Send
If http.readyState<>4 Then
GetInfo = "False||读取失败"
Else
GetInfo = "True||"&http.ResponseText
End If
End If
End Function
Function AllowSplitPages(TempStr,FindStr)
Dim Inti,BeginStr,EndStr,BeginStrNum,EndStrNum,ArrStrFind,i
If TempStr<>"" and FindStr<>"" then
ArrStrFind=split(FindStr,"|")
For i = 0 to Ubound(ArrStrFind)
BeginStr="<"&ArrStrFind(i)
EndStr ="</"&ArrStrFind(i)
Inti=0
do while instr(Inti+1,TempStr,BeginStr)<>0
Inti=instr(Inti+1,TempStr,BeginStr)
BeginStrNum=BeginStrNum+1
Loop
Inti=0
do while instr(Inti+1,TempStr,EndStr)<>0
Inti=instr(Inti+1,TempStr,EndStr)
EndStrNum=EndStrNum+1
Loop
If EndStrNum=BeginStrNum then
AllowSplitPages=true
Else
AllowSplitPages=False
Exit Function
End If
Next
Else
AllowSplitPages=False
End If
End Function
Function GetIsOpenWater()'判断是否开启水印组件
Dim IsOpenRs,IsOpenSql
IsOpenSql="Select PicClassid From FS_MF_Config"
Set IsOpenRs=Conn.execute(IsOpenSql)
If Not IsOpenRs.Eof Then
If Cint(IsOpenRs("PicClassid"))=9 Then
IsOpenRs.Close
Set IsOpenRs=Nothing
GetIsOpenWater=True
Exit Function
Else
IsOpenRs.Close
Set IsOpenRs=Nothing
GetIsOpenWater=False
End If
Exit Function
Else
IsOpenRs.Close
Set IsOpenRs=Nothing
GetIsOpenWater=False
Exit Function
End If
End Function
function GetExpFilename(str) '得到文件的扩展名
for i = len(str) to 1 step -1
if mid(str, i, 1) = chr(asc(".")) then
str = right(str, len(str)-i)
exit for
end if
next
GetExpFilename = str
end function
function bin2str(binstr) '将bin2str二进数转化为字符串
dim varlen, clow, ccc, skipflag
skipflag = 0
ccc = ""
varlen = lenb(binstr)
for i = 1 to varlen
if skipflag = 0 then
clow = midb(binstr, i, 1)
if ascb(clow) > 127 then
ccc = ccc & chr(ascw(midb(binstr, i + 1, 1) & clow))
skipflag = 1
else
ccc = ccc & chr(ascb(clow))
end if
else
skipflag = 0
end if
next
bin2str = ccc
end function
function str2bin(str) '将字符串转化为二进制数
for i = 1 to len(str)
str2bin = str2bin & chrb(asc(mid(str, i, 1)))
next
end function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -