<%
'on error resume next
call DefendSqlInsert()
dim conn,ConnStr
ConnStr="driver={Microsoft Access Driver (*.mdb)};dbq="&Server.MapPath(DatabaseUrl)&";uid=;pwd=;"
set conn=server.CreateObject("adodb.connection") 
conn.open ConnStr
if Err.Number <> 0 then
		Response.Write("<script>alert('[系统错误]\n\n数据库连接错误！请检查系统参数设置:SqlServer连接参数(在/inc/config.asp中)!');</script>")  
        Response.End
end if
'''''''''''''''''''''''''''''''''''''''''''''''''''''
'是否外部提交
''''''''''''''''''''''''''''''''''''''''''''''''''''
Function isSelfRefer() 
	Dim sHttp_Referer, sServer_Name 
	sHttp_Referer = CStr(Request.ServerVariables("HTTP_REFERER")) 
	sServer_Name = CStr(Request.ServerVariables("SERVER_NAME")) 
	If Mid(sHttp_Referer, 8, Len(sServer_Name)) = sServer_Name Then 
		IsSelfRefer = True 
	Else 
		IsSelfRefer = False 
	End If 
End Function 
'防止注入
Sub DefendSqlInsert
	dim param,val
	For Each param In Request.QueryString
    	val=request.QueryString(param)
		If InStr(val,"'")>0 or InStr(val,"0x")>0 Then
			response.Write("<script>alert('error');</script>")
			response.End()
		end if
	Next
end sub
sub connclose	
   conn.close
   set conn=nothing   
end sub
%>