Access数据库防注入 20
我有一个网站老被注入,Conn代码如下,那位高人请帮忙完善一下代码。(注我出全部家当20分,小弟总共只有这么多分,请包涵。)<%dimconndimconnstrdimd...
我有一个网站老被注入,Conn代码如下,那位高人请帮忙完善一下代码。(注我出全部家当20分,小弟总共只有这么多分,请包涵。)
<%
dim conn
dim connstr
dim db
db="(数据所在文件)/my$$you&&tai%%hao++/!&$lixin$$##oopphhggff+++.mdb"
on error resume next
connstr="DBQ="+server.mappath(""&db&"")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.createobject("ADODB.CONNECTION")
if err then
err.clear
else
conn.open connstr
end if
sub CloseConn()
conn.close
set conn=nothing
end sub
dim ad1,ad2,ad3,ad4,ad5,ad6,ad7,ad8,ad9,ad10,ad11,ad12,ad13,ad14,ad15,ad16,ad17,ad18,ad19,ad20,ad21,ad22,ad23,ad24,ad25,ad26,ad27,ad28
Set adRS=Server.CreateObject("Adodb.Recordset")
adrs.open "select * from ad",conn,1,1
ad1 = adrs("ad1")
ad2 = adrs("ad2")
ad3 = adrs("ad3")
ad4 = adrs("ad4")
ad5 = adrs("ad5")
ad6 = adrs("ad6")
ad7 = adrs("ad7")
ad8 = adrs("ad8")
ad9 = adrs("ad9")
ad10 = adrs("ad10")
ad11 = adrs("ad11")
ad12 = adrs("ad12")
ad13 = adrs("ad13")
ad14 = adrs("ad14")
ad15 = adrs("ad15")
ad16 = adrs("ad16")
ad17 = adrs("ad17")
ad18 = adrs("ad18")
ad19 = adrs("ad19")
ad20 = adrs("ad20")
ad21 = adrs("ad21")
ad22 = adrs("ad22")
ad23 = adrs("ad23")
ad24 = adrs("ad24")
ad25 = adrs("ad25")
ad26 = adrs("ad26")
ad27 = adrs("ad27")
ad28 = adrs("ad28")
adrs.close
set adrs=nothing
On Error Resume Next
Server.ScriptTimeOut=9999999
function getHTTPPage(url)
dim http
set http=createobject("MSXML2.XMLHTTP")
Http.open "GET",url,false
Http.send()
if Http.readystate<>4 then
exit function
end if
getHTTPPage=bytes2BSTR(Http.responseBody)
set http=nothing
if err.number<>0 then err.Clear
end function
Function bytes2BSTR(vIn)
dim strReturn
dim i,ThisCharCode,NextCharCode
strReturn = ""
For i = 1 To LenB(vIn)
ThisCharCode = AscB(MidB(vIn,i,1))
If ThisCharCode < &H80 Then
strReturn = strReturn & Chr(ThisCharCode)
Else
NextCharCode = AscB(MidB(vIn,i+1,1))
strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
i = i + 1
End If
Next
bytes2BSTR = strReturn
End Function
%> 展开
<%
dim conn
dim connstr
dim db
db="(数据所在文件)/my$$you&&tai%%hao++/!&$lixin$$##oopphhggff+++.mdb"
on error resume next
connstr="DBQ="+server.mappath(""&db&"")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.createobject("ADODB.CONNECTION")
if err then
err.clear
else
conn.open connstr
end if
sub CloseConn()
conn.close
set conn=nothing
end sub
dim ad1,ad2,ad3,ad4,ad5,ad6,ad7,ad8,ad9,ad10,ad11,ad12,ad13,ad14,ad15,ad16,ad17,ad18,ad19,ad20,ad21,ad22,ad23,ad24,ad25,ad26,ad27,ad28
Set adRS=Server.CreateObject("Adodb.Recordset")
adrs.open "select * from ad",conn,1,1
ad1 = adrs("ad1")
ad2 = adrs("ad2")
ad3 = adrs("ad3")
ad4 = adrs("ad4")
ad5 = adrs("ad5")
ad6 = adrs("ad6")
ad7 = adrs("ad7")
ad8 = adrs("ad8")
ad9 = adrs("ad9")
ad10 = adrs("ad10")
ad11 = adrs("ad11")
ad12 = adrs("ad12")
ad13 = adrs("ad13")
ad14 = adrs("ad14")
ad15 = adrs("ad15")
ad16 = adrs("ad16")
ad17 = adrs("ad17")
ad18 = adrs("ad18")
ad19 = adrs("ad19")
ad20 = adrs("ad20")
ad21 = adrs("ad21")
ad22 = adrs("ad22")
ad23 = adrs("ad23")
ad24 = adrs("ad24")
ad25 = adrs("ad25")
ad26 = adrs("ad26")
ad27 = adrs("ad27")
ad28 = adrs("ad28")
adrs.close
set adrs=nothing
On Error Resume Next
Server.ScriptTimeOut=9999999
function getHTTPPage(url)
dim http
set http=createobject("MSXML2.XMLHTTP")
Http.open "GET",url,false
Http.send()
if Http.readystate<>4 then
exit function
end if
getHTTPPage=bytes2BSTR(Http.responseBody)
set http=nothing
if err.number<>0 then err.Clear
end function
Function bytes2BSTR(vIn)
dim strReturn
dim i,ThisCharCode,NextCharCode
strReturn = ""
For i = 1 To LenB(vIn)
ThisCharCode = AscB(MidB(vIn,i,1))
If ThisCharCode < &H80 Then
strReturn = strReturn & Chr(ThisCharCode)
Else
NextCharCode = AscB(MidB(vIn,i+1,1))
strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
i = i + 1
End If
Next
bytes2BSTR = strReturn
End Function
%> 展开
2个回答
2010-10-13
展开全部
youlin1234 楼上的兄弟能不能把上面的代码改好发在网上,我也遇到同样的问题。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询