asp防注入函数

Function SafeRequest(ParaName,ParaType)
 '--- 传入参数 ---
 'ParaName:参数名称-字符型
 'ParaType:参数类型-数字型(1表示以上参数是数字,0表示以上参数为字符)
 Dim ParaValue
 ParaValue=Request(ParaName)
 If ParaType=1 then
 If ParaValue="" then
  ParaValue=1
 end if
  if not isNumeric(ParaValue) then
   Response.write "参数" & ParaName & "必须为数字型!"
   Response.end
  End if
 Else
  ParaValue =  Replace(ParaValue,Chr(0),"")
  ParaValue =  Replace(ParaValue,"<","&lt;")
  ParaValue =  Replace(ParaValue,">","&gt;")
  ParaValue =  Replace(ParaValue,"'","''")
  ParaValue =  Replace(ParaValue,"""","''")
 End if
 SafeRequest = trim(ParaValue)
End Function

标签: 注入函数asp
------分隔线----------------------------
· 首页 · 注册

百鸣[Baiming.org]欢迎您 百鸣[Baiming.org]欢迎您~