这段代码 中间连接数据库,其他的不是很清楚,有谁讲解一下吗?
<%
'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%>
这段代码 中间连接数据库,其他的不是很清楚,有谁讲解一下吗?
'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%>
这段代码 中间连接数据库,其他的不是很清楚,有谁讲解一下吗?
...全文
相关推荐
利用java的jdbc连接数据库中间件
利用java bean编写连接数据库的中间件,用户只需要进行输入连接的数据库用户名和密码以及所需要连接的数据库就可以,不需要管理主程序
各种数据库连接工具Database4,用起来很方便
各种数据库连接工具Database4,用起来很方便,支持多重数据库连接
Oracle 数据库(Database, DB)
数据库基本概念 数据库(Database, DB) 数据库管理系统(Database Management System, DBMS) 数据库管理员( Database Administrator, DBA) 数据库系统( Database System, DBS ) 关系型数据库 E-R 模型(Entry-Relation)
QT连接数据库的QSqlDatabase类
详解QT数据库类,详细讲解了QT连接Access的具体操作,以及个人的一些理解
Python连接数据库学习之DB-API详解
在没有 Python DB-API 之前,各数据库之间的应用接口非常混乱,实现各不相同。如果项目需要更换数据库时,则需要做大量的修改,非常不便。Python DB-API 的出现就是为了解决这样的问题。本文主要介绍了Python连接数据库之DB-API的相关资料,需要的朋友可以参考。


