国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 編程 > ASP > 正文

asp 獲取參數(shù)值與sql安全過濾參數(shù)函數(shù)代碼

2024-05-04 10:59:52
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友
復(fù)制代碼 代碼如下:
'獲取參數(shù)值
Function getForm(element,ftype)
Select case ftype
case "get"
getForm=trim(request.QueryString(element))
case "post"
getForm=trim(request.Form(element))
case "both"
if isNul(request.QueryString(element)) then getForm=trim(request.Form(element)) else getForm=trim(request.QueryString(element))
End Select
getForm=replace(getForm,CHR(34),""")
getForm=replace(getForm,CHR(39),"'")
End Function
'主要功能就是獲取參數(shù)值,比直接用request("element")要安全很多


'過濾參數(shù)
Function filterPara(byVal Para)
filterPara=preventSqlin(Checkxss(Para))
End Function

Function preventSqlin(content)
dim sqlStr,sqlArray,i,speStr
sqlStr="<|>|%|%27|'|''|;|*|and|exec|dbcc|alter|drop|insert|select|update|delete|count|master|truncate|char|declare|where|set|declare|mid|chr"
if isNul(content) then Exit Function
sqlArray=split(sqlStr,"|")
for i=lbound(sqlArray) to ubound(sqlArray)
if instr(lcase(content),sqlArray(i))<>0 then
select case sqlArray(i)
case "<":speStr="<"
case ">":speStr=">"
case "'","""":speStr="""
'case ";":speStr=";"
case else:speStr=""
end select
content=replace(content,sqlArray(i),speStr,1,-1,1)
end if
next
preventSqlin=content
End Function
'上面的參數(shù)過濾函主要是防止sql注入,加強(qiáng)的防護(hù)。
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 乌拉特后旗| 阿鲁科尔沁旗| 阳原县| 青浦区| 古浪县| 手机| 台南县| 玉龙| 三台县| 津市市| 涞水县| 德阳市| 卓资县| 安福县| 洪湖市| 嘉鱼县| 马关县| 通许县| 晋江市| 汕尾市| 长沙县| 沙湾县| 青田县| 乌恰县| 隆回县| 北宁市| 洛阳市| 珠海市| 喜德县| 绍兴县| 青铜峡市| 金湖县| 团风县| 诸暨市| 桦川县| 土默特左旗| 台湾省| 阳春市| 西藏| 顺平县| 额敏县|