<!-- #include file=../inc/BBSsetup.asp -->
<!-- #include file=../inc/Board_popfun.asp -->
<!-- #include file=inc/UserTopic.asp -->
<%
DEF_BBS_HomeUrl = "../"
Dim GBL_ID
GBL_CHK_PWdFlag = 0
initDatabase
GBL_CHK_TempStr = ""
GBL_ID = GBL_UserID
GBL_CHK_TempStr = ""
SiteHead(DEF_SiteNameString & " - 用户会员区")

UpdateOnlineUserAtInfo GBL_board_ID,"设置版面风格"


Dim HomeUrl
HomeUrl = "http://"&Request.ServerVariables("server_name")
Dim u
u = Request.QueryString("u")
If Left(u,1) <> "/" and Left(u,1) <> "\" and Left(u,Len(HomeUrl)) <> HomeUrl Then u = ""
If u = "" Then
	u = Lcase(Request.ServerVariables("HTTP_REFERER"))

	If Request.ServerVariables("SERVER_PORT") <> "80" Then HomeUrl = HomeUrl & ":" & Request.ServerVariables("SERVER_PORT")

	If Left(u,Len(HomeUrl)) <> Lcase(HomeUrl) Then u = ""
	If inStr(u,"/user/boardstyle.asp") > 0 Then u = ""
End If

UserTopicTopInfo
DisplayUserNavigate("设置版面风格")

If Request("b") <> "" and Request("s") <> "" Then
	SetBoardStyle
	Response.Write "<p><b>设置成功!</b>"
Else
	DisplayBoardStyleList
End If
UserTopicBottomInfo
closeDataBase
sitebottom
If GBL_ShowBottomSure = 1 Then Response.Write GBL_SiteBottomString

Function DisplayBoardStyleList

	Dim N,SetBoardID
	SetBoardID = Left(Request("b"),14)
	
	Dim Temp
	Temp = Application(DEF_MasterCookies & "BoardInfo" & SetBoardID)
	If isArray(Temp) = True Then
		If Temp(24,0) <> "" or Temp(25,0) <> "" Then
			Response.Write "<p><b><font color=red class=RedFont>此版面不允许设置为其它风格浏览。</font></b>"
			
	If u <> "" Then Response.Write "<p>-- 返回网页<a href=" & u & ">" & u & "</a>"
			Exit Function
		End If
	End If
	%>
	<p><b>本论坛有以下几种界面可供选择</b></P>
	<ul>
	<%
	for N = 0 to DEF_BoardStyleStringNum
	%>
		<li><a href="BoardStyle.asp?b=<%=htmlencode(SetBoardID)%>&s=<%=N%>&u=<%=urlencode(u)%>"><%=DEF_BoardStyleString(N)%></a><br>
	<%
	Next
	%>
	</ul>
	<%

End Function

Function SetBoardStyle

	Dim SetBoardID,BoardStyle

	SetBoardID = Left(Request("b"),14)
	If isNumeric(SetBoardID)=0 Then SetBoardID=0
	SetBoardID = cCur(SetBoardID)
	
	BoardStyle = Left(Request("s"),14)
	If isNumeric(BoardStyle)=0 Then BoardStyle=0
	BoardStyle = Fix(cCur(BoardStyle))
	
	If BoardStyle < 0 and BoardStyle > DEF_BoardStyleStringNum Then BoardStyle = 0

	If SetBoardID < 1 Then
		Response.Cookies(DEF_MasterCookies & "style").Expires = Date + 365
		'针对多个版面不同风格需求 Response.Cookies(DEF_MasterCookies & "style")("border0") = BoardStyle
		Response.Cookies(DEF_MasterCookies & "style")("border") = BoardStyle
		If u <> "" Then Response.Redirect u
		Response.Write "<br>"
		If u <> "" Then Response.Write "<br>-- 返回网页<a href=" & u & ">" & u & "</a>"
		Response.Write "<br>-- <a href=../Boards.asp>返回首页</a>"
		Exit Function
	End If

	Dim Rs,BoardName
	Set Rs = Con.ExeCute("Select top 1 BoardName,BoardStyle from LeadBBS_Boards where BoardID=" & SetBoardID)
	GBL_DBNum = GBL_DBNum + 1
	If Not Rs.Eof Then
		Response.Cookies(DEF_MasterCookies & "style").Expires = Date + 365
		'针对多个版面不同风格需求 Response.Cookies(DEF_MasterCookies & "style")("border" & SetBoardID) = cCur(BoardStyle)
		Response.Cookies(DEF_MasterCookies & "style")("border") = cCur(BoardStyle)
		BoardName = Rs(0)
	End If
	Rs.Close
	Set Rs = Nothing
	If u <> "" Then Response.Redirect u
	Response.write "<br>"
	If u <> "" Then Response.Write "<br>-- 返回网页<a href=" & u & ">" & u & "</a>"
	Response.Write "<br>-- 返回版面<a href=../Board/Board.asp?BoardID=" & SetBoardID & ">" & BoardName & "</a>"
	Response.Write "<br>-- <a href=../Boards.asp>返回首页</a>"

End Function%>