海外邮件中继,海外退信中继,美国高速VPS,不限流量VPN,邮局维护和管理,邮件网关,EMOS邮件中继,POSTFIX邮件中继,Winwebmail邮件中继,Winmail邮件中继,DBMail邮件中继,JDMail邮件中继,Exchange邮件中继,MDaemon邮件中继 淘宝店:http://shantan.taobao.com 云邮科技官网:www.yunrelay.com
【字体设置:大 中 小】
<%
'**************************************************
'函数名:rndNum
'作 用:求随机长度数字
'参 数:strLong长度,
'返回值:字符串
'**************************************************
Function rndNum (strLong)
Dim temNum
Randomize
Do While Len(RndNum) < strLong
temNum=CStr(Chr((57-48)*rnd+48))
RndNum=RndNum&temNum
loop
End Function
'**************************************************
'函数名:newleft
'作 用:取前字符串。l要求长度的
'参 数:str字符串,
'返回值:字符串
'**************************************************
Function newleft(str,l)
if len(str)>l then
newleft=left(str,l)&"…"
else
newleft=str
end if
End Function
'**************************************************
'函数名:strLength
'作 用:求字符串长度。汉字算两个字符,英文算一个字符。
'参 数:str ----要求长度的字符串
'返回值:字符串长度
'**************************************************
function strLength(str)
ON ERROR RESUME NEXT
dim WINNT_CHINESE
WINNT_CHINESE = (len("网络")=2)
if WINNT_CHINESE then
dim l,t,c
dim i
l=len(str)
t=l
for i=1 to l
c=asc(mid(str,i,1))
if c<0 then c=c+65536
if c>255 then
t=t+1
end if
next
strLength=t
else
strLength=len(str)
end if
if err.number<>0 then err.clear
end function
''''''''''''''''''中英文长度获取和截取
Function CountLength(Str)
Dim output,ThisChar,i
output = 0
For i = 1 To Len(Str)
ThisChar = Mid(Str,i,1)
If Asc(ThisChar) < 0 Then
output = output + 2
Else
output = output + 1
End If
Next
CountLength = output
End Function
Function MaxLengthStr(ByVal Str, ByVal MaxLength)
Dim Output,i
If IsNull(Str) Then Str = ""
Output = ""
If LenB(Str) <= MaxLength Then
Output = Str
Else
For i = 1 To Len(Str)
Output = Output & Mid(Str,i,1)
If CountLength(Output)+3 = MaxLength Then
Output = Output
Exit For
ElseIf CountLength(Output)+3 > MaxLength Then
Output = Left(Output,Len(Output)-1)
Exit For
End If
Next
End If
MaxLengthStr = Output
End Function
'过滤HTML代码
function HTMLEncode(fString)
dim tempstr
tempstr=fString
if not isnull(tempstr) then
tempstr = replace(tempstr, ">", ">")
tempstr = replace(tempstr, "<", "<")
tempstr = Replace(tempstr, CHR(32), " ")
tempstr = Replace(tempstr, CHR(9), " ")
tempstr = Replace(tempstr, CHR(34), """)
tempstr = Replace(tempstr, CHR(39), "'")
tempstr = Replace(tempstr, CHR(13), "")
tempstr = Replace(tempstr, CHR(10) & CHR(10), "</P><P> ")
tempstr = Replace(tempstr, CHR(10), "<BR> ")
HTMLEncode = tempstr
end if
end function
'反过滤HTML代码
function UNHTMLEncode(fString)
dim tempstr
tempstr=fString
if not isnull(tempstr) then
tempstr = replace(tempstr, ">", ">")
tempstr = replace(tempstr, "<", "<")
tempstr = Replace(tempstr, " ", CHR(32))
tempstr = Replace(tempstr, " ", CHR(9))
tempstr = Replace(tempstr, """, CHR(34))
tempstr = Replace(tempstr, "'", CHR(39))
tempstr = Replace(tempstr, "", CHR(13))
tempstr = Replace(tempstr, "</P><P> ", CHR(10) & CHR(10))
tempstr = Replace(tempstr, "<BR> ", CHR(10))
UNHTMLEncode = tempstr
end if
end function
'去除HTML标记
Function FilterHTML(Str)
Dim StrContent
StrContent = Trim(Str)
StrContent = Replace(StrContent,"width>screen.","")
StrContent = Replace(StrContent," ","")
StrContent = Replace(StrContent,Chr(13)&Chr(10),"")
If Len(StrContent)>5 Then
Dim objRegExp, strOutput
Set objRegExp = New Regexp
objRegExp.IgnoreCase = True
objRegExp.Global = True
objRegExp.Pattern = "<.+?>"
'Replace all HTML tag matches with the empty string
StrContent = objRegExp.Replace(StrContent,"")
End If
StrContent = Replace(StrContent," ","")
FilterHTML=Left(StrContent,200)
End Function
'*************************************************
'函数名:gotTopic
'作 用:截字符串,汉字一个算两个字符,英文算一个字符
'参 数:str ----原字符串
' strlen ----截取长度
'返回值:截取后的字符串
'*************************************************
function gotTopic(str,strlen)
if str="" then
gotTopic=""
exit function
end if
dim l,t,c, i
str=replace(replace(replace(replace(str," "," "),""",chr(34)),">",">"),"<","<")
l=len(str)
t=0
for i=1 to l
c=Abs(Asc(Mid(str,i,1)))
if c>255 then
t=t+2
else
t=t+1
end if
if t>=strlen then exit for
next
if i < l then
gotTopic=left(str,i) & "…"
else
gotTopic=str
end if
'gotTopic=replace(replace(replace(replace(gotTopic," "," "),chr(34),"""),">",">"),"<","<")
end function
'***********************************************
'函数名:JoinChar
'作 用:向地址中加入 ? 或 &
'参 数:strUrl ----网址
'返回值:加了 ? 或 & 的网址
'***********************************************
function JoinChar(strUrl)
if strUrl="" then
JoinChar=""
exit function
end if
if InStr(strUrl,"?")>0 then
JoinChar=strUrl & "&"
else
JoinChar=strUrl & "?"
end if
end function
'***********************************************
'函数名:showpages
'作 用:显示“上一页 下一页”等信息
'参 数: sfilename ----链接地址
' totalnumber ----总数量
' totalpage ----总页数
' maxperpage ----每页数量
' page ----当前页
' ShowTotal ----是否显示总数量
' ShowForm ----是否显示跳转表单
' strUnit ----计数单位
'***********************************************
Function showpages(sfilename,totalnumber,totalpage,maxperpage,page,ShowTotal,ShowForm,strUnit)
dim i,strTemp,strUrl
strTemp= "<table width=""98%"" border=""0"" align=""center"" cellpadding=""0"" cellspacing=""0"">"&vbcrlf
strTemp=strTemp & "<form name='Form2' method='Post' action='" & sfilename & "'>"&vbcrlf
strTemp=strTemp & "<tr>"&vbcrlf
strTemp=strTemp & "<td align='right'>"&vbcrlf
if ShowTotal=true then
strTemp=strTemp & "共有<b> "& totalnumber &" </b>"& strUnit &" "
strTemp=strTemp & "<b> "&maxperpage&" </b> "& strUnit &"/页 "
end if
strUrl=JoinChar(sfilename)
page=int(page)
totalpage=int(totalpage)
if page<2 then
strTemp=strTemp & " 首页 前一页 "
else
strTemp=strTemp & " <a href='" & strUrl & "page=1'>首页</a> "
strTemp=strTemp & "<a href='" & strUrl & "page=" & page-1 & "'>前一页</a> "
end if
if totalpage-page<1 then
strTemp=strTemp & "下一页 尾页"
else
strTemp=strTemp & "<a href='" & strUrl & "page=" & page+1 & "'>下一页</a> "
strTemp=strTemp & "<a href='" & strUrl & "page=" & totalpage & "'>尾页</a> "
end if
if ShowTotal=true then
strTemp=strTemp & " 当前:<b><font color=red>"& page &"</font>"
strTemp=strTemp & "/"& totalpage &"</b>页"
end if
if ShowForm=True then
strTemp=strTemp & " 转到:<select name=""page"" "
strTemp=strTemp & "size=""1"" onChange=""javascript:submit()"">" &vbcrlf
for i = 1 to totalpage
strTemp=strTemp & "<option value='" & i & "'"
if page=i then strTemp=strTemp & " selected "
strTemp=strTemp & ">第" & i & "页</option>"&vbcrlf
next
strTemp=strTemp & "</select>"&vbcrlf
end if
strTemp=strTemp & "</td>"&vbcrlf
strTemp=strTemp & "</tr>"&vbcrlf
strTemp=strTemp & "</form>"&vbcrlf
strTemp=strTemp & "</table>"&vbcrlf
showpages = strTemp
End Function
'***********************************************
'函数名:showpages2
'作 用:显示“上页 1 | 2 | 3 下页”等信息
'参 数: sfilename ----链接地址
' totalnumber ----总数量
' totalpage ----总页数
' maxperpage ----每页数量
' page ----当前页
' ShowForm ----是否显示跳转表单
'***********************************************
Function showpages2(sfilename,totalnumber,totalpage,maxperpage,page,ShowForm)
dim i,strTemp,strUrl
strTemp= "<table width=""98%"" border=""0"" align=""center"" cellpadding=""0"" cellspacing=""0"">"&vbcrlf
strTemp=strTemp & "<form name='Form2' method='Post' action='" & sfilename & "'>"&vbcrlf
strTemp=strTemp & "<tr>"&vbcrlf
strTemp=strTemp & "<td align='right'>"&vbcrlf
strUrl=JoinChar(sfilename)
page=int(page)
totalpage=int(totalpage)
if page>1 then
strTemp=strTemp & " <a href='" & strUrl & "page=1'>首页</a> "
strTemp=strTemp & "<a href='" & strUrl & "page=" & page-1 & "'>上页</a> "
end if
if totalpage<10 then
bno=1:eno=totalpage
elseif page < 5 then
bno=1:eno=10
elseif totalpage - page < 5 then
bno=totalpage-9:eno=totalpage
else
bno=page-4:eno=page+5
end if
for i = bno to eno
if i = bno then
strTemp=strTemp & " "
else
strTemp=strTemp & " | "
end if
if i = page then
strTemp=strTemp & "<span style='color:red'>"
strTemp=strTemp & i
strTemp=strTemp & "</span>"
else
strTemp=strTemp & "<a href='" & strUrl & "page="&i&"'>"
strTemp=strTemp & i
strTemp=strTemp & "</a>"
end if
next
strTemp=strTemp & " "
if totalpage-page>0 then
strTemp=strTemp & "<a href='" & strUrl & "page=" & page+1 & "'>下页</a> "
strTemp=strTemp & "<a href='" & strUrl & "page=" & totalpage & "'>尾页</a> "
end if
if ShowForm=True then
strTemp=strTemp & " 转到:"
strTemp=strTemp & "<input type=""text"" name=""page"" id=""page"" value="""&page&""" style=""width:30px;"">"
strTemp=strTemp & "<input type=""submit"" name=""gopage"" value=""GO"" style=""width:24px;"">"
end if
strTemp=strTemp & "</td>"&vbcrlf
strTemp=strTemp & "</tr>"&vbcrlf
strTemp=strTemp & "</form>"&vbcrlf
strTemp=strTemp & "</table>"&vbcrlf
showpages2 = strTemp
End Function
'***********************************************
'函数名:showHTMLpages
'作 用:显示“上页 1 | 2 | 3 下页”等信息
'参 数: sfilename ----链接地址
' totalnumber ----总数量
' totalpage ----总页数
' maxperpage ----每页数量
' page ----当前页
' ShowForm ----是否显示跳转表单
'***********************************************
Function showHTMLpages(sfilename,totalnumber,totalpage,maxperpage,page,ShowForm)
dim i,strTemp,strUrl
strTemp= "<table width=""98%"" border=""0"" align=""center"" cellpadding=""0"" cellspacing=""0"">"&vbcrlf
strTemp=strTemp & "<tr>"&vbcrlf
strTemp=strTemp & "<td align='right'>"&vbcrlf
page=int(page)
totalpage=int(totalpage)
if page>1 then
strTemp=strTemp & " <a href='" & sfilename & "1.htm'>首页</a> "
strTemp=strTemp & "<a href='" & sfilename & (page-1) & ".htm'>上页</a> "
end if
if totalpage<10 then
bno=1:eno=totalpage
elseif page < 5 then
bno=1:eno=10
elseif totalpage - page < 5 then
bno=totalpage-9:eno=totalpage
else
bno=page-4:eno=page+5
end if
for i = bno to eno
if i = bno then
strTemp=strTemp & " "
else
strTemp=strTemp & " | "
end if
if i = page then
strTemp=strTemp & "<span style='color:red'>"
strTemp=strTemp & i
strTemp=strTemp & "</span>"
else
strTemp=strTemp & "<a href='" & sfilename & i & ".htm'>"
strTemp=strTemp & i
strTemp=strTemp & "</a>"
end if
next
strTemp=strTemp & " "
if totalpage-page>0 then
strTemp=strTemp & "<a href='" & sfilename & (page+1) & ".htm'>下页</a> "
strTemp=strTemp & "<a href='" & sfilename & totalpage & ".htm'>尾页</a> "
end if
if ShowForm=True then
strTemp=strTemp & " 转到:"
strTemp=strTemp & "<input type=""text"" name=""page"" id=""page"" value="""&page&""" style=""width:30px;"" />"
strTemp=strTemp & "<input type=""button"" name=""gopage"" value=""GO"" style=""width:24px;"" onClick=""javascript:location.href='" & sfilename & "' + document.getElementById('page').value + '.htm';"" />"
end if
strTemp=strTemp & "</td>"&vbcrlf
strTemp=strTemp & "</tr>"&vbcrlf
strTemp=strTemp & "</table>"&vbcrlf
showHTMLpages = strTemp
End Function
function rootidtoname(rootid,tabname)
dim mrootid,mrootname
if tabname="" then tabname="msg_class"
mrootid=rootid
if mrootid<>"" then
root=split(mrootid,",")
mrootname=""
for i = 0 to ubound(root)
sql="select id,title from "&tabname&" where id="&int(root(i))
rs2.open sql,conn,1,1
if not rs2.eof then
if i > 0 then
mrootname=mrootname&" >> "
end if
mrootname=mrootname&rs2("title")
end if
rs2.close
next
rootidtoname=mrootname
else
rootidtoname=""
end if
end function
Function clngstr(str,lng)
dim strtemp
strtemp=Right("000000000"&str,lng)
clngstr=strtemp
end function
'删除数组内的元素
function delarray(astr,ano)
'on error resume next
dim atemp,ai
atemp=astr
aa=int(ano)
if isarray(atemp) then
ai=ubound(atemp)
if aa > ai then
delarray=atemp
exit function
elseif ai=0 then
delarray=""
exit function
elseif aa=ai then
ReDim Preserve atemp(ai-1)
else
for i = aa to ai - 1
atemp(i)=atemp(i+1)
next
ReDim Preserve atemp(ai-1)
end if
else
delarray=atemp
exit function
end if
delarray=atemp
end function
'删除文件
function delfile(filename)
on error resume next
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
if objFSO.fileExists(Server.MapPath(filename)) then
objFSO.DeleteFile(Server.MapPath(filename))
delfile=true
else
delfile=false
exit function
end if
set objFSO=nothing
delfile=true
end function
'转长日期格式
function clngdate(tdate)
tempdate=cstr(tdate)
if tempdate="" then
clngdate=""
exit function
end if
td=split(tempdate,"-")
if ubound(td)<>2 then
clngdate=tempdate
exit function
end if
if len(td(1))=1 then td(1)="0"&td(1)
if len(td(2))=1 then td(2)="0"&td(2)
clngdate=td(0)&"-"&td(1)&"-"&td(2)
end function
%>
发表评论 - 不要忘了输入验证码哦!