麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 編程 > ASP > 正文

ASP常用函數(shù)總結(jié)

2024-05-04 11:07:03
字體:
供稿:網(wǎng)友

'----------------------------------------------------------------------
' 函數(shù)功能: 屏蔽HTML代碼
' 參  數(shù): StrInput 用戶輸入信息
'----------------------------------------------------------------------
function FunInput(StrInput)
if not isnull(Str) then
  StrInput=RePlace(StrInput,"<","<")
  StrInput=replace(StrInput,">",">")
  StrinPut=replace(Strinput,chr(32)," ")
  strinput=replace(strinput,chr(34),""")
  strinput=replace(strinput,chr(39),"'")
  strinput=replace(strinput,chr(13),"")
  FunInput=strinput
end if
end function
 
'----------------------------------------------------------------------
' 函數(shù)功能: 防止SQL注入
' 參  數(shù): StrValue 用戶提交的數(shù)據(jù)
'    BloType  數(shù)據(jù)類型
'   參 數(shù) 值:   true 數(shù)值型數(shù)據(jù)
'               false 字符型數(shù)據(jù)
'----------------------------------------------------------------------
function FunSQL(StrValue,BloType)
if BloType then
  if Isnumeric(StrValue) then
   FunSQL=clng(StrValue)
  else
   StrValue=0
  end if
else
  if not isnull(StrValue) then
   StrValue=lcase(StrValue)
   StrValue=Replace(StrValue,"'","''")
   StrValue=replace(StrValue,"select","")
   StrValue=replace(StrValue,"update","")
   StrValue=replace(StrValue,"insert","")
   StrValue=replace(StrValue,"delete","")
   StrValue=replace(StrValue,";","")
   StrValue=replace(StrValue," ","")
   StrValue=replace(StrValue,chr(255),"")
   StrValue=replace(StrValue,"*","")
   StrValue=replace(StrValue,"%","")
  end if
end if
FunSQL=StrValue
end function
 
'--------------------------------------------------------------------------
' 函數(shù)功能: 常用類型轉(zhuǎn)換
' 參    數(shù):   _Type 數(shù)據(jù)類型
'    _Value  數(shù)據(jù)
' 參 數(shù) 值:   _Type  1 :  轉(zhuǎn)換成數(shù)值型數(shù)據(jù)
'               _Type  2 :  轉(zhuǎn)換成字符型數(shù)據(jù)
'               _Type  3 :  轉(zhuǎn)換成布爾型數(shù)據(jù)   
'--------------------------------------------------------------------------
function FunSwitch(Value_,Type_)
on error resume next
select case Type_
  case 1
  if isnumeric(Value_) then
   if not isnull(Value_) then
    FunSwitch=clng(Value_)
   else
    FunSwitch=0
   end if
  else
   FunSwitch=0
  end if
  case 2
   if not isnull(Value_) then
    FunSwitch=cstr(Value_)
   else
    FunSwitch=""
   end if
  case 3
   if not isnull(Value_) and isnumeric(Value_) then
    FunSwitch=cbool(Value_)
   else
    FunSwitch=false
   end if
  case else
   response.redirect("Error.asp?err=請指定 FunSwitch 中要轉(zhuǎn)達換成的數(shù)據(jù)類型!")
end select
if err.number<>0 then
response.redirect("Error.asp?err=數(shù)據(jù)轉(zhuǎn)換時產(chǎn)生未知錯誤!")
err.clear
end if
end function
''----------------------------------------------------------------------
' 函數(shù)功能: 驗證是數(shù)據(jù)是否來自外部
' 參    數(shù):  無
'----------------------------------------------------------------------
function checkfrom()
server_v1=Cstr(Request.ServerVariables("HTTP_REFERER"))
server_v2=Cstr(Request.ServerVariables("SERVER_NAME"))
if mid(server_v1,8,len(server_v2))<>server_v2 then
  checkfrom=true
else
  checkfrom=false
end if
end function
 
''----------------------------------------------------------------------
' 函數(shù)功能: JS提示框
' 參    數(shù):  StrURL   :  點擊確定后返回到的頁面地址
'    StrMSG   :  對話框的提示信息

'----------------------------------------------------------------------
Function FunMsg(StrURL,StrMSG)
Response.write "<script language='javascript'>"&_
  Vbcrlf&"alert("""&StrMSG&""");"&_
  Vbcrlf&"window.location="""&StrURL&""";"&_
  Vbcrlf&"</script>"
End Function

'--------------------------------------------------------------------------
' 函數(shù)功能: 通用分頁
' 參    數(shù):   Intpagecount 總頁數(shù)
'    Intmypage  當前頁數(shù)
'    Intrecordcount  記錄總數(shù)
'    Intpagesize 每頁顯示的記錄數(shù) 
'--------------------------------------------------------------------------
function funpage(Intpagecount,Intmypage,Intrecordcount,Intpagesize)
  'on error resume next
  dim Intfor,Intlist,intlist_b
  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 
  if intmypage>1 then
   funpage=funpage & "<a href='"&action&"?"&temp&"page=1' title='最前頁' class='no'><font face='Webdings'>9</font></a>"
   funpage=funpage&"<a href='"&action&"?"&temp&"page="&Intmypage-1 & "' title='上一頁' class='no'><font face='Webdings'>7</font></a>"
  else
   funpage=funpage &"<font face='Webdings'>9</font>"
    funpage=funpage&"<font face='Webdings'>7</font>"
  end if
  if Intlist<>0 then
   if cintmypage= Intlist then
   Intlist=Intlist+5 
   end if
   else
    Intlist=Intmypage+5
   end if
   if intlist-9<1 then
      intlist_b=1
   else
     intlist_b=intlist-9
   end if 
   for Intfor=intlist_b to Intlist         
    if intfor<=Intpagecount then             
     if intfor=Intmypage then       '-------使當前頁文字為紅色,并不可點擊
     funpage =funpage & strMode&" <font color='#FF0000'><b>"& Intfor & "</b></font>"
    else
     funpage=funpage & strMode &" <a href='"&action&"?"&temp&"page=" & Intfor &"' class='no'>" & Intfor & "</a>"
    end if
   end if
   strMode=" <font color='#BBBBBB'>|</font> "
   next
   if intmypage<intpagecount then
    funpage=funpage&" <a href='"&action&"?"&temp&"page="& Intmypage+1 &"' title='后一頁' class='no'><font face='Webdings'>8</font></a>"
     funpage=funpage &"<a href='"&action&"?"&temp&"page="& Intpagecount & "' title='最后頁' class='no'><font face='Webdings'>:</font></a>"
   else
    funpage=funpage&" <font face='Webdings'>8</font>"
     funpage=funpage &"<font face='Webdings'>:</font></a>"
   end if
   funpage="<table width='100%' border='0' cellspacing='0' cellpadding='0'><tr>"&_
    vbcrlf&"<td width='40%' style=font:14px> 當前第"&Intmypage&"頁  "&Intpagesize&"條/頁  共"&Intpagecount&"頁/"&Intrecordcount&"條記錄< /td>"&_
    vbcrlf&"<td width='60%' align='right'>"&_
    vbcrlf&"<table width='360' border='0' cellspacing='0' cellpadding='0'><tr>"&_
    vbcrlf&"<td align='right' style=font:14px>"&funpage&" </td>"&_
     vbcrlf&"</tr></table></td></tr>"&_
     vbcrlf&"</table>"
  if err.number<>0 then
  err.clear
response.redirect("error.asp?err=分頁函數(shù)出錯,請與管理員聯(lián)系!|")
  end if
end function
'***************************************************
'函數(shù)名:Highlight
'功能:搜索的關(guān)鍵詞以高亮的顏色顯示
'參數(shù)strText是要被高亮顯示的字符串或變量所在的字串或變量
'strFind是要被高亮顯示的字符串或變量,
'strBefore被高亮顯示的HTML代碼前綴如:<font color=red>
'strAfter被高亮顯示的HTML代碼的后綴:</font>
'*****************************************************
Function Highlight(strText, strFind, strBefore, strAfter)
Dim nPos
Dim nLen
Dim nLenAll

nLen = Len(strFind)
nLenAll = nLen + Len(strBefore) + Len(strAfter) + 1
Highlight = strText
If nLen > 0 And Len(Highlight) > 0 Then
nPos = InStr(1, Highlight, strFind, 1)
Do While nPos > 0
Highlight = Left(Highlight, nPos - 1) & _
strBefore & Mid(Highlight, nPos, nLen) & strAfter & _
Mid(Highlight, nPos + nLen)
nPos = InStr(nPos + nLenAll, Highlight, strFind, 1)
Loop
End If
End Function

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 国产视频导航 | 日日操日日操 | 欧美日韩精品不卡一区二区三区 | 视频一区二区三区在线播放 | 午夜视频在线免费观看 | 日本黄色不卡视频 | 看毛片的网址 | 精品国产91久久久久久浪潮蜜月 | 国产午夜精品在线 | 欧美巨根 | 天天躁狠狠躁夜躁2020挡不住 | 免费一级特黄毛片 | 久久草在线视频免费 | 日韩大片在线永久观看视频网站免费 | 中文字幕在线亚洲精品 | 日本娇小videos高潮 | 色七七亚洲 | 在线观看视频毛片 | 毛片免费观看视频 | 久久久久久久久久久久久久久久久久 | 午夜精品成人 | 国产亚洲黑人性受xxxx精品 | 成熟女人特级毛片www免费 | av在线影片 | 日夜操天天干 | 久久综合久久美利坚合众国 | 国产亚洲欧美视频 | www.69色| 亚洲免费观看视频 | 午夜噜噜噜 | 久久手机在线视频 | 久综合色 | 狠狠操操 | 成人毛片免费看 | 欧美性生交xxxxx免费观看 | 亚洲成人免费视频在线 | 亚洲网站免费观看 | 亚洲特黄| 国产亚洲精品久久久久婷婷瑜伽 | 黄色7777| 精品国产乱码久久久久久久久 |