下面給出4個函數(shù),足夠你抵擋一切SQL注入漏洞!讀懂代碼,你就能融會貫通。
注意要對所有的request對象進行過濾:包括 request.cookie, request.ServerVariables 等等容易被忽視的對象:
復(fù)制代碼 代碼如下:
function killn(byval s1) '過濾數(shù)值型參數(shù)
if not isnumeric(s1) then
killn=0
else
if s10 or s1>2147483647 then
killn=0
else
killn=clng(s1)
end if
end if
end function
function killc(byval s1) 過濾貨幣型參數(shù)
if not isnumeric(s1) then
killc=0
else
killc=formatnumber(s1,2,-1,0,0)
end if
end function
function killw(byval s1) '過濾字符型參數(shù)
if len(s1)=0 then
killw=""
else
killw=trim(replace(s1,"'",""))
end if
end function
function killbad(byval s1) 過濾所有危險字符,包括跨站腳本
If len(s1) = 0 then
killbad=""
else
killbad = trim(replace(replace(replace(replace(replace(replace(replace(replace(s1,Chr(10), "br>"), Chr(34), """), ">", "gt;"), "", "lt;"), "", ""),chr(39),"#39"),chr(32)," "),chr(13),""))
end if
end function
您可能感興趣的文章:- access數(shù)據(jù)庫的一些少用操作,ASP,創(chuàng)建數(shù)據(jù)庫文件,創(chuàng)建表,創(chuàng)建字段,ADOX
- ASP ACCESS 日期操作語句小結(jié) By Stabx
- asp 獲取access系統(tǒng)表,查詢等操作代碼
- Asp 操作Access數(shù)據(jù)庫時出現(xiàn)死鎖.ldb的解決方法
- asp.net(C#) Access 數(shù)據(jù)操作類
- asp實現(xiàn)的查詢某關(guān)鍵詞在MSSQL數(shù)據(jù)庫位置的代碼
- asp 在線備份與恢復(fù)sqlserver數(shù)據(jù)庫的代碼
- asp連接mysql數(shù)據(jù)庫詳細實現(xiàn)代碼
- asp連接access、sql數(shù)據(jù)庫代碼及數(shù)據(jù)庫操作代碼
- asp操作access提示無法從指定的數(shù)據(jù)表中刪除原因分析及解決
- ASP中巧用Split()函數(shù)生成SQL查詢語句的實例
- asp執(zhí)行帶參數(shù)的sql語句實例
- ASP 連接 SQL SERVER 2008的方法
- ASP通過ODBC連接SQL Server 2008數(shù)據(jù)庫的方法
- ASP語言實現(xiàn)對SQL SERVER數(shù)據(jù)庫的操作