这段代码 中间连接数据库,其他的不是很清楚,有谁讲解一下吗?

win7cc win7cc 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
<%
'On Error Resume Next
dim ServerPath
ServerPath = Request.ServerVariables("URL")
ServerPath = Split(LCase(ServerPath),"/manage/")(0)
ServerPath = "/"

dim DbPath,Pwd,conn
DbPath = SERVER.MapPath(ServerPath&"Data/Data.mdb")
Set conn= Server.CreateObject("ADODB.Connection")
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="& DbPath
'response.Write dbpath
Call GetSiteInfo()

if Err then
Err.Clear
'response.Write("<meta http-equiv='Content-Type' content='text/html; charset=gb2312'>")
PMsg="数据库连接错误!请检查连接字串!"
'Call PopMsg("连接数据库")
end if

Sub CloseConn()
conn.close()
set conn=nothing
end sub

if request("repl")<>"off" then
Call ChkData()
end if

sub ChkData()
'--------定义部份------------------
Dim XH_Post,XH_Get,XH_In,XH_Inf,XH_Xh,XH_db,XH_dbstr
'自定义需要过滤的字串,用 "|" 分隔
XH_In = "'|;|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
PMsg = "处理数据时发生错误!<br />数据类型不匹配!"
Call PopMsg("数据类型")
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
PMsg = "处理数据时发生错误!<br />数据类型不匹配!"
Call PopMsg("数据类型")
End if
Next
Next
End if
'----------------------------------
end sub%>


这段代码 中间连接数据库,其他的不是很清楚,有谁讲解一下吗?
...全文

相关推荐

评论 2
收藏 已收藏
分享
返回顶部
win7cc
ASP 28,400 成员 356,938 内容