獲取使用者真實ip函式
程式**
'獲取使用者真實ip函式
獲取完整位址列位址
程式**
'獲取完整位址列位址
獲取本頁檔名
程式**
'獲取本頁檔名
function selfname()
selfname = mid(request.servervariables("url"),instrrev(request.servervariables("url"),"/")+1)
end function
獲取檔案字尾名
程式**
'獲取檔案字尾名
function getext(filename)
getext = mid(filename,instrrev(filename,".")+1)
end function
求字串長度
程式**
'求字串長度函式
function getlength(str)
dim i,length
for i = 1 to len(str)
if asc(mid(str,i,1))<0 or asc(mid(str,i,1))>256 then
length = length+2
else
length = length+1
end if
next
getlength = length
end function
過濾不良字元
程式**
'過濾不良字元
function chkbadwords(fstring)
dim badwords,bwords,i
badwords = "這裡是不良詞語|豎線分隔"
if not(isnull(badwords) or isnull(fstring)) then
bwords = split(badwords, "|")
for i = 0 to ubound(bwords)
fstring = replace(fstring, bwords(i), string(len(bwords(i)),"*"))
next
chkbadwords = fstring
end if
end function
防止外部提交
程式**
'防止外部提交
過濾html字元
程式**
'過濾html字元函式
function htmlencode(fstring)
if not isnull(fstring) and fstring <> "" then
fstring = replace(fstring, ">", ">")
fstring = replace(fstring, "<", "<")
fstring = replace(fstring, chr(32), " ")
fstring = replace(fstring, chr(9), " ")
fstring = replace(fstring, chr(34), """)
fstring = replace(fstring, chr(39), "'")
fstring = replace(fstring, chr(13), "")
fstring = replace(fstring, chr(10) & chr(10), "
")fstring = replace(fstring, chr(10), "
")fstring = replace(fstring, chr(255), " ")
htmlencode = fstring
end if
end function
清除html標記
程式**
'清除html標記
function striphtml(strhtml)
dim objregexp,stroutput
set objregexp = new regexp
objregexp.ignorecase = true
objregexp.global = true
objregexp.pattern = "<.+?>"
stroutput = objregexp.replace(strhtml,"")
stroutput = replace(stroutput, "<","<")
stroutput = replace(stroutput, ">",">")
striphtml = stroutput
set objregexp = nothing
end function
asp常用函式
array function 返回乙個陣列 syntax array list arguments 字元,數字均可 example dim myarray for i 1 to 7 redim preserve myarray i myarray i weekdayname i next resul...
asp常用函式
set jmail server.createobject jmail.tpmail 建立乙個jmail物件 jmail.silent true jmail不會丟擲例外錯誤,返回的值為false跟true jmail.logging true 啟用使用日誌 jmail.charset gb2312 ...
Asp 常用函式
textarea顯示用 function htmlencode1 fstring if fstring and not isnull fstring then fstring replace fstring,fstring replace fstring,fstring replace fstrin...