非法字元過濾函數

來源:互聯網
上載者:User

Function ChkStr(InString) '非法字元過濾函數
  If InString<>"" Then
   InString=Replace(LCase(InString)," ","")
   InString=Replace(LCase(InString),";","")
   InString=Replace(LCase(InString),"'","")
   InString=Replace(LCase(Instring),"--","")
   Instring=Replace(LCase(Instring),"%","")
   InString=Replace(LCase(InString),"%20","")
  
   InString=Replace(LCase(InString),"admin","")
  
   InString=Replace(LCase(InString),"and","")
   InString=Replace(LCase(InString),"or","")
  
   InString=Replace(LCase(InString),"asc","")
   InString=Replace(LCase(Instring),"chr","")
   InString=Replace(LCase(InString),"mid","")
   InString=Replace(LCase(InString),"len","")
  
   InString=Replace(LCase(InString),"select","")
   InString=Replace(LCase(InString),"insert","")
   InString=Replace(LCase(InString),"delete","")
   InString=Replace(LCase(InString),"update","")
  
  
   ChkStr=InString
  End If
  End Function
  
  Function CheckFileExt(FileExt) '檢測副檔名
   Dim FileAccessExt,AccessExt
   AccessExt="gif,jpg,jpeg,bmp,doc,txt,png"
   FileAccessExt=Split(AccessExt,",")
   For i=LBound(FileAccessExt) to UBound(FileAccessExt)
   If LCase(FileExt)=LCase(FileAccessExt(i)) Then
   CheckFileExt=True
   Else
   CheckFileExt=False
   End If
   Next
  End Function
  
  Function CheckStr(str,IsStr) '檢查非法字元和數字資料
  CheckStr=str
  If IsStr And InStr(str,",")>0 Then
   Call errmsg("提交字元中包含非法字元")
  ElseIf (Not IsStr) And (Not IsNumeric(str)) Then
   Call errmsg("提交不是數字型")
  End If
  End Function
  
  Sub errmsg(str)
   If Not IsNull(str) Then
   Response.Write(str)&"< br >"
   Call ASCpy()
   Response.End() 
   End If
  End Sub
  
  
   Sub ASCpy()
   Response.Write "<link href='Css/Maincss.css' rel='stylesheet' type='text/css'>"
   Response.Write "<div align='center' class='Maincss'>"
   Response.Write("<Center>Error happed!<br>Please Contract ")
   Response.Write("Name:<a href='mailto:jdqn@sjzu.edu.cn' style='text-decoration:none'>")
   Response.Write("<font Color=red>AloneSword</font>")
   Response.Write("</a>.<br>Thank you!!!</Center><br>")
   Response.Write "<hr>Copyright © By <a href='#' style='text-decoration:none'>建大網路</a> ™<br>"
   Response.Write "Last Modified:21/08/2004<br>"
   Response.Write("Author:<a href='http://blog.111cn.net/alonesword/' style='text-decoration:none' target='_blank'>AloneSword</a>")
   Response.Write "</div>"
  End Sub 
本文來自:http://www.111cn.net/

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.