?? char.asp
字號(hào):
<%
dim pageno,pagemax,rscount,rsno,loopno,i,page
'---------------------檢查用戶名密碼-------------------------------
function Checkin(s)
s=trim(s)
s=replace(s," ","&nbsp;")
s=replace(s,"'","&#39;")
s=replace(s,"""","&quot;")
s=replace(s,"<","&lt;")
s=replace(s,">","&gt;")
Checkin=s
end function
'--------------------------------------------
Rem 過濾SQL非法字符
function checkStr(str)
if isnull(str) then
checkStr = ""
exit function
end if
checkStr=replace(str,"'","''")
end function
'-------------------------------------
Rem 過濾HTML代碼
function HTMLcode(fString)
if not isnull(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), "</P><P> ")
fString = Replace(fString, CHR(10), "<BR> ")
HTMLEncode = fString
end if
end function
'--------------------------------------
Rem 過濾表單字符
function HTMLcode(fString)
if not isnull(fString) then
fString = Replace(fString, CHR(13), "")
fString = Replace(fString, CHR(10) & CHR(10), "</P><P>")
fString = Replace(fString, CHR(10), "<BR>")
HTMLcode = fString
end if
end function
'---------------------檢查真實(shí)姓名----------------------------
function isChinese(para)
on error resume next
dim str
dim i
if isNUll(para) then
isChinese=false
exit function
end if
str=cstr(para)
if trim(str)="" then
isChinese=false
exit function
end if
for i=1 to len(str)
c=asc(mid(str,i,1))
if c>=0 then
isChinese=false
exit function
end if
next
isChinese=true
if err.number<>0 then err.clear
end function
'---------------------檢查用戶Email-------------------------------
function IsValidEmail(email)
dim names,name,c
IsValidEmail = true
names = Split(email, "@")
if UBound(names) <> 1 then
IsValidEmail = false
exit function
end if
for each name in names
if Len(name) <= 0 then
IsValidEmail = false
exit function
end if
for i = 1 to Len(name)
c = Lcase(Mid(name, i, 1))
if InStr("abcdefghijklmnopqrstuvwxyz_-.", c) <= 0 and not IsNumeric(c) then
IsValidEmail = false
exit function
end if
next
if Left(name, 1) = "." or Right(name, 1) = "." then
IsValidEmail = false
exit function
end if
next
if InStr(names(1), ".") <= 0 then
IsValidEmail = false
exit function
end if
i = Len(names(1)) - InStrRev(names(1), ".")
if i <> 2 and i <> 3 then
IsValidEmail = false
exit function
end if
if InStr(email, "..") > 0 then
IsValidEmail = false
end if
end function
'**************************************************
'函數(shù)名:shosql
'作 用:分頁效果
'參 數(shù):spage ----當(dāng)前頁
'參 數(shù):spageno ----每頁數(shù)量
'參 數(shù):srscount ---數(shù)據(jù)總數(shù)
'**************************************************
sub showsql(spageno)
page=request("page")
if page="" or not isnumeric(page) then
page=1
else
page=clng(page)
end if
pageno=spageno
if page<1 then
page=1
end if
rscount=rscount
pagemax=rscount\pageno
if rscount mod pageno <>0 then
pagemax=pagemax+1
end if
if page>pagemax then
page=pagemax
end if
rsno=pageno*page-pageno
if page=pagemax then
loopno=rscount-rsno
else
loopno=pageno
end if
end sub
'**************************************************
'函數(shù)名:JoinChar
'作 用:向地址中加入 ? 或 &
'參 數(shù):strUrl ----網(wǎng)址
'返回值:加了 ? 或 & 的網(wǎng)址
'**************************************************
function JoinChar(strUrl)
if strUrl="" then
JoinChar=""
exit function
end if
if InStr(strUrl,"?")<len(strUrl) then
if InStr(strUrl,"?")>1 then
if InStr(strUrl,"&")<len(strUrl) then
JoinChar=strUrl & "&"
else
JoinChar=strUrl
end if
else
JoinChar=strUrl & "?"
end if
else
JoinChar=strUrl
end if
end function
'**************************************************
'過程名:showpage
'作 用:顯示“上一頁 下一頁”等信息
'參 數(shù):sfilename ----鏈接地址
' totalnumber ----總數(shù)量
' maxperpage ----每頁數(shù)量
' ShowTotal ----是否顯示總數(shù)量
' ShowAllPages ---是否用下拉列表顯示所有頁面以供跳轉(zhuǎn)。有某些頁面不能使用,否則會(huì)出現(xiàn)JS錯(cuò)誤。
' strUnit ----計(jì)數(shù)單位
'**************************************************
sub showpage(sfilename,totalnumber,maxperpage,ShowTotal,ShowAllPages,strUnit)
dim n, i,strTemp,strUrl
if totalnumber mod maxperpage=0 then
n= totalnumber \ maxperpage
else
n= totalnumber \ maxperpage+1
end if
strTemp= "<table width='100%'><tr><td align='center' height=25>"
if ShowTotal=true then
strTemp=strTemp & "共 <b>" & totalnumber & "</b> " & strUnit & " "
end if
strUrl=JoinChar(sfilename)
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 n-page<1 then
strTemp=strTemp & "下一頁 尾頁"
else
strTemp=strTemp & "<a href='" & strUrl & "page=" & (Page+1) & "'>下一頁</a> "
strTemp=strTemp & "<a href='" & strUrl & "page=" & n & "'>尾頁</a>"
end if
strTemp=strTemp & " 頁次:<strong><font color=red>" & Page & "</font>/" & n & "</strong>頁 "
strTemp=strTemp & " <b>" & maxperpage & "</b>" & strUnit & "/頁"
if ShowAllPages=True then
strTemp=strTemp & " 轉(zhuǎn)到:<select name='page' size='1' onchange=""javascript:window.location='" & strUrl & "page=" & "'+this.options[this.selectedIndex].value;"">"
for i = 1 to n
strTemp=strTemp & "<option value='" & i & "'"
if cint(Page)=cint(i) then strTemp=strTemp & " selected "
strTemp=strTemp & ">第" & i & "頁</option>"
next
strTemp=strTemp & "</select>"
end if
strTemp=strTemp & "</td></tr></table>"
response.write strTemp
end sub
%>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -