<% option explicit dim conn,connstr,i,sql,rs '''---服务器1设置开始 const serverIP1 = "" '''服务器IP地址 const DbUserName1 = "" '''数据库用户名 const DbPassword1 = "" ''数据库密码 const DatabaseName1 = "" ''数据库名 '''---服务器1设置结束 '''---服务器2设置开始 const serverIP2 = "" '''服务器IP地址 const DbUserName2 = "" '''数据库用户名 const DbPassword2 = "" ''数据库密码 const DatabaseName2 = "" ''数据库名 '''---服务器2设置结束 '''---服务器3设置开始 const serverIP3 = "" '''服务器IP地址 const DbUserName3 = "" '''数据库用户名 const DbPassword3 = "" ''数据库密码 const DatabaseName3 = "" ''数据库名 '''---服务器3设置结束 dim connstr1,connstr2,connstr3 connstr1="driver={mysql odbc 3.51 driver}; server="&serverIP1&";uid="&DbUserName1&";pwd="&DbPassword1&";database="&DatabaseName1&"" connstr2="driver={mysql odbc 3.51 driver}; server="&serverIP2&";uid="&DbUserName2&";pwd="&DbPassword2&";database="&DatabaseName2&"" connstr3="driver={mysql odbc 3.51 driver}; server="&serverIP3&";uid="&DbUserName3&";pwd="&DbPassword3&";database="&DatabaseName3&""
Function OpenDb(s) Set conn = Server.CreateObject("ADODB.Connection") select case s case 1 conn.open Connstr1 case 2 conn.open Connstr2 case 3 conn.open Connstr3 case else conn.open Connstr1 end select End Function
FUNCTION GetError(str) Response.Write(str) Response.End()
End Function
Public Function CheckStr(Str) If Isnull(Str) Then CheckStr = "" Exit Function End If Str = Replace(Str,Chr(0),"") Str = Replace(Str,chr(34),"") Str = Replace(Str,";","") CheckStr = Replace(Str,"'","''") End Function public Function GetQS(str) if str = "" then exit Function GetQS = CheckStr(trim(Request.QueryString(Str))) End function Public Function GetForm(s) if s="" then exit function GetForm=CheckStr(trim(request.Form(s))) End Function Public Function GetForm2(s) if s="" then exit function GetForm2=trim(request.Form(s)) End Function Public Function ChkPost() Dim server_v1,server_v2 Chkpost=False server_v1=Cstr(Request.ServerVariables("HTTP_REFERER")) server_v2=Cstr(Request.ServerVariables("SERVER_NAME")) If Mid(server_v1,8,len(server_v2))=server_v2 Then Chkpost=True else response.Write("<li>不允许提交外部发言,请检查您的浏览器或者防火墙是否过滤了REF参数<li>如果多次出现该情况,请清空您的临时文件或者重启您的计算机。") Chkpost=False end if End Function
%> |