一段asp防注入的通用脚本
程序员文章站
2022-05-03 12:33:14
放在conn.asp里就行了。 '屏蔽通过地址栏攻击 url=request.servervariables("query_string")&nbs...
放在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 ("对不起,请不要输入非法字符!")
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 ("对不起,请不要输入非法字符!")
response.end
end if
next
上一篇: 揭秘一个无本创业项目——拼多多店群
下一篇: 海阳2006+功能中的潜水王