<%@ CodePage=936 Language="VBScript"%>
<%
Response.Charset="gb2312"
Response.Buffer=True
IsSqlDataBase=0		'定义数据库类别，0为Access数据库，1为SQL数据库
If IsSqlDataBase=0 Then
'''''''''''''''''''''''''''''' Access数据库设置 '''''''''''''''''''''''''''''''''''''''''''''''''''''''''
	SqlDataBase	= "/site/Data/#fav.mdb"	'数据库路径
	SqlProvider	= "Microsoft.Jet.OLEDB.4.0"	'驱动程序[ Microsoft.Jet.OLEDB.4.0  Microsoft.ACE.OLEDB.12.0 ]
	Connstr="Provider="&SqlProvider&";Data Source="&(SqlDataBase)
	SqlNowString="Now()"
	SqlChar="'"
	IsSqlVer="ACCESS"
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Else
'''''''''''''''''''''''''''''' SQL数据库设置 ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
	SqlLocalName	="(local)"	'连接IP  [ 本地用 (local) 外地用IP ]
	SqlUserName	="sa"		'SQL用户名
	SqlPassword	="1"		'SQL用户密码
	SqlDataBase	="BBSXPXP2007"	'数据库名
	SqlProvider	="SQLOLEDB"	'驱动程序 [ SQLOLEDB  SQLNCLI ]
	ConnStr="Provider="&SqlProvider&"; User ID="&SqlUserName&"; Password="&SqlPassword&"; Initial CataLog="&SqlDataBase&"; Data Source="&SqlLocalName&";"
	SqlNowString="GetDate()"
	IsSqlVer="MSSQL"
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
END IF
On Error Resume Next
Set Conn=Server.CreateObject("ADODB.Connection")
Conn.open ConnStr
If Err Then
	Response.Write ""&IsSqlVer&"数据库连接出错，请检查连接字串。<br><br>"&Err.Source&" ("&Err.Number&")"
	Set Conn = Nothing
	err.Clear
	Response.End
End If
On Error GoTo 0
set AutoTerminate=new AutoTerminate_Class
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
ForumsBuild="7.2.070625"
ForumsProgram="BBSXP 2007 "&IsSqlVer&" Beta"

Set Rs=Execute("Select * from [BBSXP_SiteSettings]")
	CreateUserAgreement = Rs("CreateUserAgreement")
	GenericHeader = Rs("GenericHeader")
	GenericTop = Rs("GenericTop")
	GenericBottom = Rs("GenericBottom")
	BestOnline = Rs("BestOnline")
	BestOnlineTime = Rs("BestOnlineTime")
	SiteSettingsXML=Rs("SiteSettingsXML")
	BBSxpDataBaseVersion = Rs("BBSxpVersion")
Rs.Close
Set Rs=Nothing
Set Rs = Server.CreateObject("ADODB.Recordset")

Set XMLDOM=Server.CreateObject("Microsoft.XMLDOM")
Set SiteConfigXMLDOM=Server.CreateObject("Microsoft.XMLDOM")
SiteConfigXMLDOM.loadxml("<bbsxp>"&SiteSettingsXML&"</bbsxp>")

if IsNumeric(RequestCookies("UserID")) then
	sql="Select * from [BBSXP_Users] where UserID="&RequestCookies("UserID")&""
	Set Rs=Execute(sql)
	if Rs.eof then
		CleanCookies()
	elseif RequestCookies("Userpass") <> Rs("Userpass") then
		CleanCookies()
	else
		CookieUserID=Rs("UserID")
		CookieUserName=Rs("UserName")
		CookieUserPass=Rs("UserPass")
		CookieUserEmail=Rs("UserEmail")
		CookieUserMoney=Rs("UserMoney")
		CookieNewMessage=Rs("NewMessage")
		CookieUserAccountStatus=Rs("UserAccountStatus")
		CookieUserRoleID=Rs("UserRoleID")
		CookieUserMate=Rs("UserMate")
		
		
		if CookieUserRoleID=1 or CookieUserRoleID=2 then BestRole=1
	end if
	Rs.Close
end if
'''''''''''''''''''''''''''''''''''''''''''
Server.ScriptTimeout=SiteConfig("Timeout")	'设置脚本超时时间 单位:秒

REMOTE_ADDR=Server.HTMLEncode(Request.ServerVariables("REMOTE_ADDR"))
Script_Name=LCase(Request.ServerVariables("script_name"))
Server_Name=Request.ServerVariables("server_name")
ReturnUrl=Request.ServerVariables("http_referer")

DomainPath=Left(Script_Name,inStrRev(Script_Name,"/"))
SiteURL="http://"&Server_Name&DomainPath

if RequestCookies("Themes")=empty then ResponseCookies "Themes",SiteConfig("DefaultSiteStyle"),"0"

dim SqlQueryNum,ForumsList,ForumTreeList,TotalPage,PageCount,RankName,RankIconUrl,IsResponseTop,MailSubject,MailBody
startime=timer()
%>
