<% @ language = "vbscript" codepage = "936" %>
<% option explicit %>
<% session.codepage = "936" %>
<% response.charset = "gb2312" %>
<% session.timeout = 300 %>
<% server.scripttimeout = 9999 %>
<!--#include file="Const.asp"-->
<%

'on error resume next
dim db1:db1 = "../database/#www1.itmop.com.asa"   '这里必须是绝对路径，即前面必须带/,如果是子目录的话，如"/子目录/database/#itmop.mdb" 就可以
'dim db2:db2 = "/database/#itmop.mdb"
dim conn,conn2

sub dbconn
	set conn = server.createobject(G_654_CONN)
	If G_654_SQL_DB = "1" Then
        Conn = "Provider = Sqloledb; User ID = " & SqlUsername & "; Password = " & SqlPassword & "; Initial Catalog = " & SqlDatabaseName & "; Data Source = " & SqlHostIP & ";"
    elseif G_654_SQL_DB = "0" Then
		Conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db1)    
        '如果你的服务器采用较老版本Access驱动，请用下面连接方法
		'conn.open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath(db)
	end if
	if err.number <> 0 then
		err.clear
		conn.close:set conn = nothing
		response.write("数据库连接出错，请检查连接字串。")
		response.end()
	end if
end sub
sub dbconn2
	set conn2 = server.createobject("adodb.connection")
		conn2.open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath(db2)
	if err.number <> 0 then
		err.clear
		conn2.close:set conn2 = nothing
		response.write("数据库连接出错，请检查连接字串。")
		response.end()
	end if
end sub


sub tools_safefunction
	dim DH654_str1,DH654_str2,DH654_get,DH654_post,DH654_i
		DH654_str1 = "'|;|and|(|)|exec|insert|select|delete|update|count|*|%|chr|mid|master|truncate|char|declare"
		DH654_str2 = split(DH654_str1,"|")
	if request.querystring <> "" then
		for each DH654_get in request.querystring
			for DH654_i = 0 to ubound(DH654_str2)
				if instr(lcase(request.querystring(DH654_get)),DH654_str2(DH654_i)) <> 0 then
					response.write("<script>alert(""请不要输入非法字符!"");window.close();</script>")
					response.end()
				end if
			next
		next
	end if
	if request.form <> "" then
		for each DH654_post in request.form
			for DH654_i = 0 to ubound(DH654_str2)
				if instr(lcase(request.form(DH654_post)),DH654_str2(DH654_i)) <> 0 then
					response.write("<script>alert(""请不要输入非法字符!"");window.close();</script>")
					response.end()
				end if
			next
		next
	end if
end sub
%>
