【www.gdgbn.com--php函数】
asp教程开发中常用函数
sub lastnextpage(pagecount,page,table_style,font_style)
"生成上一页下一页链接
dim query, a, x, temp
action = "http://" & request.servervariables("http_host") & request.servervariables("script_name")
query = split(request.servervariables("query_string"), "&")
for each x in query
a = split(x, "=")
if strcomp(a(0), "page", vbtextcompare) <> 0 then
temp = temp & a(0) & "=" & a(1) & "&"
end if
next
response.write("" & vbcrlf )
response.write("
response.write("" & vbcrlf )
end sub
sub chkfod(fstring)
if trim(fstring) <> empty then
if right(fstring, 1) <> "/" then
fstring = fstring & "/"
end if
dim i, tempdir
fstring = split(fstring, "/")
for i = 1 to ubound(fstring)
if trim(fstring(i)) <> empty then
tempdir = tempdir & "/" & fstring(i)
set fso = createobject("scripting.filesystemobject")
if fso.folderexists(server.mappath(tempdir)) = false then
fso.createfolder (server.mappath(tempdir))
end if
set fso = nothing
else
exit for
end if
next
end if
end sub
rem 设置随机数字
function cdstr(dlen)
"response.write cdstr(9) ""指定长度为9的随机字符串
dim ss,sslen
randomize timer
ss="1234567890"
sslen = len(ss)
cdstr = ""
for i = 1 to dlen
t = cint(rnd*sslen)+1 ""这里加1,不然出现mid(ss,0,1)会出错
cdstr = cdstr&mid(ss,t,1)
next
end function
"检查字符串长度
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