香蕉榴莲秋葵绿巨人www,51黑料网,久久中文骚妇内射,色综合久久久无码中文字幕波多

貴陽網(wǎng)頁設計公司ASP網(wǎng)頁防SQL注入的代碼

點擊次數(shù):81 發(fā)布時間:2015-6-28

近日本人有個別網(wǎng)站遭受到SQL入侵,于是上網(wǎng)搜索了一些相關(guān)防SQL注入的方法。

經(jīng)常看到網(wǎng)頁下面有個ADMIN.ASP 說是服務器探針,一直以為是ASP網(wǎng)站才有 原我的的.NET網(wǎng)站下面也出現(xiàn)這種情況故而在網(wǎng)上找些東西

版本頗多,有人覺得這段好用,有人以為那段才行,因此綜合整理了一下,包含以下幾種:

以下為引用的內(nèi)容:
<%
Dim Fy_Url,Fy_a,Fy_x,Fy_Cs(),Fy_Cl,Fy_Ts,Fy_Zx
'---定義部份 頭------
Fy_Cl = 1 '處理方式:1=提示信息,2=轉(zhuǎn)向頁面,3=先提示再轉(zhuǎn)向
Fy_Zx = "index.Asp" '出錯時轉(zhuǎn)向的頁面
'---定義部份 尾------

On Error Resume Next
Fy_Url=Request.ServerVariables("QUERY_STRING")
Fy_a=split(Fy_Url,"&")
redim Fy_Cs(ubound(Fy_a))
On Error Resume Next
for Fy_x=0 to ubound(Fy_a)
Fy_Cs(Fy_x) = left(Fy_a(Fy_x),instr(Fy_a(Fy_x),"=")-1)
Next
For Fy_x=0 to ubound(Fy_Cs)
If Fy_Cs(Fy_x)<>"" Then
If Instr(LCase(Request(Fy_Cs(Fy_x))),"'")<>0 or Instr(LCase(Request(Fy_Cs(Fy_x))),"select")<>0 or Instr(LCase(Request(Fy_Cs(Fy_x))),"update")<>0 or Instr(LCase(Request(Fy_Cs(Fy_x))),"chr")<>0 or Instr(LCase(Request(Fy_Cs(Fy_x))),"delete%20from")<>0 or Instr(LCase(Request(Fy_Cs(Fy_x))),";")<>0 or Instr(LCase(Request(Fy_Cs(Fy_x))),"insert")<>0 or Instr(LCase(Request(Fy_Cs(Fy_x))),"mid")<>0 Or Instr(LCase(Request(Fy_Cs(Fy_x))),"master.")<>0 Then
Select Case Fy_Cl
Case "1"
Response.Write "<Script Language=JavaScript>alert(' 出現(xiàn)錯誤!參數(shù) "&Fy_Cs(Fy_x)&" 的值中包含非法字符串! 請不要在參數(shù)中出現(xiàn):and,select,update,insert,delete,chr 等非法字符! 我已經(jīng)設置了不能SQL注入,請不要對我進行非法手段!');window.close();</Script>"
Case "2"
Response.Write "<Script Language=JavaScript>location.href='"&Fy_Zx&"'</Script>"
Case "3"
Response.Write "<Script Language=JavaScript>alert(' 出現(xiàn)錯誤!參數(shù) "&Fy_Cs(Fy_x)&"的值中包含非法字符串! 請不要在參數(shù)中出現(xiàn):,and,select,update,insert,delete,chr 等非法字符! 設計了門,非法侵入請離開,謝謝!');location.href='"&Fy_Zx&"';</Script>"
End Select
Response.End
End If
End If
Next
%>

以上代碼為較多網(wǎng)友所用,從使用的感言來看,效果顯著。

以下為引用的內(nèi)容:
Dim Query_Badword,Form_Badword,Err_Message,Err_Web,form_name

'------定義部份 頭----------------------------------------------------------------------

Err_Message = 1 '處理方式:1=提示信息,2=轉(zhuǎn)向頁面,3=先提示再轉(zhuǎn)向
Err_Web = "Err.Asp" '出錯時轉(zhuǎn)向的頁面
Query_Badword="'‖and‖select‖update‖chr‖delete‖%20from‖;‖insert‖mid‖master.‖set‖chr(37)‖="
'在這部份定義get非法參數(shù),使用"‖"號間隔
Form_Badword="'‖%‖&‖*‖#‖@‖=‖select‖and‖set‖delete" '在這部份定義post非法參數(shù),使用"‖"號間隔

'------定義部份 尾-----------------------------------------------------------------------
'
On Error Resume Next
'----- 對 get query 值 的過濾.
if request.QueryString<>"" then
Chk_badword=split(Query_Badword,"‖")
FOR EACH Query_form_name IN Request.QueryString
for i=0 to ubound(Chk_badword)
If Instr(LCase(request.QueryString(Query_form_name)),Chk_badword(i))<>0 Then
Select Case Err_Message
Case "1"
Response.Write "<Script Language=JavaScript>alert('傳參錯誤!參數(shù) "&form_name&" 的值中包含非法字符串! 請不要在參數(shù)中出現(xiàn):and update delete ; insert mid master 等非法字符!');window.close();</Script>"

 

  • 添加微信

  • 聯(lián)系電話

    0851-86720570
  • 主站蜘蛛池模板: 新河县| 慈利县| 偃师市| 澳门| 林芝县| 什邡市| 出国| 江口县| 确山县| 肥乡县| 安宁市| 嘉义县| 枞阳县| 耒阳市| 普格县| 土默特左旗| 福建省| 凌海市| 安化县| 柘荣县| 宜阳县| 五常市| 宁晋县| 浪卡子县| 江口县| 邓州市| 中牟县| 睢宁县| 牡丹江市| 黑龙江省| 望谟县| 洛隆县| 龙口市| 七台河市| 公主岭市| 洪雅县| 柳江县| 江西省| 武宣县| 襄汾县| 合水县|