<!--#include file="Conn.asp"-->
<!-- #include file="inc/const.asp" -->
<!--#include file="inc/dv_clsother.asp"-->
<%
Dvbbs.LoadTemplates("")
If Dvbbs.UserID=0 Then
	Dvbbs.AddErrCode(24)
	Dvbbs.showerr()
Else
	If Dvbbs.Master Then
		Response.redirect "index.asp?boardid="&Dvbbs.Boardid
	End If
End If
dvbbs.stats="交费进入认证论坛"
Dvbbs.Nav()
Dvbbs.Head_var 1,Dvbbs.BoardNode.attributes.getNamedItem("depth").text,"",""
Dvbbs.Showerr()
Select Case request("action")
	Case "subinfo"
		subinfo()
	Case Else
		Main()
End Select
Dvbbs.activeonline()
Dvbbs.footer()

Sub Main()
Dim UseMondy,UseTicket
UseMondy = Dvbbs.Board_Setting(62)
UseTicket = Dvbbs.Board_Setting(63)
If Dvbbs.VipGroupUser Then
	UseMondy = UseMondy * Dvbbs.Board_Setting(66)
	UseTicket = UseTicket * Dvbbs.Board_Setting(66)
End If
%>
<table cellpadding=3 cellspacing=1 align=center class=tableborder1>
<form action="pay_boardlimited.asp?action=subinfo&boardid=<%=Dvbbs.BoardID%>" method=post>
<tr><th align=center colspan=2>付费进入认证论坛</td></tr>
<tr><td class=tablebody1 colspan=2 height=24>访问该版面规则为：获得 <B><%=Dvbbs.Board_Setting(64)%></B> 个月的访问权限将花费您 <B><%=UseMondy%></B> 个金币 或 <B><%=UseTicket%></B> 张点券。
</td></tr>
<tr><td class=tablebody1 colspan=2 height=24>您目前共有 金币 <B><%=Dvbbs.MyUserInfo(37)%></B> 个 ＋ 点券 <B><%=Dvbbs.MyUserInfo(38)%></B> 张 的货币单位可供支付 （<a href="UserPay.asp?action=UserCenter" target="_blank"><font color=red>兑换论坛金币</font></a> | <a href="UserPay.asp" target="_blank"><font color=red>购买论坛点券</font></a> | <a href="plus_Tools_SmsPay.asp"><font color=red>点播手机短信获奖论坛点券</font></a>）</td></tr>
<tr><td class=tablebody1 colspan=2 height=24 style="line-height : 15px"><B>购买操作说明</B>：<BR>
1、只需要金币购买的，则会扣除您相应的金币，不够则不能操作<BR>
2、只需要点券购买的，则会扣除您相应的点券，点券充值请看<a href="plus_Tools_Center.asp">道具中心</a>，不够则不能操作<BR>
3、金币和点券都能购买的，优先扣除相应的点券数，如果不够则从您的金币中扣除，如果两者均不够则不能操作<BR>
<%If Dvbbs.forum_setting(43)="1" Then%>
4、Vip用户只需花费 <B><font color=red><%=Dvbbs.Board_Setting(62)*Dvbbs.Board_Setting(66)%></font></B> 个金币 或 <B><font color=red><%=Dvbbs.Board_Setting(63)*Dvbbs.Board_Setting(66)%></font></B> 张点券 （<a href="JoinVipGroup.asp" target="_blank"><font color=red>现以升级成为VIP用户</font></a>）
<%End If%>
</td></tr>
<tr><td align=center class=tablebody2 colspan=2><input type=submit value="确认支付"></td></tr>
</form>
</table>
<%
End Sub

Sub Subinfo()
	Dim GetUserMoney,GetUserTicket,iUserInfo,ChkPoint
	GetUserMoney = 0
	GetUserTicket = 0
	GetUserMoney = Clng(Dvbbs.Board_Setting(62))
	GetUserTicket = Clng(Dvbbs.Board_Setting(63))
	ChkPoint = False
	If Dvbbs.VipGroupUser Then
		GetUserMoney =GetUserMoney * cCur(Dvbbs.Board_Setting(66))
		GetUserTicket = GetUserTicket * cCur(Dvbbs.Board_Setting(66))
	End If
	If GetUserTicket >0 Then
		If cCur(Dvbbs.MyUserInfo(38))-GetUserTicket>=0 Then
			Dvbbs.MyUserInfo(38) = cCur(Dvbbs.MyUserInfo(38)) - GetUserTicket
			GetUserMoney = 0
			ChkPoint = True	
		End If
	End If
	If GetUserMoney >0 Then
		If cCur(Dvbbs.MyUserInfo(37))-GetUserMoney>=0 Then
			Dvbbs.MyUserInfo(37) = cCur(Dvbbs.MyUserInfo(37)) - GetUserMoney
			GetUserTicket = 0
			ChkPoint = True
		End If
	End If
	If ChkPoint = False and (GetUserMoney > 0 or GetUserTicket > 0) Then
		Response.redirect "showerr.asp?ErrCodes=<li>您的金币或点券数目不够，不能购买进入论坛服务&action=OtherErr"
	End If
	Add_SuperBoardUser(Dvbbs.MemberName)
	Dvbbs.Execute("Update Dv_User Set UserMoney = UserMoney - "&GetUserMoney&",UserTicket = UserTicket - "&GetUserTicket&" Where UserID=" & Dvbbs.UserID)
	Session(Dvbbs.CacheName & "UserID") = Dvbbs.MyUserInfo
%>
<table cellpadding=3 cellspacing=1 align=center class=tableborder1>
<tr><th align=center colspan=2>付费进入版面操作成功</td></tr>
<tr><td class=tablebody1 colspan=2 height=24>您支付了 <B><%=GetUserMoney%></B> 个金币 或 <B><%=GetUserTicket%></B> 张点券，获得 <%=Dvbbs.BoardType%> 版面截止到 <B><%=DateAdd("m",1,Now())%></B> 的访问权限</td></tr>
<tr><td class=tablebody1 colspan=2 height=24><li><a href="list.asp?boardid=<%=Dvbbs.BoardID%>">进入该版面</a></td></tr>
</table>
<%
End Sub

Function Add_SuperBoardUser(UserName)
	Dim Rs,SuperBoardUser,SuperBoardUser_List,SuperBoardUser_List_A,i
	UserName = Replace(UserName,",","")
	If Ubound(Dvbbs.BoardUser)=-1 Then
		SuperBoardUser = UserName & "=" & Now()
	Else
		'清除该用户原购买信息
		For i=0 To Ubound(Dvbbs.BoardUser)
			SuperBoardUser_List_A = Split(Dvbbs.BoardUser(i),"=")
			If Trim(Lcase(SuperBoardUser_List_A(0))) <> Trim(Lcase(UserName)) Then
				If i=0 Then
					SuperBoardUser = Dvbbs.BoardUser(i)
				Else
					SuperBoardUser = SuperBoardUser & "," & Dvbbs.BoardUser(i)
				End If
			End If
		Next
		If SuperBoardUser<>"" Then
			SuperBoardUser = SuperBoardUser & "," & UserName & "=" & Now()
		Else
			SuperBoardUser = UserName & "=" & Now()
		End If
	End If
	'Response.Write SuperBoardUser
	Dvbbs.Execute("Update Dv_Board Set BoardUser='"&Replace(SuperBoardUser,"'","")&"' Where BoardID=" & Dvbbs.BoardID)
	Dvbbs.ReloadBoardCache Dvbbs.BoardID,SuperBoardUser,"boarduser"
	'Dvbbs.ReloadBoardInfo(Dvbbs.BoardID)
End Function
%>