asp get和post數(shù)據(jù)接收過(guò)濾
更新時(shí)間:2009年02月20日 01:41:00 作者:
asp get和post數(shù)據(jù)接收過(guò)濾函數(shù),一些為了安全
復(fù)制代碼 代碼如下:
<%
'--------定義部份------------------
Dim XH_Post,XH_Get,XH_In,XH_Inf,XH_Xh,XH_db,XH_dbstr
'自定義需要過(guò)濾的字串,用 "|" 分隔
XH_In = "'|;|and|exec|insert|select|delete%20from|update|count|*|%|chr|mid|master|truncate|char|declare|drop%20table|from|net%20user|xp_cmdshell|/add|net%20localgroup%20administrators|Asc|char"
'----------------------------------
%>
<%
XH_Inf = split(XH_In,"|")
'--------POST部份------------------
If Request.Form<>"" Then
For Each XH_Post In Request.Form
For XH_Xh=0 To Ubound(XH_Inf)
If Instr(LCase(Request.Form(XH_Post)),XH_Inf(XH_Xh))<>0 Then
Response.Write "<Script Language=JavaScript>alert('請(qǐng)不要在參數(shù)中包含非法字符嘗試注入!');</Script>"
Response.Write "非法操作!系統(tǒng)做了如下記錄↓<br>"
Response.Write "操作IP:"&Request.ServerVariables("REMOTE_ADDR")"<br>"
Response.Write "操作時(shí)間:"&Now"<br>"
Response.Write "操作頁(yè)面:"&Request.ServerVariables("URL")"<br>"
Response.Write "提交方式:POST<br>"
Response.Write "提交參數(shù):"&XH_Post"<br>"
Response.Write "提交數(shù)據(jù):"&Request.Form(XH_Post)
Response.End
End If
Next
Next
End If
'----------------------------------
'--------GET部份-------------------
If Request.QueryString<>"" Then
For Each XH_Get In Request.QueryString
For XH_Xh=0 To Ubound(XH_Inf)
If Instr(LCase(Request.QueryString(XH_Get)),XH_Inf(XH_Xh))<>0 Then
Response.Write "<Script Language=JavaScript>alert('請(qǐng)不要在參數(shù)中包含非法字符嘗試注入!');</Script>"
Response.Write "非法操作!系統(tǒng)做了如下記錄↓<br>"
Response.Write "操作IP:"&Request.ServerVariables("REMOTE_ADDR")"<br>"
Response.Write "操作時(shí)間:"&Now"<br>"
Response.Write "操作頁(yè)面:"&Request.ServerVariables("URL")"<br>"
Response.Write "提交方式:GET<br>"
Response.Write "提交參數(shù):"&XH_Get"<br>"
Response.Write "提交數(shù)據(jù):"&Request.QueryString(XH_Get)
Response.End
End If
Next
Next
End If
'----------------------------------
%>
相關(guān)文章
asp 實(shí)現(xiàn)當(dāng)有新信息時(shí)播放語(yǔ)音提示的效果
最近做一套程序的時(shí)候,客戶要求當(dāng)有新信息的時(shí)候播放一段語(yǔ)音來(lái)提示一下,根據(jù)情況,總結(jié)思路如下2009-06-06asp中讓function同時(shí)返回多個(gè)值的代碼
asp中讓function同時(shí)返回多個(gè)值的代碼,需要的朋友可以參考下。2011-02-02關(guān)于ASP生成偽參數(shù)技巧 簡(jiǎn)潔實(shí)用的偽(僞)參數(shù)
關(guān)于ASP生成偽參數(shù)技巧 簡(jiǎn)潔實(shí)用的偽(僞)參數(shù)...2007-11-11asp下實(shí)現(xiàn)批量插入數(shù)據(jù)的方法
asp下實(shí)現(xiàn)批量插入數(shù)據(jù)的方法...2007-08-08