一段asp防注入的通用腳本
更新時(shí)間:2008年06月04日 08:34:16 作者:
asp防注入效果代碼
放在conn.asp里就行了。
'屏蔽通過地址欄攻擊
url=Request.ServerVariables("QUERY_STRING")
if instr(url,";")>=1 then
url=Replace(url,";",";") : Response.Redirect("?" & url)
end if
'屏蔽通過表單攻擊
for each item in request.form
stritem=lcase(server.HTMLEncode(Request.form(item)))
if instr(stritem,"select ")>=1 or instr(stritem,"insert ")>=1 or instr(stritem,"update ")>=1 or instr(stritem,"delete ")>=1 or instr(stritem,"exec ")>=1 or instr(stritem,"declare ")>=1 then
response.write ("對(duì)不起,請(qǐng)不要輸入非法字符!")
response.end
end if
next
'屏蔽通過地址欄攻擊
url=Request.ServerVariables("QUERY_STRING")
if instr(url,";")>=1 then
url=Replace(url,";",";") : Response.Redirect("?" & url)
end if
'屏蔽通過表單攻擊
for each item in request.form
stritem=lcase(server.HTMLEncode(Request.form(item)))
if instr(stritem,"select ")>=1 or instr(stritem,"insert ")>=1 or instr(stritem,"update ")>=1 or instr(stritem,"delete ")>=1 or instr(stritem,"exec ")>=1 or instr(stritem,"declare ")>=1 then
response.write ("對(duì)不起,請(qǐng)不要輸入非法字符!")
response.end
end if
next
相關(guān)文章
ASP網(wǎng)站中數(shù)據(jù)庫被掛木馬的解決方案
我們?cè)谟肁SP連接數(shù)據(jù)庫開發(fā)應(yīng)用程序時(shí),可能會(huì)遇到ASP數(shù)據(jù)庫被掛木馬的情況,本文我們就介紹了ASP數(shù)據(jù)庫被掛木馬時(shí)的編程處理方法,希望會(huì)對(duì)您有所幫助2015-09-09

