<%
Dim Starttime,endtime,dothetime
starttime=timer()

Dim SchoolmateURL,ErrMsg

Dim PointSet

Dim IntVar,StrVar
Dim BoolVar(25)
dim joinquestion,joinanswer,joinanswerts

Dim ClassNum,UserNum,Photonum,liuyannum
Dim bbsnum,topicnum,todaynum

Dim Conn,ConnStr
%>
<!--#include file="../SqlConfig.asp" -->
<%

ConnStr = "Provider = Sqloledb; User ID = " & SqlUsername & "; Password = " & SqlPassword & "; Initial Catalog = " & SqlDatabaseName & "; Data Source = " & SqlLocalName & ";"
Set Conn = Server.CreateObject("ADODB.Connection")
On Error Resume Next
Conn.Open ConnStr
If Err Then
	err.Clear
	Set Conn = Nothing
	Response.Write "数据库连接出错，请检查连接字串。"
	Response.End
End If

Call getconst()

Sub getconst()

	Dim ConfigRs,ConfigStr
	Dim pageurl,tmpstr,i
	ConfigStr=""

    if application("FengLing_Config")="" or DateDiff("s",CDate(Application("FengLing_Updatetime")),Now()) >= 3600 Then
	set ConfigRs=Conn.Execute("select point,IntVar,StrVar,BoolVar,UserNum,ClassNum,bbsNum,topicNum,TodayNum,Photonum,Liuyannum,question,answer,answerts from config")
	for i=0 to 13
	if ConfigStr<>"" Then
	   ConfigStr=ConfigStr&"@@@"&ConfigRs(i)
	else
	ConfigStr=ConfigRs(i)
	end if
	next
	application("FengLing_Config")=ConfigStr
	Application("FengLing_Updatetime")=now()
	end if
	ConfigStr=application("FengLing_Config")
	ConfigRs=split(ConfigStr,"@@@")


	pageurl=Request.ServerVariables("server_name")&Request.ServerVariables("URL")
	tmpstr=Split(pageurl,"/")
	schoolmateurl="http://"&replace(pageurl, tmpstr(ubound(tmpstr)), "")
	
	UserNum=ConfigRs(4)
	ClassNum=ConfigRs(5)
	Photonum=ConfigRs(9)
	Liuyannum=ConfigRs(10)

	bbsnum=ConfigRs(6)
	topicnum=ConfigRs(7)
	todaynum=ConfigRs(8)

	PointSet=split(ConfigRs(0),",")
	IntVar=split(ConfigRs(1),",")
	StrVar=split(ConfigRs(2),"|||")
	joinquestion=split(ConfigRs(11),"|")
	joinanswer=split(ConfigRs(12),"|")
	joinanswerts=split(ConfigRs(13),"|")
	
	for i=0 to ubound(BoolVar)
		BoolVar(i)=cbool(mid(ConfigRs(3),i+1,1))
	next
	
	Set ConfigRs=Nothing

End Sub


Sub EndConnection()
	Conn.close
	Set Conn=Nothing
	Erase IntVar
	Erase StrVar
	Erase BoolVar
	Erase PointSet
	Erase joinquestion
	Erase joinanswer
	Erase joinanswerts

End Sub

Sub Error(errorlevel,ErrMsg)
%>
<br><br>
<table cellpadding=0 cellspacing=0 border=0	width=80% Class=TableBorder	align=center>
<tr>
	<td>
		<table cellpadding=5 cellspacing=1 border=0	width=100%>
		<tr	align="center">	
		  <th width="100%"><b>校友录错误信息</b></th>
		</tr>
		<tr>
			<td class=forumRow><table	width="100%" height="100%" border="0" Class=LightTableBody>
				<tr><td width=80 align=center><img src="images/<%=errorlevel%>.gif" align=absmiddle></td>
					<td valign=center><br><b>产生错误的可能原因：</b><br><br>
					<li>您是否仔细阅读了<a href=../Class_Help.asp target=_blank>帮助文件</a><%=ErrMsg%><br><br>
					</td>
				</tr>
				</table>
			</td>
		</tr>
		<tr	align="center">	
		  <td width="100%" Class=forumrowhighlight><input type=button onclick="javascript:history.go(-1)" value="确定(O)" style="width:65px" accesskey=o class=button>
		  </td>
		</tr>  
		</table>
	</td>
</tr>
</table><BR>
<%End Sub%>
<%
Sub adminmsg(byval sucmsg)
endtime=timer
dothetime=cstr(int(( (endtime-starttime)*10000 )+0.5)/10)
	Response.Write "<br>"&_
		"<table cellpadding=5 cellspacing=1 border=0 align=center width=""100%""  Class=TableBorder>"&_
			"<tr align=center><th>操作成功</th></tr>"&_
			"<tr><td class=""forumRow"" height=80>&nbsp;&nbsp;<li>"&sucmsg&"<br>&nbsp;&nbsp;<li>共耗时 <font color=red>" & dothetime & " 毫秒</font><br>&nbsp;&nbsp;<li><a href="&Request.ServerVariables("HTTP_REFERER")&"><font color=red>点击这里返回</font></a></td></tr>"&_
		"</table><BR>"
End Sub
%>